Video file length is 3 times lesser than the original video based on the resolution [closed]
Hi Thank you for the reply.
Is there any relationship between the Height and Width with FPS?
in my application I have set the FPS as 30 and Resolution: Width = 640 Height = 480;
the output saved video seems 90% Okay.
but when i set the resolution as below Width = 1280; Height = 720;
the video file length is 3 times lesser than the original video.(especially when checking with external camera. not laptop camera) for example, if i record the video for 3 minutes, but the video file has only 1 minute length.
Note: the code snippet is shared:
// This resolution working fine.
private static int Width = 640;
private static int Height = 480;
// This resolution is not working
private static int Width = 1280;
private static int Height = 720;
capture = new VideoCapture(CaptureDevice.Any,index:1);
capture.Fps = 30;
capture.FrameWidth = Width;
capture.FrameHeight = Height;
// Read movie frames and write them to VideoWriter
// Size dsize = new Size(Width, Height);
using (VideoWriter writer = new VideoWriter(longVideoName, FourCC.H264,capture.Fps, new Size(Width, Height)))
{
Console.WriteLine("Converting each movie frames...");
Mat frame = new Mat();
while (true)
{
System.Diagnostics.Debug.WriteLine(System.DateTime.Now.ToString("O"));
// Read image
capture.Read(frame);
// frame = capture.RetrieveMat();
if (frame.Empty())
break;
// Console.CursorLeft = 0;
Console.WriteLine("{0} / {1}", capture.PosFrames, capture.FrameCount);
Cv2.PutText(frame,
System.DateTime.Now.ToString("O"),
TimePoint,
HersheyFonts.HersheySimplex,
0.8,
TimeScalar,
1,
LineTypes.Link8);
writer.Write(frame);
}
Please help me on this.
Thanks, Rajasekar
no, there isn't.
unfortunately we cannot help with your c# app, opencv does not support any c# bindings
Actually, if we increase the resolution of the video frame, the capture.Read method delays, due to that the eventhough if i set FPS as 30, only 10 frames are taken in a second
this probably never worked:
but again, we cannot know, what your code does there
Sorry. that is a type, the FPS is 30.
Actually, if we increase the resolution of the video frame, the capture.Read method delays, due to that the eventhough if i set FPS as 30, only 10 frames are taken in a second. is my understanding correct?