Can ffmpeg losslessly downgrade H.264 level from 4.1 to 4?

1

I have some .mkv files with h.264 video streams. When I performed the original encoding I limited the decoder level to 4.1 for compatibility with a Samsung SmartTV. Now I'm having issues with a different decoder that's limited to Level 4.

Is there a way that ffmpeg can losslessly downgrade from level 4.1 to 4?

Jason S

Posted 2017-07-19T21:48:50.760

Reputation: 13

Answers

1

Not directly. Use ffmpeg from direct264, a modded version of an old ffmpeg build with a custom filter to modify H264 bitstreams.

ffmpeg -i in.mkv -vcodec copy -acodec copy -vbsf h264_changesps=level=40 out.mkv

Of course, all this does is change some bits in the video stream. Since you're downgrading the level, your other decoder may not smoothly play this video.

This build is crippled in most other ways, so rename it or don't put it in your path.

Gyan

Posted 2017-07-19T21:48:50.760

Reputation: 21 016

4.1 to 4.0, this should work perfectly IF the stream is under 20mbps. That is the only difference between 4.1 and 4.0. – szatmary – 2017-07-20T22:20:17.000

Unfortunately I don't think I asked the correct question. This answer is a perfectly cromulent answer to the question I did ask, so I'll accept it. – Jason S – 2017-07-21T16:30:08.930

1On a whim I tried ffmpeg -i file.mkv -map 0 -codec copy -codec:0 libx264 -level:0 4 file_out.mkv using the standard build of ffmpeg. It generated a file of identical byte length. Since my problem seems to be related to a lack of hardware decoder speed, changing a few bits probably won't solve my problem. – Jason S – 2017-07-21T16:34:58.083