Ivan P.
Ivan P.

Reputation: 926

How to optimize file size of recorded camera stream?

I am recording stream from camera using different approaches. I tried to record camera stream using ffmpeg. I looked at this question: https://stackoverflow.com/a/26464175/5128696 and used the following command:

ffmpeg -i http://user:[email protected]/video.cgi?resolution=vga -c copy -map 0 -f segment -segment_time 300 -segment_format mp4 "outfile%03d.mp4"

It worked, but file size peaked at 45Mb for 2 minutes video.

Then I used VLC to record stream. Result file for fragment of same length was about 2Mb

How do I optimize the recorded file size? My camera gives 640x480 video stream without audio, and 45Mb is too much.

Upvotes: 0

Views: 244

Answers (1)

llogan
llogan

Reputation: 133673

-c copy enables stream copy mode. Remove this option to re-encode:

ffmpeg -i http://user:[email protected]/video.cgi?resolution=vga -map 0 -f segment -segment_time 300 "outfile%03d.mp4"

This will use the default settings for the encoder named libx264. See FFmpeg Wiki: H.264 for more options.

Upvotes: 1

Related Questions