#8520 closed defect (invalid)
wrong examples in streamselect documentation
Reported by: | Michael Koch | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | documentation |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
In the documentation are two wrong examples for streamselect and astreamselect. It's impossible to write sendcmd directly before streamselect (separated by a comma), because streamselect requires at least two inputs and sendcmd accepts only one input.
Change History (19)
follow-up: 6 comment:1 by , 5 years ago
comment:2 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:4 by , 5 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
When I try it, it doesn't work:
C:\Users\mKoch\Desktop>c:\ffmpeg\ffmpeg -f lavfi -i color=red:size=vga:duration=
6 -f lavfi -i color=green:size=vga:duration=6 -lavfi [0][1]sendcmd='3.0 streamse
lect map 1',streamselect=inputs=2:map=0 -y out.mp4
ffmpeg version git-2020-02-09-5ad1c1a Copyright (c) 2000-2020 the FFmpeg develop
ers
built with gcc 9.2.1 (GCC) 20200122
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libb
luray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcode
c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 -
-enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 39.100 / 56. 39.100
libavcodec 58. 68.100 / 58. 68.100
libavformat 58. 38.100 / 58. 38.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 75.100 / 7. 75.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, lavfi, from 'color=red:size=vga:duration=6':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1
DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Input #1, lavfi, from 'color=green:size=vga:duration=6':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1
DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[AVFilterGraph @ 0000000000505740] Too many inputs specified for the "sendcmd" f
ilter.
Error initializing complex filters.
Invalid argument
comment:5 by , 5 years ago
Resolution: | → invalid |
---|---|
Status: | reopened → closed |
It works as set, You should not add extra pads before sendcmd.
comment:6 by , 5 years ago
Replying to mkoch:
Feature request: Modify the sendcmd filter so that it accepts any number of inputs and can be placed anywhere in the filter chain.
Please try to think about what the sendcmd filter does to its frames, and realize that it having several inputs or outputs makes no sense: what would it do with the two different frames?
If you think you need this, you using it wrong. I suggest you find a whiteboard and make a picture.
follow-up: 9 comment:7 by , 5 years ago
That means the example works only if the inputs are defined in the same order as they are required by the streamselect filter. Shouldn't it also work if another order is required, for example [2][5]?
In that case the sendcmd filter must be written at another place in the filter chain, where only one input exists. That makes the filter chain hard to understand.
It would be much better readable if sendcmd could be written directly before the target command.
If sendcmd gets more than one input it should simply pass them all to the next filter.
follow-up: 10 comment:8 by , 5 years ago
ffmpeg -i red-leaf-tips.avi -i windy-sunset.avi -lavfi streamselect@my_special_filter=inputs=2:map=0,sendcmd='5.0 streamselect@my_special_filter map 1' -f null -
This is also showed in documentation of sendcmd filter. Simply putting sendcmd as last filter before output will work, it will broadcast to all filters with exact same name @my_special_filter.
comment:9 by , 5 years ago
Replying to mkoch:
If sendcmd gets more than one input it should simply pass them all to the next filter.
Sorry, again, that makes no sense. The inputs could have different formats, or even one be audio. I urge you: make a picture, hopefully, you'll realize your mistake.
comment:10 by , 5 years ago
Replying to richardpl:
ffmpeg -i red-leaf-tips.avi -i windy-sunset.avi -lavfi streamselect@my_special_filter=inputs=2:map=0,sendcmd='5.0 streamselect@my_special_filter map 1' -f null -
This is also showed in documentation of sendcmd filter. Simply putting sendcmd as last filter before output will work, it will broadcast to all filters with exact same name @my_special_filter.
To which documentation do you refer? In ffmpeg-all.html I find no example for placing sendcmd after the target command. I can't get your example working.
C:\Users\mKoch\Desktop>c:\ffmpeg\ffmpeg -f lavfi -i color=red:size=vga:duration=
6 -f lavfi -i color=green:size=vga:duration=6 -lavfi streamselect@my=inputs=2:ma
p=0,sendcmd='5.0 streamselect@my map 1' -y out.mp4
ffmpeg version git-2020-02-09-5ad1c1a Copyright (c) 2000-2020 the FFmpeg develop
ers
built with gcc 9.2.1 (GCC) 20200122
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libb
luray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcode
c --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 -
-enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 39.100 / 56. 39.100
libavcodec 58. 68.100 / 58. 68.100
libavformat 58. 38.100 / 58. 38.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 75.100 / 7. 75.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Input #0, lavfi, from 'color=red:size=vga:duration=6':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1
DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Input #1, lavfi, from 'color=green:size=vga:duration=6':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #1:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 640x480 [SAR 1:1
DAR 4:3], 25 tbr, 25 tbn, 25 tbc
[NULL @ 0000000003203040] Unable to find a suitable output format for 'streamsel
ect@my'
streamselect@my: Invalid argument
follow-up: 13 comment:12 by , 5 years ago
On Windows, use double quotes to enclose the sendcmd arg, or enclose the entire filtergraph in double quotes and then continue to enclose sendcmd arg in single quotes.
comment:13 by , 5 years ago
Replying to Gyan:
On Windows, use double quotes to enclose the sendcmd arg, or enclose the entire filtergraph in double quotes and then continue to enclose sendcmd arg in single quotes.
I've tested it and both of your suggestions work fine. But placing sendcmd at the end of the filter chain has one drawback that should be noted: The changes become effective with one frame delay.
follow-ups: 15 18 comment:14 by , 5 years ago
That is a limitation of implementing "metafilters" as filters. Their execution is handled by the same scheduler as the one which governs the order of regular filter execution.
You could feed one of the inputs to a null filter followed by sendcmd which in turn relays output to streamselect.
comment:15 by , 5 years ago
Replying to Gyan:
That is a limitation of implementing "metafilters" as filters. Their execution is handled by the same scheduler as the one which governs the order of regular filter execution.
You could feed one of the inputs to a null filter followed by sendcmd which in turn relays output to streamselect.
What are you replying to?
comment:17 by , 5 years ago
Replying to Gyan:
The comment right above mine.
Ok. But it was for the suggestion of putting the filter after, which was a terrible one anyway.
comment:18 by , 5 years ago
Replying to Gyan:
That is a limitation of implementing "metafilters" as filters. Their execution is handled by the same scheduler as the one which governs the order of regular filter execution.
You could feed one of the inputs to a null filter followed by sendcmd which in turn relays output to streamselect.
Yes, I know that I can place sendcmd in the filter chain at the beginning, using one of the two inputs. The null filter seems unnecessary, it also works stand-alone:
[0]sendcmd='3.0 streamselect@my map 1'[a],...
But this trick does also have a pitfall and I fell into it (Murphy's law...):
If the two inputs have different lengths, it's important to place sendcmd at the longer input. In my case the second input was a few seconds shorter (I didn't notice that at first), and I placed sendcmd after the second input: [1]otherfilter,sendcmd=...[a];
This didn't work as expected, because when the second input had ended after 8s, the sendcmd filter did still get 8s as time, instead of 8s-10s, and so sendcmd did use the wrong time for changing the options of other filters.
All of these problems could be avoided, if sendcmd could be placed in the complex filter chain directly before the target filter. That means it must accept any number of inputs and just pass them to the next filter, which needs these inputs.
The examples in the documentation do only work if you don't write [0][1] before them. They fail in the more general case when the inputs are in a different order.
Feature request: Modify the sendcmd filter so that it accepts any number of inputs and can be placed anywhere in the filter chain.