Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3528 closed enhancement (fixed)

FFmpeg does not store the aspect ratio in asf files

Reported by: ramitb Owned by: Carl Eugen Hoyos
Priority: wish Component: avformat
Version: git-master Keywords: asf aspect
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug: When using libxvid or wmv2 ffmpeg does not store or maintain the aspect ratio.

Whether one specifies the -aspect or setsar it doesn't seem to make any difference. When played back in WMP the aspect ratio is not preserved.

I will upload a sample video which has 16:9 aspect ratio and plays back fine in WMP. When converted using wmv2 or libxvid, when played back in WMP it shows as a 4:3 (with wmv2 it doesn't seem to store the aspect ratio, with libxvid it appears to store it but when played back in WMP it still shows up as 4:3, for some reason it isnn't storing it correctly).

I will upload the same file as below (cut down in size and renamed)

One examples of wmv2 below (you can also use libxvid instead)
How to reproduce:

ffmpeg.2315Custom1.exe -i "..\The Bridges That Built London... (BBC FOUR - 14-06-20
12).ts" -vcodec wmv2 -b 1400000 -acodec wmav2 -ab 192k test.wmv
ffmpeg version N-62019-gd506dea Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr  1 2014 13:31:14 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/Software/ffmpeg/sandbox/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enab
le-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg
--enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filt
er=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-a
mrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --pref
ix=/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disable-shared --enable-libsoxr --enable-f
ontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIB
TWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-l
ibvidstab --extra-cflags= --extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-libfaac --enable-runtime-cpudete
ct
  libavutil      52. 71.100 / 52. 71.100
  libavcodec     55. 55.107 / 55. 55.107
  libavformat    55. 36.100 / 55. 36.100
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
[NULL @ 034f3d60] start time is not set in estimate_timings_from_pts
Input #0, mpegts, from '..\The Bridges That Built London... (BBC FOUR - 14-06-2012).ts':
  Duration: 00:01:38.16, start: 0.151678, bitrate: 4310 kb/s
  Program 1
    Stream #0:0[0x30]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max.
 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x40](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:2[0x50](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Please use -b:a or -b:v, -b is ambiguous
Output #0, asf, to 'test.wmv':
  Metadata:
    WM/EncodingSettings: Lavf55.36.100
    Stream #0:0: Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=2-31, 1400 kb/s, 1k tbn, 25 t
bc
    Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video -> wmv2)
  Stream #0:1 -> #0:1 (mp2 -> wmav2)
Press [q] to stop, [?] for help
frame= 2455 fps= 70 q=5.1 Lsize=   19720kB time=00:01:38.20 bitrate=1645.1kbits/s
video:16771kB audio:2300kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.402935%
ffmpeg.2315Custom1.exe -i test.wmv
ffmpeg version N-62019-gd506dea Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr  1 2014 13:31:14 with gcc 4.8.0 (GCC)
  configuration: --arch=x86 --target-os=mingw32 --cross-prefix=/Software/ffmpeg/sandbox/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enab
le-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg
--enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filt
er=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-a
mrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --pref
ix=/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disable-shared --enable-libsoxr --enable-f
ontconfig --enable-libass --enable-libutvideo --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIB
TWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-l
ibvidstab --extra-cflags= --extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-libfaac --enable-runtime-cpudete
ct
  libavutil      52. 71.100 / 52. 71.100
  libavcodec     55. 55.107 / 55. 55.107
  libavformat    55. 36.100 / 55. 36.100
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  5.102 /  2.  5.102
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, asf, from 'test.wmv':
  Metadata:
    encoder         : Lavf55.36.100
  Duration: 00:01:38.29, start: 0.000000, bitrate: 1643 kb/s
    Stream #0:0: Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 720x576, 25 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp, 192 kb/s
At least one output file must be specified}}}

Change History (11)

comment:1 by ramitb, 11 years ago

Uploaded a file #3528.ts to the incoming folder

comment:2 by Carl Eugen Hoyos, 11 years ago

Since you mention libxvid several times: Is the problem not reproducible with -vcodec mpeg4?

comment:3 by ramitb, 11 years ago

Now that you bring it up I did it and yes the same issue with mpeg4 codec as well. Infact I tried a few more combinations, mpeg4, libxvid and wmv2. Then I tried AVI, WMV and MP4 containers.

Interestingly both AVI and WMV containers have the same issue however if I put it into a MP4 container it works fine.

So the issue is with the AVI and WMV containers not keeping the aspect ratio. So that narrows it down (and probably the title needs to be corrected). Any idea why?

comment:4 by ramitb, 11 years ago

Any thoughts on what the issue is?

comment:5 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Keywords: asf aspect added
Owner: set to Carl Eugen Hoyos
Priority: normalwish
Reproduced by developer: set
Status: newopen
Summary: Ffmpeg does not maintain or store the aspect ratio with WMV2 and libxvid codecsFFmpeg does not store the aspect ratio in asf files
Type: defectenhancement
Version: unspecifiedgit-master

comment:6 by Carl Eugen Hoyos, 11 years ago

Resolution: fixed
Status: openclosed

Fixed in a3bd33af

comment:7 by ramitb, 11 years ago

I'm reopening this as this issue is still present with AVI files (e.g. using the mpeg4 codec in AVI container). While WMV issue has been fixed, when using a 4:3 SD source video AVI does not maintain the aspect ratio.

comment:8 by ramitb, 11 years ago

Before I reopen, should I reopen or create a new ticket?

in reply to:  7 comment:9 by Carl Eugen Hoyos, 11 years ago

Replying to ramitbhalla:

I'm reopening this as this issue is still present with AVI files

This is not true (consider testing more than one application) and how would this be asf-related (this is how you described your original issue, the WMP-related issue with avi files occurred to you later)?

comment:10 by ramitb, 11 years ago

It's not you're correct, it's AVI related, I'll open a new ticket and attach an approprite sample.

comment:11 by ramitb, 11 years ago

You're right it's an issue with WMP (plays fine with KMplayer), so the question is why only WMP? Something ffmpeg can do about it or is that a WMP issue?

Note: See TracTickets for help on using tickets.