I played a recorded video to test this, so video content would be same in both cases.

Recorded video length is 1 Minute in both cases.

There may be a split second difference in the videos as I start FFMpeg command in cmd window and then switch to VLC player to playback video.

1) command to record:

ffmpeg -f gdigrab -framerate 30 -i desktop -f segment -segment_time 60 out12Dec1%03d.flv

This recorded video of 1 min is 9.99 MB.

2) command to compress:

ffmpeg -i out12Dec1000.flv -vcodec libx264 -crf 20 output.mp4

This compresses the video to 1.76 MB

3) Now I am trying to use the parameters to directly capture in compressed mode instead of using 2 steps.

ffmpeg -f gdigrab -framerate 30 -i desktop -f segment -segment_time 60 -vcodec libx264 -crf 20  outvcodec12Dec19%03d.mp4

I tried both with and without framerate option, and used flv / mp4 for output. The output videos are between 2.24 to 2.57 MB.

Why is the recorded output in case 3 not close to 1.76 MB?


Your first command is transcoding using FLV1 codec to store in .flv. This is not the same input provided to the x264 encoder as when directly encoded to H264. In fact, it's quite worse, since the default target bitrate set for FLV1 is 200 kbps (although for full desktop capture, it will overshoot by a lot). This has less complex detail in general so it's easier for x264 to encode than the full fidelity raw desktop input.

  • You might want to expand a bit on what you mean by "worse". I take it that you're saying that the material is already compressed, so there is less detail, which makes it easier to recompress into a smaller file.
    – stib
    Dec 13 '18 at 0:33
  • Indeed. Added..
    – Gyan
    Dec 13 '18 at 5:00
  • Thanks. Can we conclude that recording a video and then compressing will always create a smaller file size, or can I use some other options while recording? Dec 13 '18 at 5:20
  • With your current commands, yes, but the quality will be worse. I would recommend encoding to H264 directly, with these settings: ffmpeg -f gdigrab -framerate 30 -i desktop -pix_fmt yuv420p -c:v libx264 -crf 20 -preset veryfast -f segment -segment_time 60 out12Dec1%03d.flv.
    – Gyan
    Dec 13 '18 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.