[FFmpeg-user] Loss of anamorphic aspect ration in conversion from MKV/H264 to MpegTS/H264

Ulrik Mikaelsson ulrik.mikaelsson at gmail.com
Wed May 16 10:21:27 CEST 2012


Hi,

I have got a bunch of MKV/H264 files that I would like to
format-convert to MpegTS, but I'm failing to maintain the anamorphic
aspect ratio.

I've tried the conversion as;

 $ avconv -i ~/Video/test.mkv -vcodec copy -acodec copy -bsf
h264_mp4toannexb ~/test.ts

I also tried using ffmpeg to produce raw h264 bitstream as;

 $ avconv -i ~/Video/test.mkv -vcodec copy -bsf h264_mp4toannexb ~/test.h264

The conversion itself works fine, but the anamorphic aspect-ratio is
lost, so the resulting TS is played with 1x1 pixel ratio. I've tried
forcing it with --aspect, I've tried different tools (vlc, mencoder,
gstreamer...), but nomatter what I don't seem to get the aspect ratio
right (or even manage to affect it, at all).

Now I wonder, are there some limitations to h264 in MpegTS that
prevents anamorphic resolutions? I've tried reading the H264 specs,
including Annex B, and while I did find some references, it's a lot to
take in at once, so I reached no definite conclusion.

Or am I doing something wrong?

Best Regards
/ Ulrik


More information about the ffmpeg-user mailing list