Invalid data found when processing input. No start code is found - ffmpeg

I am trying to concat video from many files.
But sometimes I receive an error: "Invalid data found when processing input".
So, I am trying to iterate over files with ffprobe and find invalid files.
Here is the error.
ffprobe started on 2020-06-28 at 16:06:39
Report written to "ffreport.log"
Log level: 32
Command line:
"f:\\prog\\ffmpeg\\bin\\ffprobe.exe" -i Rec496_20200423123337_A_1.avi
ffprobe version git-2020-03-23-ba698a2 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20200122
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --e
nable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrn
b --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-lib
soxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --e
nable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-l
ibvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-
libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable
-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.101 / 56. 42.101
libavcodec 58. 76.100 / 58. 76.100
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.100 / 7. 77.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[avi # 000002510398e1c0] non-interleaved AVI
[h264 # 00000251039a0480] missing picture in access unit with size 256
[extract_extradata # 0000025103996740] No start code is found.
Rec496_20200423123337_A_1.avi: Invalid data found when processing input
Questions:
How can this be fixed, so I don't need to iterate with ffprobe and just use concat (command line: f:\prog\ffmpeg\bin\ffmpeg.exe -f concat -safe 0 -i mylist.txt -c copy output-xx.avi)?
If not, how can I receive an error in my .bat file and move "invalid" file to "Error" folder?

Ok, here is the solution for .bat file.
It moves file to "Err" folder, if found word "Invalid" in log.
set FFREPORT=file=ffreport.log:level=32
IF NOT EXIST "err" md err
for %%i in (*.avi) do (
f:\prog\ffmpeg\bin\ffprobe.exe -i %%i
echo 'errlevel:' + %ERRORLEVEL% >> err.txt
find /c "Invalid" ffreport.log && ( move %%i err )
type ffreport.log >> err.txt
)

Related

encoding jpeg sequence with ffmpeg

I do not have much expertise. I have been trying to convert a 240 jpeg long sequence (in a folder named plane) in to a 24fps mp4 file. each file is named 0001.jpeg , 0002.jpeg and so on.
I have tried this
ffmpeg -framerate 24 -i C:\Desktop\plane\image%4d.jpg output.mp4 and some variations on that but nothing seems to work.
the above command results in this
C:\Users\username>ffmpeg -framerate 24 -i C:\Desktop\plane\image%4d.jpg output.mp4
ffmpeg version 2022-07-31-git-1368b5a725-essentials_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-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 30.100 / 57. 30.100
libavcodec 59. 40.100 / 59. 40.100
libavformat 59. 29.100 / 59. 29.100
libavdevice 59. 8.101 / 59. 8.101
libavfilter 8. 46.101 / 8. 46.101
libswscale 6. 8.101 / 6. 8.101
libswresample 4. 8.100 / 4. 8.100
libpostproc 56. 7.100 / 56. 7.100
[image2 # 0000018847e4d500] Could find no file with path 'C:\Desktop\plane\image%4d.jpg' and index in the range 0-4
C:\Desktop\plane\image%4d.jpg: No such file or directory
Any help will be greatly appreciated

Can't play m3u8 file in VLC or decrypt it with ffmpeg

I have found and downloaded the m3u8 file using the developer tools in Edge. However, it won't play directly in VLC.
I then downloaded all the segments referred to in the m3u8 file as well as the key and put them in the same folder as ffmpeg. The partial contents of the m3u8 file are:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:13
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x00000000000000000000000000000001
#EXTINF:12,
seg-1-z.ts
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x00000000000000000000000000000002
#EXTINF:12,
seg-2-z.ts
...
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x0000000000000000000000000000013E
#EXTINF:8,
seg-318-z.ts
#EXT-X-ENDLIST
The keyfile.txt contents are: eyJwYXNzcGhyYXNlIjoiNjE0YjQ5NTYzYTdlYiIsImNpcGhlcnRleHQiOiJlamZOTWRSZjltY3Z4R1JRTFg2cVMralJJTmZaUGJyMXVyaFhhTVZ1QVptSUpXZVdYMkZLQ0t1Q0ZCYUQwY3FYIiwiaXYiOiIxZTNlNzg3ZjNjYmRlOGViZDdlZTBkNWVhZDA1NmEzNCIsInNhbHQiOiIwNjc3M2I1OWE1Y2IxZjA3ODdkYmEzZTAwYWZmNGIzNyJ9
This is what I get when I run ffmpeg:
C:\Test\download>ffmpeg -allowed_extensions ALL -i "play.m3u8" -c copy "test.ts"
ffmpeg version 2021-09-16-git-8f92a1862a-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.3.0 (Rev5, 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-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --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-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 5.100 / 57. 5.100
libavcodec 59. 7.103 / 59. 7.103
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
[hls # 000001c67608d140] Skip ('#EXT-X-VERSION:3')
[hls # 000001c67608d140] Opening 'keyfile.txt' for reading
[hls # 000001c67608d140] Opening 'crypto:seg-1-z.ts' for reading
[hls # 000001c67608d140] Error when loading first segment 'seg-1-z.ts'
play.m3u8: Invalid data found when processing input
Can anyone help? Thanks

FFMPEG: At least one output file must be specified

I am trying to split a video from a URL.... this is my CMD command:
ffmpeg -i 'https://mediasite-ondemand.maastrichtuniversity.nl/MediasiteDeliver/ondemand/MP4Video/90e0ea3d-4087-4a3d-8a78-7acf7906c4cb.mp4?playbackTicket=fb14f2f3baf84412bc6463d4e312ec27&site=mediasite.maastrichtuniversity.nl' -ss 00:00:00 -t 0:25:00 -c copy SplicedVid.wav
Why does it return:
'site' is not recognized as an internal or external command,
operable program or batch file.
My version:
ffmpeg -version output:
ffmpeg version 4.3.1-2020-11-19-essentials_build-www.gyan.dev Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 10.2.0 (Rev5, 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-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-
libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llv
m --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable
-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
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
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Put the URL in quotes:
ffmpeg -i "https://mediasite-ondemand.maastrichtuniversity.nl/MediasiteDeliver/ondemand/MP4Video/90e0ea3d-4087-4a3d-8a78-7acf7906c4cb.mp4?playbackTicket=fb14f2f3baf84412bc6463d4e312ec27&site=mediasite.maastrichtuniversity.nl" -t 00:25:00 output.wav

ffmpeg-python crossfade transition for unknown number of photos

I want to convert a bunch of photos into a video with crossfade between them. The number of photos I am converting is variable
I am using the code from HERE to apply the crossfade:
Since the number of photos are variable I looped over all the photos in the directory and generated the -loop and also the second part ([0:v]fade=t=out:st=4:d=1[v0];):
for i in range(os.listdir('photos')):
if i == 0:
text += f'\n-loop 1 -t 60 -i photos/Image{i+1}.jpg \\\n'
text2 = '\n[0:v]fade=t=out:st=4:d=1[v0]; \\\n'
else:
text += f'-loop 1 -t 60 -i photos/Image{i+1}.jpg \\\n'
text2 += f' [{i}:v]fade=t=in:st=0:d=1,fade=t=out:st=4:d=1[v{i}]; \\\n'
#And the Subprocess part
command = f'ffmpeg \
{text} \
-filter-complex \
{text2} -map "[v]" video/out.mp4'
p = subprocess.call(command, shell=True)
But this thing didn't create any video but said this:
Use -h to get full help or, even better, run 'man ffmpeg'
The full output:
ffmpeg version git-2019-11-11-20c5f4d Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20191010
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-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 --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 35.101 / 56. 35.101
libavcodec 58. 61.100 / 58. 61.100
libavformat 58. 34.101 / 58. 34.101
libavdevice 58. 9.100 / 58. 9.100
libavfilter 7. 66.100 / 7. 66.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'

FFMPEG "Could find no file with path" and "No such file or directory"

I try to convert a sequence of pictures to video file.
But I get from ffmpeg the response, that no such file or directory
Does someone have a solution for it?
My command line:
ffmpeg -r 1/5 -start_number 0 -i "C:\Users\USER\Desktop\Pictures\%3d.png" -c:v libx264 -r 30 -pix_fmt yuv420p C:\Users\USER\Desktop\Pictures\out.mp4
The error:
C:\Users\USER>ffmpeg -r 1/5 -start_number 0 -i "C:\Users\USER\Desktop\Pictures\%3d.png" -c:v libx264 -r 30 -pix_fmt yuv420p C:\Users\USER\Desktop\Pictures\out.mp4
ffmpeg version git-2020-05-01-39fb1e9 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200328
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 43.100 / 56. 43.100
libavcodec 58. 82.100 / 58. 82.100
libavformat 58. 42.101 / 58. 42.101
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 80.100 / 7. 80.100
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[image2 # 000002169186c440] Could find no file with path 'C:\Users\USER\Desktop\Pictures\%3d.png' and index in the range 0-4
C:\Users\USER\Desktop\Pictures\%3d.png: No such file or directory
The %3d means a file name with 3 digits (range 000 to 999).
solution A : You must rename your files as 001.png or 016.png (not as 1.png or 16.png).
solution B : Use %d to avoid needing zeroes (no renaming).
-i "C:\Users\USER\Desktop\Pictures\%d.png"

Resources