Opened 21 months ago
Last modified 19 months ago
#9833 new defect
print expression ignores sign
| Reported by: | Player701 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avutil |
| Version: | git-master | Keywords: | expression |
| Cc: | Player701 | Blocked By: | |
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug:
It appears that when a print expression is encountered, the sign before it is ignored. For example, "-print(1)" actually evaluates to 1 and not -1. However, "-1*print(1)" correctly evaluates to -1.
How to reproduce:
% ffmpeg -loglevel repeat+info -f lavfi -i nullsrc -c:v copy -bsf:v setts=ts='print(-print(1),16);TS' -vframes 1 -f null -
ffmpeg version 2022-07-14-git-882aac99d2-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (Rev2, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 57. 29.100 / 57. 29.100
libavcodec 59. 38.100 / 59. 38.100
libavformat 59. 28.100 / 59. 28.100
libavdevice 59. 8.100 / 59. 8.100
libavfilter 8. 45.100 / 8. 45.100
libswscale 6. 8.100 / 6. 8.100
libswresample 4. 8.100 / 4. 8.100
libpostproc 56. 7.100 / 56. 7.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'repeat+99'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'nullsrc'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-bsf:v' ... matched as option 'bsf' (A comma-separated list of bitstream filters) with argument 'setts=ts='print(-print(1),16);TS''.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Reading option '-' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url nullsrc.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: nullsrc.
detected 16 logical cores
[Parsed_nullsrc_0 @ 00000174f5dd7ac0] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[AVFilterGraph @ 00000174f7904040] query_formats: 2 queried, 1 merged, 0 already done, 0 delayed
[lavfi @ 00000174f7903840] All info found
[lavfi @ 00000174f7903840] stream 0: start_time: 0 duration: NOPTS
[lavfi @ 00000174f7903840] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=0 kb/s
Input #0, lavfi, from 'nullsrc':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0, 1, 1/25: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 tbr, 25 tbn
Successfully opened the file.
Parsing a group of options: output url -.
Applying option c:v (codec name) with argument copy.
Applying option bsf:v (A comma-separated list of bitstream filters) with argument setts=ts='print(-print(1),16);TS'.
Applying option vframes (set the number of video frames to output) with argument 1.
Applying option f (force format) with argument null.
Successfully parsed a group of options.
Opening an output file: -.
[setts_bsf @ 00000174f7951000] Setting 'ts' to value 'print(-print(1),16);TS'
Successfully opened the file.
Output #0, null, to 'pipe:':
Metadata:
encoder : Lavf59.28.100
Stream #0:0, 0, 1/25: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 320x240 (0x0) [SAR 1:1 DAR 4:3], 0/1, q=2-31, 25 tbr, 25 tbn
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
1.000000
1.000000
No more output streams to write to, finishing.
1.000000
1.000000
frame= 1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=16.8x
video:112kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (nullsrc):
Input stream #0:0 (video): 2 packets read (230400 bytes);
Total: 2 packets (230400 bytes) demuxed
Output file #0 (pipe:):
Output stream #0:0 (video): 1 packets muxed (115200 bytes);
Total: 1 packets (115200 bytes) muxed
0 frames successfully decoded, 0 decoding errors
Note that "1.000000" is printed two times per frame, while it should be first "1.000000" and then "-1.000000". Changing the first part to "print(-1*print(1),16)" produces correct results.
Change History (2)
comment:1 by , 21 months ago
comment:2 by , 19 months ago
| Component: | undetermined → avutil |
|---|---|
| Keywords: | expression added; expressions removed |
| Reproduced by developer: | set |
| Version: | unspecified → git-master |
Note:
See TracTickets
for help on using tickets.



I have reproduced this bug and also saw that
print(1-print(1),16)
evaluates to 2 and not 0.