Ticket #706 (closed defect: fixed)
scale filter doesn't understand »out_h«
| Reported by: | taeuber | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avfilter |
| Version: | git-master | Keywords: | scale |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | yes |
Description
ffmpeg [...] -vf [...],scale=ow:oh/2,[...]
but:
Error when evaluating the expression 'oh/2'
Error opening filters!
version:
ffmpeg version N-35433-g2f8b6e9, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 4 2011 21:30:23 with gcc 4.5.2
configuration: --enable-gpl --enable-pthreads --enable-libx264 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-nonfree --enable-shared --enable-pic --enable-libxvid --enable-libdirac --enable-libspeex --enable-librtmp --enable-libopenjpeg --disable-vdpau
Change History
comment:2 follow-up: ↓ 3 Changed 18 months ago by taeuber
command line:
nice -n 9 ionice -c3 ffmpeg -i 2a.mpeg -an -sn -threads 0 -vf crop=in_w-0-16:in_h-6-2:0:6,scale=ow:oh/2,setsar=32:15 -c:v libx264 -x264opts crf=23:deblock:partitions=all:me=tesa:merange=16:subme=9:min-keyint=25:keyint=250:scenecut=40:b-adapt=2:qcomp=.6:qpmin=10:qpmax=51:qpstep=4:bframes=16:ref=3:direct=auto:trellis=2:weightp=2:b-pyramid=normal -f matroska -y test.mk
console output:
ffmpeg version N-35433-g2f8b6e9, Copyright (c) 2000-2011 the FFmpeg developers
built on Dec 4 2011 21:30:23 with gcc 4.5.2
configuration: --enable-gpl --enable-pthreads --enable-libx264 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-nonfree --enable-shared --enable-pic --enable-libxvid --enable-libdirac --enable-libspeex --enable-librtmp --enable-libopenjpeg --disable-vdpau
libavutil 51. 30. 0 / 51. 30. 0
libavcodec 53. 40. 0 / 53. 40. 0
libavformat 53. 24. 0 / 53. 24. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 51. 0 / 2. 51. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mpeg @ 0x1fa99a0] max_analyze_duration 5000000 reached at 5000000
Input #0, mpeg, from '2a.mpeg':
Duration: 00:08:05.02, start: 0.360000, bitrate: 7087 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 8000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, s16, 192 kb/s
[buffer @ 0x1fb03c0] w:720 h:576 pixfmt:yuv420p tb:1/1000000 sar:16/15 sws_param:
[setsar @ 0x1fa5b80] a:32/15
[crop @ 0x1fa48e0] w:720 h:576 -> w:704 h:568
Error when evaluating the expression 'oh/2'
Error opening filters!
Thanks!
comment:3 in reply to: ↑ 2 Changed 18 months ago by saste
- Analyzed by developer set
- Reproduced by developer set
Replying to taeuber:
command line:
nice -n 9 ionice -c3 ffmpeg -i 2a.mpeg -an -sn -threads 0 -vf crop=in_w-0-16:in_h-6-2:0:6,scale=ow:oh/2,setsar=32:15 -c:v libx264 -x264opts
[...]
scale=ow:oh/2
you can reference "ow" and "oh" only when they have been defined, both "oh" and "ow" have not been defined yet here (you can't define something by referencing itself, at least not in this context).
Error opening filters!
Error when evaluating the expression 'oh/2'
[...]
Maybe this error message should be made more explicit...
comment:4 follow-up: ↓ 5 Changed 18 months ago by taeuber
What/who does »ow« or »oh« define?
Other filters?
Are »ih« and »iw« changed by the scale filter?
I thought before any filters apply that "ow=iw" and "oh=ih". And the crop filter for instance changes the "oh" and "ow" automatically by subtracting the cropped lines/rows.
Wouldn't this make sense?
Thanks
comment:5 in reply to: ↑ 4 Changed 18 months ago by saste
- Status changed from new to closed
- Resolution set to fixed
Replying to taeuber:
What/who does »ow« or »oh« define?
oh and ow are useful if you want to reference ow/oh in the other expressions, for example to get a square output:
scale=2*iw:ow
in this case you define ow in the first expression, and reference it in the second expression, in a similar way you can do:
scale=oh:2*ih
what you can do is to self-reference ow/oh in the corresponding expression.
Other filters?
Are »ih« and »iw« changed by the scale filter?
No they are the input width and height, which are fixed.
I thought before any filters apply that "ow=iw" and "oh=ih". And the crop filter for instance changes the "oh" and "ow" automatically by subtracting the cropped lines/rows.
Wouldn't this make sense?
That's possible, but I think the current behavior is not completely misguided, expressing something like
x=x is inherently confusing, better to just say explicitely scale=iw:ih/2.
Thanks
I clarified the error message in:
commit 3af5ddb24b91cfa6e2392b85ef1beafda7e85225
Author: Stefano Sabatini <stefasab@gmail.com>
Date: Sun Dec 4 23:33:40 2011 +0100
vf_scale: give a clue in case of invalid expression self-reference
Address trac ticket #706.
changing status to closed, please provide a patch or suggest if you think this behavior can be clarified/improved.



Please provide a command line and complete, uncut console output.