Ffmpeg | Invalid data found when processing input

Hello

I'm unable to concatenate 'webm' files due to some "Invalid data found when processing input"

Script to concat the files

cat webmconvert2mp4.sh 
#!/bin/bash
# desc: convert .webm to .mp4

# Puts webm files into a file 'plist.txt' to be fed into ffmpeg
find . -name '*.webm' | sort | cut -d/ -f2 | xargs -I{} echo "file '{}'" > plist.txt

# Concat the files 
# ffmpeg -v error -f concat -reset_timestamps 1 -safe 0 -i plist.txt -c copy 1080.webm
ffmpeg -f concat -safe 0 -i plist.txt -c copy output.mp4

When I run the script

./webmconvert2mp4.sh 
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
[concat @ 0x55a814b82140] Impossible to open '2021-01-02-170830.webm'
plist.txt: Invalid data found when processing input

Any suggestions ?

Yes, provide the full content of the file above so we can see it :slight_smile:

Hi @samthewildone,

what does

f=2021-01-02-170830.webm; file $f; ffmpeg -i $f

give?

@Neo Here's the contents of the file plist.txt :

cat plist.txt 
file '2021-01-02-170830.webm'
file '2021-01-02-173824.webm'
file '2021-01-02-180728.webm'
file '2021-01-02-190421.webm'
file '2021-01-05-205058.webm'
file '2021-01-05-210539.webm'

@bendingrodriguez

f=2021-01-02-170830.webm; file $f; ffmpeg -i $f
2021-01-02-170830.webm: empty
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
2021-01-02-170830.webm: Invalid data found when processing input

@samthewildone

well here is the problem :slight_smile: You have to check beforehand which input files are valid.

@bendingrodriguez

That one slipped me. Removed it and re-ran the script.

./webmconvert2mp4.sh 
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, concat, from 'plist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc
    Metadata:
      title           : Video
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp
    Metadata:
      title           : Audio
[mp4 @ 0x55dba707da40] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

@samthewildone

try to add -vcodec libvpx to the ffmpeg command (but before the output.mp4).

@bendingrodriguez

I was able to concat the .webm files from removing the empty file (wasn't aware at the time).

At this point I can just convert the .webm concatenated file into mp4 with a simple -i and output.

The command below I don't really need anymore but, still confused as to why it won't fully execute.

$ grep "vcodec libvpx" webmconvert2mp4.sh 
ffmpeg -f concat -safe 0 -i plist.txt -c copy -vcodec libvpx output.mp4

$ ./webmconvert2mp4.sh 
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, concat, from 'plist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc
    Metadata:
      title           : Video
      DURATION        : 02:28:02.695000000
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp
    Metadata:
      title           : Audio
      DURATION        : 02:28:02.926000000
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v libvpx' will be used.
File 'output.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> vp8 (libvpx))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libvpx @ 0x55b039ad9c40] v1.8.2
[libvpx @ 0x55b039ad9c40] Neither bitrate nor constrained quality specified, using default CRF of 32 and bitrate of 256kbit/sec
[mp4 @ 0x55b039ae7780] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!

@samthewildone I didn't know that mp4 normally doesn't support vp8. This should work:

ffmpeg -f concat -safe 0 -i plist.txt -c copy -strict experimental output.mp4

@bendingrodriguez

:rofl: :joy:

grep -i experi webmconvert2mp4.sh 
ffmpeg -f concat -safe 0 -i plist.txt -c copy -strict experimental output.mp4

$ ./webmconvert2mp4.sh 
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, concat, from 'plist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc
    Metadata:
      title           : Video
      DURATION        : 02:28:02.695000000
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp
    Metadata:
      title           : Audio
      DURATION        : 02:28:02.926000000
[mp4 @ 0x56414133eb00] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

@samthewildone really strange :face_with_raised_eyebrow: I had tested it with 2 webm files and it worked. Could you please submit the output of

find -name '*webm' | xargs -n1 -I{} ffmpeg -i {} 2>&1 | grep -E 'Input|Stream.*Video'

@bendingrodriguez

find -name '*webm' | xargs -n1 -I{} ffmpeg -i {} 2>&1 | grep -E 'Input|Stream.*Video'
Input #0, matroska,webm, from './2021-01-05-210539.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from './2021-01-02-173824.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from './2021-01-02-180728.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from './2021-01-05-205058.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from './1080.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)
Input #0, matroska,webm, from './2021-01-02-190421.webm':
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc (default)

@samthewildone ok thanks. Next try:

ffmpeg -f concat -safe 0 -i plist.txt -vcodec libvpx-vp9 output.mp4

@bendingrodriguez

Thank you!

I was successfully able to concatenate .webm files into a single .avi output file.

ffmpeg -f concat -safe 0 -i plist.txt -vcodec libvpx-vp9 output.mp4
ffmpeg version 4.3.1-4ubuntu1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Input #0, concat, from 'plist.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: vp8, yuv420p(tv, bt709, progressive), 1280x720, SAR 1:1 DAR 16:9, 10 fps, 10 tbr, 1k tbn, 1k tbc
    Metadata:
      title           : Video
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp
    Metadata:
      title           : Audio
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> vp9 (libvpx-vp9))
  Stream #0:1 -> #0:1 (vorbis (native) -> aac (native))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55c9aeaf8d40] v1.8.2
[libvpx-vp9 @ 0x55c9aeaf8d40] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0(eng): Video: vp9 (libvpx-vp9) (vp09 / 0x39307076), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 10 fps, 10240 tbn, 10 tbc
    Metadata:
      title           : Video
      encoder         : Lavc58.91.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s
    Metadata:
      title           : Audio
      encoder         : Lavc58.91.100 aac
frame=88827 fps= 14 q=0.0 Lsize=  309164kB time=02:28:02.93 bitrate= 285.1kbits/s dup=75 drop=1 speed=1.38x    
video:230748kB audio:75238kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.038550%
[aac @ 0x55c9aeb37100] Qavg: 120.496