#9974 closed defect (fixed)

Setting "setsar" with num:denum throws error.

Reported by: steipal Owned by:
Priority: minor Component: documentation
Version: git-master Keywords: setsar regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

I would like to use "setsar" with num:denum notation where of course the colon ":" must be escaped "\:".

>ffmpeg -f lavfi -i smptebars -vf setsar='2\:1' -f null -
This works but throws an error:
[Parsed_setsar_0 @ 00000199d9e2b380] [Eval @ 0000002a3e3fe8b0] Invalid chars ':1' at the end of expression '2:1'

>ffmpeg -f lavfi -i smptebars -vf setsar=2\:1 -f null -
No error but don't work as ffmpeg ignore sar and set it to 1:1.

>ffmpeg -f lavfi -i smptebars -vf setsar=2/1 -f null -
No error and works.

The question is how to set sar with num:denum notation correctly without getting the error. Or is that just a bug/anomalie?
Using master build from 12. October 2022.

Change History (7)

comment:1 by Carl Eugen Hoyos, 19 months ago

Resolution: invalid
Status: newclosed

https://ffmpeg.org/ffmpeg-filters.html#setdar_002c-setsar
Nothing in the documentation indicates that “num:denum” is the right syntax.

comment:2 by Carl Eugen Hoyos, 19 months ago

Component: undeterminedavfilter
Keywords: setsar added
Resolution: invalid
Status: closedreopened

I may have been wrong.
Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:3 by steipal, 19 months ago

Glad you re-read the docs ;-)
It's simple to test by just running one of the examples I provided....but here it is:

>ffmpeg -f lavfi -i smptebars -vf setsar='2\:1' -t 1 -f null -

ffmpeg version N-108630-gb397f37ddc Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (Rev3, Built by MSYS2 project)
  configuration:  --disable-static --enable-shared --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --disable-autodetect --enable-amf --enable-bzlib --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-iconv --enable-lzma --enable-nvenc --enable-zlib --enable-sdl2 --enable-ffnvcodec --enable-nvdec --enable-cuda-llvm --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-libaom --disable-debug --enable-fontconfig --enable-libass --enable-libbluray --enable-libfreetype --enable-libmfx --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libshine --enable-gpl --enable-avisynth --enable-libxvid --enable-libopenmpt --enable-version3 --enable-librav1e --enable-libsrt --enable-libgsm --enable-libvmaf --enable-libsvtav1 --enable-mbedtls --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-cflags=-DLIBXML_STATIC --extra-libs=-liconv --disable-w32threads --shlibdir=/local64/bin-video
  libavutil      57. 39.101 / 57. 39.101
  libavcodec     59. 50.100 / 59. 50.100
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, lavfi, from 'smptebars':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: wrapped_avframe, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (wrapped_avframe (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
[Parsed_setsar_0 @ 000002716e8cb3c0] [Eval @ 000000bf19ffe840] Invalid chars ':1' at the end of expression '2:1'
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf59.34.101
  Stream #0:0: Video: wrapped_avframe, yuv420p(bt470bg/unknown/unknown, progressive), 320x240 [SAR 2:1 DAR 8:3], q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.50.100 wrapped_avframe
frame=    0 fps=0.0 q=-0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
frame=   25 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.96 bitrate=N/A speed= 338x    
video:12kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:4 by Elon Musk, 19 months ago

Resolution: invalid
Status: reopenedclosed

Syntax with ':' is invalid and was never working that way, and is not even mentioned that way in docs.

Correct syntax is mentioned even here and in docs.

comment:5 by Michael Koch, 19 months ago

Resolution: invalid
Status: closedreopened

In the documentation is written:

"The parameter can be a floating point number string, an expression, or a string of the form num:den, where num and den are the numerator and denominator of the aspect ratio. If the parameter is not specified, it is assumed the value "0". In case the form "num:den" is used, the : character should be escaped."

Either it's a bug in the code, or the documentation is wrong.

In the examples, "/" is used instead of ":"

comment:6 by Carl Eugen Hoyos, 19 months ago

Component: avfilterdocumentation
Keywords: regression added
Priority: normalminor
Reproduced by developer: set
Version: unspecifiedgit-master

The documentation bug is a regression since 0ed61546c4594480b7c09a0c79da24d78968fbf0

comment:7 by Stefano Sabatini, 13 months ago

Resolution: fixed
Status: reopenedclosed

Should be fixed in 47c56ff5540fd5e4, thanks for the report!

Note: See TracTickets for help on using tickets.