Я записываю видео в своем приложении и загружаю его на сервер. Приложение отлично работает с небольшими видео, но если видео длиннее 10 секунд, размер видео становится очень большим, и приложение вылетает.
Как уменьшить размер видео? Могу ли я установить разрешение? Могу ли я также сжать видео?
Что еще вы порекомендуете мне сделать, чтобы видео не было гигантским?
Вот мой код:
Public Sub InitializeVideoRecorder()
If captureSource Is Nothing Then
' Create the VideoRecorder objects.
captureSource = New CaptureSource()
fileSink = New FileSink()
videoCaptureDevice = CaptureDeviceConfiguration.GetDefaultVideoCaptureDevice()
' Add eventhandlers for captureSource.
AddHandler captureSource.CaptureFailed, AddressOf OnCaptureFailed
' Initialize the camera if it exists on the device.
If videoCaptureDevice IsNot Nothing Then
' Create the VideoBrush for the viewfinder.
videoRecorderBrush = New VideoBrush()
videoRecorderBrush.SetSource(captureSource)
' Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush
' Start video capture and display it on the viewfinder.
captureSource.Start()
' Set the button state and the message.
UpdateUI(ButtonState.Initialized, "")
Else
' Disable buttons when the camera is not supported by the device.
UpdateUI(ButtonState.CameraNotSupported, "A camera is not supported on this device.")
End If
End If
End Sub