[FFmpeg-user] SAR changes when stream copying y4m video to Matroska when SAR is present in source

Kieran O Leary kieran.o.leary at gmail.com
Mon Jul 25 02:17:11 EEST 2016


Hello,

I posted a similar issue recently where an unknown SAR was declared as
1:1 when stream copied to matroska.

I think this is a different issue because the SAR is declared in the
source in this instance. I am running some tests on the xiph/derf
collection and found that a lot of the videos had different aspect
ratios when stream copied to matroska.

I am wondering if this is an issue with the Matroska specifcation or
some issue with ffmpeg. For what it's worth, I looked at the output
file in mediaconch and PixelWidth is listed as 176, and DisplayWidth
is listed as 193.

Source can be downloaded from here
https://media.xiph.org/video/derf/y4m/bus_qcif_15fps.y4m
Full command and output at the bottom of the email, but here's the key
details from the input:

Input #0, yuv4mpegpipe, from 'bus_qcif_15fps.y4m':
  Duration: 00:00:05.00, start: 0.000000, bitrate: 4562 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
176x144, SAR 128:117 DAR 1408:1053, 15 fps, 15 tbr, 15 tbn, 15 tbc

and the output:

Input #0, matroska,webm, from 'out.mkv':
  Metadata:
    ENCODER         : Lavf57.41.100
  Duration: 00:00:05.00, start: 0.000000, bitrate: 4568 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
176x144, SAR 193:176 DAR 193:144, 15 fps, 15 tbr, 1k tbn, 1k tbc
(default)

2 outputs will follow:

1. Stream copy to Matroska
2. ffmpeg -i  of output file


1.

 ffmpeg -i bus_qcif_15fps.y4m -c copy out.mkv
ffmpeg version N-44317-g7af44ce Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration:
--prefix=/home/kieranjol/.linuxbrew/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=/usr/bin/gcc-4.8
--host-cflags='-Os -w -pipe -march=core2'
--host-ldflags='-L/home/kieranjol/.linuxbrew/lib
-Wl,--dynamic-linker=/home/kieranjol/.linuxbrew/lib/ld.so
-Wl,-rpath,/home/kieranjol/.linuxbrew/lib' --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 50.100 / 57. 50.100
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, yuv4mpegpipe, from 'bus_qcif_15fps.y4m':
  Duration: 00:00:05.00, start: 0.000000, bitrate: 4562 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
176x144, SAR 128:117 DAR 1408:1053, 15 fps, 15 tbr, 15 tbn, 15 tbc
File 'out.mkv' already exists. Overwrite ? [y/N] y
[matroska @ 0x21ba860] Using AVStream.codec to pass codec parameters
to muxers is deprecated, use AVStream.codecpar instead.
Output #0, matroska, to 'out.mkv':
  Metadata:
    encoder         : Lavf57.41.100
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 176x144
[SAR 128:117 DAR 1408:1053], q=2-31, 15 fps, 15 tbr, 1k tbn, 15 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   75 fps=0.0 q=-1.0 Lsize=    2788kB time=00:00:04.93
bitrate=4629.1kbits/s speed= 115x
video:2784kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.134154%


2.


ffmpeg -i out.mkv
ffmpeg version N-44317-g7af44ce Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration:
--prefix=/home/kieranjol/.linuxbrew/Cellar/ffmpeg/HEAD --enable-shared
--enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=/usr/bin/gcc-4.8
--host-cflags='-Os -w -pipe -march=core2'
--host-ldflags='-L/home/kieranjol/.linuxbrew/lib
-Wl,--dynamic-linker=/home/kieranjol/.linuxbrew/lib/ld.so
-Wl,-rpath,/home/kieranjol/.linuxbrew/lib' --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 50.100 / 57. 50.100
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from 'out.mkv':
  Metadata:
    ENCODER         : Lavf57.41.100
  Duration: 00:00:05.00, start: 0.000000, bitrate: 4568 kb/s
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p,
176x144, SAR 193:176 DAR 193:144, 15 fps, 15 tbr, 1k tbn, 1k tbc
(default)
    Metadata:
      DURATION        : 00:00:05.000000000
At least one output file must be specified


Best,

Kieran.


More information about the ffmpeg-user mailing list