Opened 12 months ago
Closed 12 months ago
#10350 closed defect (fixed)
Movie filter initializes in a broken state when called with loop=0
Reported by: | Dennis E. Mungai | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | libavfilter, movie |
Cc: | Dennis E. Mungai | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
As stated: The movie
filter will not output any packets when started with loop=0
argument.
How to reproduce:
Here is a simple sample command demonstrating the issue:
ffmpeg -nostdin -an -sn -y \ -i 'x264-test.ts' \ -filter_complex \ "[0:v]drawtext=text=\\ :expansion=strftime:fontcolor=white:fontsize=0:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuMathTeXGyre.ttf:x=w/2-tw/2:y=h/2-th/2[video];movie=/home/brainiarc7/Desktop/src/logo/test1_%d.png:loop=0[logo];\ [video][logo]overlay=x=0:y=0:alpha=0:format=yuv420:repeatlast=1[overlay];\ [overlay]scale=640:360[v0] " \ -map '[v0]' -b:v 1250k -c:v libx264 -pix_fmt yuv420p \ -sc_threshold 0 -keyint_min 50 -bf 0 -g 50 -minrate 1250k \ -maxrate 1250k -bufsize 1250k -preset medium -r 25 \ -f mpegts \ "ovtest.ts"
Output:
The process simply "hangs" and no output is generated, regardless of the muxer(s) used:
Input #0, mpegts, from 'x264-test.ts': Duration: 00:04:56.84, start: 1.455400, bitrate: 5281 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 29.97 tbr, 90k tbn Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 163 kb/s Stream mapping: Stream #0:0 (h264) -> drawtext:default scale:default -> Stream #0:0 (libx264) [libx264 @ 0x555ddde1ce80] using SAR=1/1 [libx264 @ 0x555ddde1ce80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x555ddde1ce80] profile High, level 3.0, 4:2:0, 8-bit Output #0, mpegts, to 'ovtest.ts': Metadata: encoder : Lavf60.4.100 Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 1250 kb/s, 25 fps, 90k tbn Metadata: encoder : Lavc60.6.100 libx264 Side data: cpb: bitrate max/min/avg: 1250000/0/1250000 buffer size: 1250000 vbv_delay: N/A frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
The ffmpeg process must then be killed manually, and will remain hung indefinitely unless killed.
When the loop=0
argument to the movie filter is omitted, the command runs *but* the dependent filter chain right after with overlay receive no input, and thus no logo overlay is inserted:
ffmpeg -nostdin -an -sn -y \ -i 'x264-test.ts' \ -filter_complex \ "[0:v]drawtext=text=\\ :expansion=strftime:fontcolor=white:fontsize=0:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuMathTeXGyre.ttf:x=w/2-tw/2:y=h/2-th/2[video];movie=/home/brainiarc7/Desktop/src/logo/test1_%d.png[logo];\ [video][logo]overlay=x=0:y=0:alpha=0:format=yuv420:repeatlast=1[overlay];\ [overlay]scale=640:360[v0] " \ -map '[v0]' -b:v 1250k -c:v libx264 -pix_fmt yuv420p \ -sc_threshold 0 -keyint_min 50 -bf 0 -g 50 -minrate 1250k \ -maxrate 1250k -bufsize 1250k -preset medium -r 25 \ -f mpegts \ "ovtest.ts"
Output:
ffmpeg version N-110069-gd5a3bdf434 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04) configuration: --pkg-config-flags=--static --enable-static --disable-shared --prefix=/home/brainiarc7 --bindir=/home/brainiarc7/bin --enable-cuda-nvcc --enable-cuvid --enable-libnpp --extra-cflags='-I/home/brainiarc7/ffmpeg_build/include -I/usr/local/cuda/include/ -march=native' --extra-cxxflags='-march=native' --extra-ldflags='-L/home/brainiarc7/ffmpeg_build/lib -L/usr/local/cuda/lib64/' --enable-nvenc --enable-libass --enable-libfreetype --disable-stripping --enable-gpl --cpu=native --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-openssl --enable-librtmp --enable-libzvbi --enable-version3 --enable-opencl --enable-pic --enable-librav1e --enable-libshaderc --disable-libglslang --enable-vulkan --enable-vulkan-encode --enable-libsrt --enable-libsvtav1 --enable-libvpx --enable-libplacebo --enable-librav1e --nvccflags='-arch=native' --extra-libs='-lz -lm -ldl' --enable-nonfree libavutil 58. 3.100 / 58. 3.100 libavcodec 60. 6.100 / 60. 6.100 libavformat 60. 4.100 / 60. 4.100 libavdevice 60. 2.100 / 60. 2.100 libavfilter 9. 4.100 / 9. 4.100 libswscale 7. 2.100 / 7. 2.100 libswresample 4. 11.100 / 4. 11.100 libpostproc 57. 2.100 / 57. 2.100 Input #0, mpegts, from 'x264-test.ts': Duration: 00:04:56.84, start: 1.455400, bitrate: 5281 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 29.97 tbr, 90k tbn Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 163 kb/s Stream mapping: Stream #0:0 (h264) -> drawtext:default scale:default -> Stream #0:0 (libx264) [libx264 @ 0x55e2f52772c0] using SAR=1/1 [libx264 @ 0x55e2f52772c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0x55e2f52772c0] profile High, level 3.0, 4:2:0, 8-bit Output #0, mpegts, to 'ovtest.ts': Metadata: encoder : Lavf60.4.100 Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 1250 kb/s, 25 fps, 90k tbn Metadata: encoder : Lavc60.6.100 libx264 Side data: cpb: bitrate max/min/avg: 1250000/0/1250000 buffer size: 1250000 vbv_delay: N/A [Parsed_movie_1 @ 0x55e2f518c4c0] EOF timestamp not reliable.77 bitrate= -0.0kbits/s speed=N/A frame= 7422 fps=274 q=-1.0 Lsize= 47602kB time=00:04:56.84 bitrate=1313.7kbits/s dup=0 drop=1474 speed= 11x video:44750kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 6.373472% [libx264 @ 0x55e2f52772c0] frame I:149 Avg QP:25.16 size: 23724 [libx264 @ 0x55e2f52772c0] frame P:7273 Avg QP:28.69 size: 5815 [libx264 @ 0x55e2f52772c0] mb I I16..4: 7.6% 56.8% 35.6% [libx264 @ 0x55e2f52772c0] mb P I16..4: 3.0% 8.2% 1.7% P16..4: 45.0% 17.0% 9.8% 0.0% 0.0% skip:15.2% [libx264 @ 0x55e2f52772c0] 8x8 transform intra:62.5% inter:64.2% [libx264 @ 0x55e2f52772c0] coded y,uvDC,uvAC intra: 49.9% 78.3% 45.4% inter: 28.8% 51.2% 12.5% [libx264 @ 0x55e2f52772c0] i16 v,h,dc,p: 35% 26% 14% 24% [libx264 @ 0x55e2f52772c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 13% 25% 6% 7% 8% 6% 7% 6% [libx264 @ 0x55e2f52772c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 15% 19% 6% 7% 8% 6% 6% 5% [libx264 @ 0x55e2f52772c0] i8c dc,h,v,p: 52% 17% 22% 9% [libx264 @ 0x55e2f52772c0] Weighted P-Frames: Y:12.3% UV:8.9% [libx264 @ 0x55e2f52772c0] ref P L0: 68.8% 17.5% 9.6% 3.7% 0.4% [libx264 @ 0x55e2f52772c0] kb/s:1234.81
The same command works on a very old ffmpeg version, ie 4.3.2.
Anything newer than this is a show-stopper.
Change History (3)
comment:1 by , 12 months ago
comment:2 by , 12 months ago
You are indeed correct. I tested this shortly after filing the ticket and it worked:
ffmpeg -nostdin -an -sn -y \ -i 'x264-test.ts' \ -filter_complex \ "[0:v]drawtext=text=\\ :expansion=strftime:fontcolor=white:fontsize=0:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuMathTeXGyre.ttf:x=w/2-tw/2:y=h/2-th/2[video];movie=/home/brainiarc7/Desktop/src/logo/test1_%d.png,loop=loop=-1:size=1:start=0[logo];\ [video][logo]overlay=x=0:y=0:alpha=0:format=yuv420:repeatlast=1[overlay];\ [overlay]scale=640:360[v0] " \ -map '[v0]' -b:v 1250k -c:v libx264 -pix_fmt yuv420p \ -sc_threshold 0 -keyint_min 50 -bf 0 -g 50 -minrate 1250k \ -maxrate 1250k -bufsize 1250k -preset medium -r 25 \ -f mpegts \ "ovtest.ts"
I'll close the ticket as invalid. Wish this was better documented though.
comment:3 by , 12 months ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Closed as fixed.
Notes: For single-source images in movie sources, the loop
filter is what's needed instead of movie filter's looping mechanism.
A simple invocation loop=loop=-1:size=1:start=0
produces the best results.
That is because output timestamps from movie are always 0 in that case.
Better use loop filter for single input images, than you make sure that decoding is done only once.