2

I made a music video with a still image (input.jpg ≈ 1 MB) and a music (input.wav ≈ 20 MB) using FFmpeg. Why do I get such a huge difference in file size between the video generated with the lossless HEVC codec (output.mkv ≈ 70 MB) and that generated with the FFV1 codec (output.mkv ≈ 10 GB)?

The issued commands

  • for lossless HEVC:
ffmpeg -loop 1 -i input.jpg -i input.wav \
       -c:v hevc -crf 0 -c:a flac -s 3840x2160 -r 60 -shortest output.mkv
  • for FFV1:
ffmpeg -loop 1 -i input.jpg -i input.wav \
       -c:v ffv1 -c:a flac -s 3840x2160 -r 60 -shortest output.mkv

It looks like either the provided parameters for lossless HEVC are incorrect (in the sense not really lossless) or FFV1 is a terrible codec.

0

1 Answer 1

5

FFV1 is intra-coded so each frame is compressed independently of other frames; HEVC is typically inter-coded.

Assuming you're using libx265, you have to add -x265-params lossless=1 for true lossless mode (-crf 0 isn't). At the end of encoding, x265 should print a line displaying lossless compression ratio.

x265 has better intra-prediction than x264 and I expect, FFV1, so lossless compression is more efficient. But it takes more resources to decode.

4
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – DavidPostill
    Mar 2, 2020 at 18:33
  • Thank you a lot for your patience. I am going to accept your answer. Just before I do, in the interest of the reader, could you add to your answer the two important points that we have been discussing in these comments? a) HEVC can also use intra-frame prediction only like FFV1 with -g 1 since FFmpeg 4.3, and with -x265-params keyint=1 before FFmpeg 4.3; b) -crf 0 has no effect with -x265-params lossless=1 so should not be used. That will make your answer even more awesome.
    – Géry Ogam
    Mar 3, 2020 at 14:05
  • I think b is already covered, and a is not directly relevant to the Q as asked.
    – Gyan
    Mar 3, 2020 at 14:07
  • About a), for me it is very relevant to know that I can get the same behaviour as FFV1. About b), your answer does not explicitly state that -crf 0 has no effect when combined with -x265-params lossless=1. So I have been wondering if I should keep it or not (for you it might be obvious since you are an FFmpeg maintainer, but me I am a new FFmpeg user, like most future readers of this post). In addition, with the H.264 codec, -crf 0 does mean true lossless mode (cf. this answer), which is very confusing, so a little explanation would not harm.
    – Géry Ogam
    Mar 3, 2020 at 14:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .