Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4082 closed defect (invalid)

The scale filter does not actually change the height and width.

Reported by: muruganandh Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: scale
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

As per this document - https://trac.ffmpeg.org/wiki/Scaling%20%28resizing%29%20with%20ffmpeg

-vf scale=320:240 should covert any video to 320 by 240 disregarding the aspect ratio of the source

How to reproduce:

% ffmpeg -i input -vf scale=320:240 output
ffmpeg version ffmpeg version 2.4.3-tessus
built on Nov  3 2014 23:01:10 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Steps :

  1. Use any source video - i used 1280 by 720 Video.
  2. use this command -i input.mp4 -vf scale=100:100 output.mp4

Expected : A Video of size 100px width and 100px height (https://trac.ffmpeg.org/wiki/Scaling%20%28resizing%29%20with%20ffmpeg)

Actual : You get a video of 177 by 100 (ffprobe will say the video as 100 by 100 but quicktime player or VLC player will play by aspect ratio maintained). The resulting video is actually 117 by 100 - Get Info from MAC will show the real value.

Change History (4)

comment:1 Changed 4 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords filter removed
  • Priority changed from critical to normal

Please provide the command line that does not produce the expected results together with the complete, uncut console output to make this a valid ticket.
Consider using the setsar filter to change the aspect ratio of your output file and consider posting all usage question on the user mailing list.

comment:2 Changed 4 years ago by muruganandh

Command :
ffmpeg -i /Users/Anand/Desktop?/input.mp4 -vf scale=100:100 output.mp4

Console Output :
ffmpeg version 2.4.3-tessus Copyright (c) 2000-2014 the FFmpeg developers

built on Nov 3 2014 23:01:10 with Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/Users/tessus/data/ext/ffmpeg/sw --as=yasm --extra-version=tessus --disable-shared --enable-static --disable-ffplay --enable-gpl --enable-pthreads --enable-postproc --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-libsoxr --enable-libwavpack --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libmodplug --enable-fontconfig --enable-libfreetype --enable-libass --enable-libbluray --enable-filters --disable-indev=qtkit --disable-indev=x11grab_xcb --enable-runtime-cpudetect
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Anand/Desktop?/input.mp4':

Metadata:

major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2014-07-16 04:31:18
genre : 4. Akil Videos

Duration: 00:03:46.43, start: 0.000000, bitrate: 12065 kb/s

Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 101 kb/s (default)
Metadata:

creation_time : 2014-07-16 04:31:18
handler_name : Core Media Audio

Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 11958 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 50 tbc (default)
Metadata:

creation_time : 2014-07-16 04:31:18
handler_name : Core Media Video

[libx264 @ 0x7ff21200d800] using SAR=16/9
[libx264 @ 0x7ff21200d800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x7ff21200d800] profile High, level 1.0
[libx264 @ 0x7ff21200d800] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':

Metadata:

major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
genre : 4. Akil Videos
encoder : Lavf56.4.101
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 100x100 [SAR 16:9 DAR 16:9], q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
Metadata:

creation_time : 2014-07-16 04:31:18
handler_name : Core Media Video
encoder : Lavc56.1.100 libx264

Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s (default)
Metadata:

creation_time : 2014-07-16 04:31:18
handler_name : Core Media Audio
encoder : Lavc56.1.100 libvo_aacenc

Stream mapping:

Stream #0:1 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (aac (native) -> aac (libvo_aacenc))

Press [q] to stop, ? for help
frame= 139 fps=0.0 q=29.0 size= 81kB time=00:00:05.87 bitrate= 113.2kbits/frame= 299 fps=299 q=29.0 size= 238kB time=00:00:11.20 bitrate= 174.3kbits/frame= 455 fps=303 q=29.0 size= 386kB time=00:00:16.41 bitrate= 192.4kbits/frame= 612 fps=306 q=29.0 size= 606kB time=00:00:21.66 bitrate= 229.3kbits/frame= 763 fps=305 q=29.0 size= 812kB time=00:00:26.67 bitrate= 249.4kbits/frame= 922 fps=307 q=29.0 size= 1034kB time=00:00:31.98 bitrate= 264.9kbits/frame= 1069 fps=305 q=29.0 size= 1233kB time=00:00:36.87 bitrate= 274.0kbits/frame= 1219 fps=304 q=29.0 size= 1435kB time=00:00:41.88 bitrate= 280.7kbits/frame= 1367 fps=303 q=29.0 size= 1594kB time=00:00:46.85 bitrate= 278.7kbits/frame= 1518 fps=303 q=29.0 size= 1741kB time=00:00:51.89 bitrate= 274.9kbits/frame= 1671 fps=303 q=29.0 size= 1902frame= 1829 fps=304 q=29.0 size= frame= 6786 fps=308 q=-1.0 Lsize= 7208kB time=00:03:46.48 bitrate= 260.7kbits/s
video:3432kB audio:3539kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.390497%
[libx264 @ 0x7ff21200d800] frame I:36 Avg QP:24.14 size: 2998
[libx264 @ 0x7ff21200d800] frame P:4147 Avg QP:27.09 size: 717
[libx264 @ 0x7ff21200d800] frame B:2603 Avg QP:31.68 size: 166
[libx264 @ 0x7ff21200d800] consecutive B-frames: 25.1% 70.0% 3.8% 1.1%
[libx264 @ 0x7ff21200d800] mb I I16..4: 2.7% 22.6% 74.8%
[libx264 @ 0x7ff21200d800] mb P I16..4: 0.3% 1.0% 6.6% P16..4: 37.5% 26.0% 17.3% 0.0% 0.0% skip:11.4%
[libx264 @ 0x7ff21200d800] mb B I16..4: 0.1% 0.2% 1.9% B16..8: 34.7% 10.3% 3.5% direct: 3.9% skip:45.3% L0:27.3% L1:47.0% BI:25.6%
[libx264 @ 0x7ff21200d800] 8x8 transform intra:13.5% inter:45.4%
[libx264 @ 0x7ff21200d800] coded y,uvDC,uvAC intra: 57.5% 78.9% 46.8% inter: 36.0% 19.9% 6.2%
[libx264 @ 0x7ff21200d800] i16 v,h,dc,p: 34% 23% 10% 33%
[libx264 @ 0x7ff21200d800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 21% 15% 4% 4% 5% 4% 5% 4%
[libx264 @ 0x7ff21200d800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 51% 28% 7% 2% 2% 2% 2% 3% 2%
[libx264 @ 0x7ff21200d800] i8c dc,h,v,p: 44% 16% 36% 4%
[libx264 @ 0x7ff21200d800] Weighted P-Frames: Y:10.3% UV:1.9%
[libx264 @ 0x7ff21200d800] ref P L0: 66.5% 17.8% 9.9% 5.5% 0.4%
[libx264 @ 0x7ff21200d800] ref B L0: 89.8% 10.1% 0.1%
[libx264 @ 0x7ff21200d800] ref B L1: 99.4% 0.6%
[libx264 @ 0x7ff21200d800] kb/s:124.16

comment:3 Changed 4 years ago by relaxed

The output is 100x100 but playback will change the size due to the SAR/DAR not being 1:1. Use -vf scale=100:100,setsar=1:1

Although that's going to destroy the video. Maybe you're after the following?
-vf "scale=100:-2,pad=100:100:(ow-iw)/2:(oh-ih)/2"

Last edited 4 years ago by relaxed (previous) (diff)

comment:4 Changed 4 years ago by muruganandh

  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.