2
votes

I have a Nexus 6p with the stock camera. It's set to record at 1080p, 30fps. Here's a 5 second sample (11 MB).

Videos from this phone come out at about 17 Mbps on average. I tried to compress it with ffmpeg with -c:v libx264 -crf 23 -preset veryslow, the result comes out at about 5.5 MB, which is about 9 Mbps.

I think this bitrate is a bit too much. When I look at torrent file listings, I can see high quality videos at 3 GB in size on average, and if such a movie is 90 minutes long on average, that is about 4-5 Mbps which sounds okay.

I'm wondering, why the big difference? I can notice that my video is noisy/grainy (which is expected from a phone), and that might reduce compressibility. I tried a few ffmpeg filters, like hqdn3d and atadenoise, but the noise mostly remained (maybe I didn't play with it enough). Then I figured, the video is also shaky (which is also expected), and that might reduce compressibility too (and even makes temporal noise filtering less effective). I tried to stabilize it with the deshake filter, but that didn't help either.

I know I could just limit the bandwidth to whatever I like, but there must be a reason why ffmpeg thinks it needs a high bandwidth to maintain a certain quality, and a lower bandwidth would just decrease the quality.

Why do these videos have such a high bitrate? What's the best way to compress them more while keeping or even increasing their quality?

2
Your sample has fine detail - the wood grain. in focus. Generally, elements like that will reduce compressibility. Take a shot of just the blue sky and check.Gyan

2 Answers

1
votes

99.9% of the 4-5Mbps movies you're talking about are yuv420p (tv-range), whereas your cat video is pc-range:

ffprobe -i x.mp4
[...] yuvj420p(pc, bt470bg/bt470bg/smpte170m), 1920x1080, 16966 kb/s, [...]

When I run your command...

ffmpeg -i x.mp4 -c:v libx264 -level 4.0 -preset veryslow x_pc.mp4

(-crf 23 is the default, so no need to specify)

...I end up with 'x_pc.mp4', a pc-range video with a filesize of 5.15MB and a bitrate of 7.92Mbps.

When I convert your video to the conventional tv-range...

ffmpeg -i x.mp4 -pix_fmt yuv420p -c:v libx264 -level 4.0 -preset veryslow x_tv.mp4

...I end up with 'x_tv.mp4', a tv-range video with a filesize of 4.15MB and a bitrate of 6.38MBps.

So that's already 1.5Mbps less, but on top of that you could also do some denoising.
In the past I've used FFT3DFilter, an Avisynth filter, quite some times with very good results. Today I discovered that FFmpeg also has one:

ffmpeg -i x.mp4 -vf fftdnoiz=sigma=3 -pix_fmt yuv420p -c:v libx264 -level 4.0 -preset veryslow x_fft3d_tv.mp4

I end up with 'x_fft3d_tv.mp4', a denoised tv-range video with a filesize of 3.35MB, a bitrate of just 5.15Mbps and still a very good video-quality. I can't tell the difference compared to the original.

To improve compressibility these are the options I can think of.

0
votes

For me the 720p downsampling did the trick.