Opened 3 years ago

Closed 3 years ago

#9277 closed defect (invalid)

ffmpeg concat cannot mix pipe and file input

Reported by: Trevor Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: concat
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Between 4.2.2 and 4.3.2 you can no longer use both pipe and file input for concat (file input for the images, and pipe for the list of files and durations).

How to reproduce:

% ffmpeg "-v" "error" "-f" "concat" "-protocol_whitelist" "file,pipe" "-i" "-" "-pix_fmt" "yuv420p" "-vcodec" "libx264" "-vf" "scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30" "-crf" "28" "output.mp4"

ffmpeg version N-57631-gebedd26eef-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil      57.  0.100 / 57.  0.100
libavcodec     59.  1.100 / 59.  1.100
libavformat    59.  2.101 / 59.  2.101
libavdevice    59.  0.100 / 59.  0.100
libavfilter     8.  0.101 /  8.  0.101
libswscale      6.  0.100 /  6.  0.100
libswresample   4.  0.100 /  4.  0.100
libpostproc    56.  0.100 / 56.  0.100

The content piped to stdin is:

ffconcat version 1.0
file S2bioaerIaLTABx8PcEU0w.1622751258.259273.jpg
duration 0.19855499267578125
file S2bioaerIaLTABx8PcEU0w.1622751258.468068.jpg
duration 0.027949094772338867
file S2bioaerIaLTABx8PcEU0w.1622751258.496017.jpg
duration 0.47649693489074707
file S2bioaerIaLTABx8PcEU0w.1622751258.972514.jpg
duration 0.13218116760253906
file S2bioaerIaLTABx8PcEU0w.1622751259.104695.jpg
duration 0.05051994323730469
file S2bioaerIaLTABx8PcEU0w.1622751259.155215.jpg
duration 0.06785297393798828
file S2bioaerIaLTABx8PcEU0w.1622751259.223068.jpg
duration 0.0591120719909668
file S2bioaerIaLTABx8PcEU0w.1622751259.28218.jpg
duration 0.07902193069458008
file S2bioaerIaLTABx8PcEU0w.1622751259.361202.jpg
duration 0.48149991035461426
file S2bioaerIaLTABx8PcEU0w.1622751259.842702.jpg
duration 0.5122950077056885
file S2bioaerIaLTABx8PcEU0w.1622751260.354997.jpg
duration 0.11454916000366211
file S2bioaerIaLTABx8PcEU0w.1622751260.469546.jpg
duration 2.9862449169158936
file S2bioaerIaLTABx8PcEU0w.1622751263.455791.jpg
duration 0.09715390205383301
file S2bioaerIaLTABx8PcEU0w.1622751263.552945.jpg
duration 0.1610550880432129
file S2bioaerIaLTABx8PcEU0w.1622751263.552945.jpg

With an error:

[concat @ 0x6323e00] Impossible to open 'pipe:S2bioaerIaLTABx8PcEU0w.1622751258.259273.jpg'
pipe:: Invalid data found when processing input

I can fix it by changing the stdin to be a file rather than pipe and change the command line to -i input.txt rather than -i - and remove pipe from the protocol_whitelist. But this worked from ffmpeg version 3.3 through 4.2.2.

Change History (6)

comment:1 by Cigaes, 3 years ago

This is the expected behavior: since the concat file is in the file: protocol, all the concatenated files are assumed to be in the file: protocol too, unless specified otherwise.

comment:2 by Trevor, 3 years ago

All the files are in the file protocol. It's the list of files and durations that were on stdin before. The error implies that because I was piping in the list of files via stdin, it's trying to pull the actual files in via pipe at least based on the error message.

Impossible to open 'pipe:S2bioaerIaLTABx8PcEU0w.1622751258.259273.jpg'

But the actual list of files was:

ffconcat version 1.0
file S2bioaerIaLTABx8PcEU0w.1622751258.259273.jpg
duration 0.19855499267578125
file S2bioaerIaLTABx8PcEU0w.1622751258.468068.jpg
duration 0.027949094772338867
...

That seems to imply that even though file was specified, it's trying to use pipe to read the file instead. This used to work from version 3.3 - 4.2 and broke in 4.3. It seems like you use -i - on the command line it expects the files all to be piped in as well.

comment:3 by Cigaes, 3 years ago

You need to understand that the file names / paths given in the concat file are relative to the position of the concat file. That is necessary so that ffmpeg -i /tmp/file.concat finds its files, not depending on the current working directory. This, of course, applies to all the components of the URL or pseudo-URL.

Since last release, the handling of relative URLs have been fixed, to make it compatible with the official recommendations.

Then, you need to notice that you are confusing file, the keyword of the concat script, and file:, the prefix of a pseudo-URL that indicates the protocol to use.

You have put bare file names in your concat script, therefore the files are supposed to reside in the same directory (and of course protocol) as the script. Which, of course, is not possible for pipe:, but still applies.

in reply to:  3 comment:4 by Trevor, 3 years ago

Replying to Nicolas George:

You need to understand that the file names / paths given in the concat file are relative to the position of the concat file. That is necessary so that ffmpeg -i /tmp/file.concat finds its files, not depending on the current working directory. This, of course, applies to all the components of the URL or pseudo-URL.

Since last release, the handling of relative URLs have been fixed, to make it compatible with the official recommendations.

Then, you need to notice that you are confusing file, the keyword of the concat script, and file:, the prefix of a pseudo-URL that indicates the protocol to use.

You have put bare file names in your concat script, therefore the files are supposed to reside in the same directory (and of course protocol) as the script. Which, of course, is not possible for pipe:, but still applies.

I guess I still don't understand what changed. I tried changing them to absolute paths at one point (and adding -safe 0 to the concat) but still got the same error.

[concat @ 0x582dd80] Impossible to open 'pipe:/tmp/ytaY1m7t6-lJ-QHitE17CA.1622817686.388084.jpg'
pipe:: Invalid data found when processing input

Do I need to change the piped input to specify both the concat file and the protocol file: in the concat code? like file file:S2bioaerIaLTABx8PcEU0w.1622751258.259273.jpg or is it just not possible anymore to mix pipe (instructions to the concat) and file (actual input files)

comment:5 by Cigaes, 3 years ago

Yes, you need to specify the protocol since it is not the same.

comment:6 by Trevor, 3 years ago

Resolution: invalid
Status: newclosed

Thanks. And it looks like that does work in 4.1 as well. And thanks for your time explaining what changed.

Note: See TracTickets for help on using tickets.