I want to change the x264 profile of an mp4 I've because High@L5.2 doesn't play on my TV. I searched for some solutions online but didn't find any. There's a program called H264LevelEditor_1.5.3 to change profiles but that didn't work. One solution I found on the internet, I think it might work although I don't know how to implement it. I'm copy pasting the discussion on a forum related to this topic.
"I have 1000+ videos with wrong Level information, and hence do not play on some devices. They are H.264 baseline with aac audio in mp4 container. I want to correct them but avoid re-encoding. Am I right in assuming that this is possible and will be faster? How do I identify the level_idc bits in the streams? Will all streams have them in the same location? I expect this to be in just one place in the stream, is this assumption correct? Update: I came across a windows executable link that claims to do this. I want to be able to do this commandline on unix, so I can script it.
More Updates: As per Roman's answer below. I dug up MP4 syntax and found that Profile and Level information are part of avcC atom under stsd. I could see that level was set to 1E, I corrected it to 1F. Before: 61 76 63 43 01 42 C0 1E FF E1 00 19 67 42 C0 1E
D9 After: 61 76 63 43 01 42 C0 1F FF E1 00 19 67 42 C0 1E
I found a solution, a big credit goes to @Roman for helping me figuring this out. Find the Profile and Level after avcC atom in the mp4 bitstream, in my case this was 42 C0 1E , Baseline@L3.0, I wanted the level to be 3.1. To do this find all occurrences of 42 C0 1E in the stream and replace 1E with 1F. I found about 8-10 such occurrences. And now you have Baseline@L3.1. This can be verified using mediainfo. I think this is necessary because h.264 is encoded as a bunch of packets, and each of them have SPS header with profile and level information."
Here's the link for the forum
What I'm thinking of is of some way to edit the mp4 file using a hex editor so that the profile displayed is changed and the file might work on my TV. I know the last solution is a complete encoding of the file but I want to avoid it if possible.
Thanks for any help.
+ Reply to Thread
Results 1 to 5 of 5
There are tools to change the level value:
But if you will be successful is another question. The level is supposed to limit the maximum number of reference frames and bitrate. While the bitrate of e.g. level 4.0 is seldomly exceeded the ref frame limit may very well be. Then there isn't enough memory for playback and players will still not play these files. So whether your attempts will work will depend on your files (number of references) and your player. Use MediaInfo to find out about level and ref frames of your files.
TVs will never catch up with the infinite posssibilities for Mp4s.. Also newer files will probably be in H265 and HEVC... or will be in 10 bit.. all will not be playable on your TV (because the compatibility will be a small- hence your tv will most likely reject them even if you try to fool it with the level flag). Most file will require a recode using handbrake.. and that will take a long time esp for 1000+ videos.. Perhaps the best solution is to find a media player hooked to your TV (like those android or k*d* boxes) that have the necessary ooomph to play your files.. (No manipulation needed)..
sorry for the repost, just some correction.
I used the programs you mentioned but unfortunately it didn't work. h264Modify wasn't successful in changing the profile number but, the other one, ffmpeg worked. I managed to change the profile to 5.1 but still my TV couldn't recognize the file. Encoding it is the only option left now. My TV can play 5.1 easily but I guess 5.2 is out of bounds.
Thank you so much for your help.