Posts

Showing posts from June, 2012

AVCLevels PHP Library: read and set profile level from H264 AVC-encoded video (MP4, MKV, ...)

I was stunned this morning to find out about AVC levels  (H264/MPEG-4 AVC). Basically, when you encode a video using the widespread H264 codec for the video stream, the encoder sets a flag called the "level". Wikipedia says that the level  is a specified set of constraints indicating a degree of required decoder performance for a profile . The problem I have with this is: some software and equipment restrict their own capabilities based on that level! They check the level, and if the value doesn't please them, they refuse to even attempt to play the video. What is this all about? See, I had two MP4 videos. One would play fine on my iPhone, the other refused to play (iTunes refused to copy it into my library, claiming that my iPhone did not support the video format). I inspected both files with MediaInfo , they were both encoded properly with AVC (H264) and AAC audio, similar bitrates, same resolution. After hours of testing and research I stumbled upon this blog po