Looking for a ffmpeg command that would convert IphoneX HEVC 4K 25fps videos to any format that will work on PC - PremierePro and keep it lossless.
1 Answer
Conversion always will involve some loss, only copy (-c) is lossless.
There are some suggestions for "lossless" encoding in this Q&A, but I can't test them on my phone. There are UpVoted and have an accepted answer: the intermediate and output file will be uncompressed, and huge.
You can minimize loss when converting your existing videos by choosing an excessively high bitrate, since it's a cellphone video it will be of a limited length and thus only expand so much.
The ffmpeg H.264 Video Encoding Guide claims to offer lossless encoding using the -crf 0
command. It also mentions that you should expect incompatibility problems with some programs.
The section: Choose a CRF value says:
The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so; it should look the same or nearly the same as the input but it isn't technically lossless.
Using '0' isn't so much a "conversion" as it is a decompression and wrapping up the uncompressed video, the so-called converted video isn't recompressed.
You can correct the problem at it's source (in future) by:
On your iPhone, go to Settings > Camera > Formats > change "High Efficiency" to "Most Compatible".
-
so-called converted video isn't recompressed --> it is. The error residuals simply aren't quantized,– GyanCommented May 26, 2018 at 13:27
-
-
-
@Gyan - Thanks for providing a link. That link is for MulticoreWare's x265 and not ffmpeg's implementation. On our site SuperUser a user reports a +3x expansion of input vs. output, if you obtain a tiny bit of compression over raw that doesn't help much when the end result is +3x bigger (for that particular example). Here's a second example, also bigger.– RobCommented May 26, 2018 at 17:28
-
The
0
CRF value you're referring to is for x264. x265 started with x264's codebase. There is no ffmpeg implementation of x264 or x265. They use those encoders via a wrapper. Lossless compression is always in reference to the uncompressed full raster frames. Any historical compressed version of those images are irrelevant. The result turns out bigger because much of the lossiness shows up as 'noise' during prediction and the lossless encoder can't throw those differences away, unlike lossy compressors.– GyanCommented May 26, 2018 at 17:47