[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 11:23:04 CEST 2012


2012/5/16 Carl Eugen Hoyos <cehoyos at ag.or.at>:
> Ulrik Mikaelsson <ulrik.mikaelsson <at> gmail.com> writes:
>
>>  $ avconv -i ~/Video/test.mkv -vcodec copy -acodec copy -bsf
>> h264_mp4toannexb ~/test.ts
>
> Complete, uncut console output missing.
> (including ffmpeg -i test.ts)
Sorry, but of course.

ulrik at ulrik-laptop ~> avconv -i test.mkv -vcodec copy -acodec copy
-bsf h264_mp4toannexb test.ts
avconv version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the
Libav developers
  built on Mar 22 2012 05:29:10 with gcc 4.6.3
[matroska,webm @ 0x9995260] Estimating duration from bitrate, this may
be inaccurate
Input #0, matroska,webm, from 'test.mkv':
  Duration: 00:42:26.00, start: 0.000000, bitrate: 448 kb/s
    Stream #0.0(eng): Video: h264 (High), yuv420p, 704x572, PAR 16:11
DAR 256:143, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
    Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s (default)
File 'test.ts' already exists. Overwrite ? [y/N] y
[mpegts @ 0x99f8bc0] muxrate VBR, pcr every 100 pkts, sdt every 200,
pat/pmt every 40 pkts
Output #0, mpegts, to 'test.ts':
  Metadata:
    encoder         : Lavf53.21.0
    Stream #0.0(eng): Video: libx264, yuv420p, 704x572 [PAR 16:11 DAR
256:143], q=2-31, 90k tbn, 1k tbc (default)
    Stream #0.1: Audio: ac3, 48000 Hz, 5.1, 448 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press ctrl-c to stop encoding
frame=63650 fps=4535 q=-1.0 Lsize=  782824kB time=2545.88
bitrate=2518.9kbits/s
video:576036kB audio:139228kB global headers:0kB muxing overhead 9.445403%

ulrik at ulrik-laptop ~> avconv -i test.ts
avconv version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the
Libav developers
  built on Mar 22 2012 05:29:10 with gcc 4.6.3
[mpegts @ 0x8b8e260] max_analyze_duration reached
Input #0, mpegts, from 'test.ts':
  Duration: 00:42:25.96, start: 1.400000, bitrate: 2518 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: Libav
    Stream #0.0[0x100]: Video: h264 (High), yuv420p, 704x572, 25 fps,
50 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x101]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s


>> I also tried using ffmpeg to produce raw h264 bitstream as;
>>
>>  $ avconv -i ~/Video/test.mkv -vcodec copy -bsf h264_mp4toannexb ~/test.h264
>
> I don't think you can save aspect ratio in a h264 bitstream.

Actually, I just got that answer myself, through trying to fully
transcode to TS/H264 with VLC, I get a working anamorphic video:

ulrik at ulrik-laptop ~> ffmpeg -i test.transcode.ts
ffmpeg version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the
Libav developers
  built on Mar 22 2012 05:29:10 with gcc 4.6.3
This program is not developed anymore and is only provided for
compatibility. Use avconv instead (see Changelog for the list of
incompatible changes).
[mpegts @ 0x94cc260] max_analyze_duration reached
[mpegts @ 0x94cc260] PES packet size mismatch
Input #0, mpegts, from 'test.transcode.ts':
  Duration: 00:01:01.96, start: 7815.173200, bitrate: 1255 kb/s
  Program 1
    Stream #0.0[0x44]: Audio: aac, 48000 Hz, stereo, s16, 132 kb/s
    Stream #0.1[0x45](eng): Video: h264 (High), yuv420p, 704x572 [PAR
16:11 DAR 256:143], 25 fps, 25 tbr, 90k tbn, 50 tbc

Is it plausible that the original MKV does not contain AR-info in the
h264-stream itself, but only in MKV-headers, such that it works as
long as the container retains the format, but not when splitting into
a TS or raw H264?


More information about the ffmpeg-user mailing list