All started when I've got a new toy: a GoPro Hero 5. So I went out and took a 37 minute video. It turned out to be 13GB splitted in multiple chunks of 4GB. That is a lot of memory especially when you do make serious backups. As I knew that the were encoded in H.264 and that H.265 should reduce the file size about 50 percent I've started to look for a way to reencode.
Fortunately in the year 2017 ffmpeg supports H.265 out of the box on
Ubuntu and I've quickly got a result:
ffmpeg -i GO010093.MP4 -c:a copy -c:v libx265 compressed.mp4
Yes H.265 has the same mp4 ending. And it seemed to work really
great. The 4GB chunks turned down to 600MB. The video showed no
additional artifacts. Just after watching the result I've got the
feeling that something is wrong.
After some inspection I've found out what it was: there was a lost
To make a long story short: the GoPro uses the pixel format yuvj420p
which is not only deprecated but also has two ranges for the bits
and choosing the wrong one leads to decrease in contrast.
The following command solved the issue for me:
ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i
GOPR0094.MP4 -c:a copy -c:v libx265 compressed_with_contrast.mp4