[FFmpeg-user] Wrong aspect ratio correction

Kimio Miyamura xanadu at apost.plala.or.jp
Mon Feb 9 13:33:40 CET 2015


Hello list members, 

I have some wrong aspect rationed video which size is 856x480 pixel and 103 pixel black band on both side.

I thought they can be corrected with -filter:v crop like the following:

$ ffplay -i v01.wmv -vf "crop=856:480:103:0"
ffplay version N-69655-g1df841f Copyright (c) 2003-2015 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-filters --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libmp3lame --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libopenh264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab --disable-indev=qtkit --disable-indev=x11grab_xcb --disable-outdev=sdl
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.104 /  5.  9.104
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[wmv3 @ 0x7fb72d807c00] Extra data: 8 bits left, value: 00B f=0/0   
Input #0, asf, from 'v01.wmv':
  Metadata:
    Application     : Windows ムービー メーカー 2.1.4028.0
    WMFSDKVersion   : 11.0.5721.5275
    WMFSDKNeeded    : 0.0.0.0000
    artist          : PCサイト作業用
    IsVBR           : 0
    DeviceConformanceTemplate: MP at HL
  Duration: 00:02:00.28, start: 0.000000, bitrate: 2070 kb/s
    Stream #0:0(jpn): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 160 kb/s
    Stream #0:1(jpn): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 856x480, 1900 kb/s, SAR 160:160 DAR 107:60, 30 fps, 30 tbr, 1k tbn, 1k tbc
[wmv3 @ 0x7fb72d807c00] Extra data: 8 bits left, value: 0
   4.30 A-V: -0.021 fd=  13 aq=   22KB vq=  651KB sq=    0B f=0/0   


But the result is same as not cropping one.  Then I thought that I should use scale filter too like the following:

$ ffplay -i v01.wmv -vf "crop=640:360:103:0, scale=856:480"
ffplay version N-69655-g1df841f Copyright (c) 2003-2015 the FFmpeg developers
  built with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/Volumes/ffmpeg_compile --pkg-config-flags=--static --disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-filters --enable-runtime-cpudetect --enable-bzlib --enable-zlib --enable-libmp3lame --enable-libfdk-aac --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvorbis --enable-libspeex --enable-libopus --enable-libgsm --enable-libtwolame --enable-libsoxr --enable-libwavpack --enable-libmodplug --enable-libopenjpeg --enable-libwebp --enable-libtheora --enable-libx264 --enable-libopenh264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-libxavs --enable-libfreetype --enable-fontconfig --enable-libfribidi --enable-libass --enable-libbluray --enable-libvidstab --disable-indev=qtkit --disable-indev=x11grab_xcb --disable-outdev=sdl
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.104 /  5.  9.104
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[wmv3 @ 0x7fe2ac011600] Extra data: 8 bits left, value: 00B f=0/0   
Input #0, asf, from 'v01.wmv':
  Metadata:
    Application     : Windows ムービー メーカー 2.1.4028.0
    WMFSDKVersion   : 11.0.5721.5275
    WMFSDKNeeded    : 0.0.0.0000
    artist          : PCサイト作業用
    IsVBR           : 0
    DeviceConformanceTemplate: MP at HL
  Duration: 00:02:00.28, start: 0.000000, bitrate: 2070 kb/s
    Stream #0:0(jpn): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp, 160 kb/s
    Stream #0:1(jpn): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 856x480, 1900 kb/s, SAR 160:160 DAR 107:60, 30 fps, 30 tbr, 1k tbn, 1k tbc
[wmv3 @ 0x7fe2ac011600] Extra data: 8 bits left, value: 0
[swscaler @ 0x7fe2ab859a00] Warning: data is not aligned! This can lead to a speedloss
   1.95 A-V:  0.015 fd=   9 aq=   22KB vq=  611KB sq=    0B f=0/0   


This gives me expected result but ffplay warns like following:

[swscaler @ 0x7fe2ab859a00] Warning: data is not aligned! This can lead to a speed loss


Am I doing proper with correction of aspect ratio or is there any much better way?

Once I will find the correct way, I will re-encode video with ffmpeg.


Thanks for advice.


// Miya


More information about the ffmpeg-user mailing list