ffmpeg concat + invalid data found when processing + check for valid avi file -


i'm using ffmpeg concatenate (merge) multiple avi files single avi file. i'm using following command.

ffmpeg -f concat -i mylist.txt -c copy out.avi 

the list of files merge given in mylist.txt

ex 'mylist.txt':  file 'v01.avi'  file 'v02.avi'  file 'v03.avi' ...  file 'vxx.avi' 

however, there problem when 1 of file corrupted (or empty). in case, video contains files corrupted file.

in case, ffmpeg return following errors:

[concat @ 02b2ac80] impossible open 'v24.avi' mylist.txt: invalid data found when processing input 

q1) there way tell ffmpeg continue merging if encounters invalid file ?

alternatively, decided write batch file check if avi files valid before doing merging. second problem operation takes more time doing merging itself.

q2) there fast way check if multiple avi files valid ffmpeg ? (and delete, ignore or rename them if not valid).

thanks in advance comments.

ssinfod.

for information, here current dos batch file. (this batch working slow because of ffprobe check if avi valids)

go.bat

@echo off echo. echo == merging started == echo. set f=c:\myfolder set outfile=output.avi set listfile=mylist.txt set count=1  if exist %listfile% call :deletelistfile if exist %outfile% call :deleteoutfile  echo == checking if avi valid (with ffprobe) == %%f in (*.avi) (     call ffprobe -v error %%f     if errorlevel 1 (         echo "error:corrupted file"         move %%f %%f.bad         del %%f     ) )  echo == list avi files convert in listfile == %%f in (*.avi) (     echo file '%%f' >> %listfile%     set /a count+=1 ) ffmpeg -v error -f concat -i mylist.txt -c copy %outfile% echo. echo == merging completed == echo. goto :eof  :deletelistfile  echo "deleting mylist.txt"  del %listfile% goto :eof  :deleteoutfile  echo "deleting output.avi"  del %outfile% goto :eof  :eof 

i suppose ffmpeg terminates exit value greater 0 if error occurred during operation. don't have ffmpeg installed , therefore can't verify it.

so suppose avi files in list valid on first run of ffmpeg concatenation. check return code assigned errorlevel.

if return code 0, concatenation of avi files successful , batch can exited.

otherwise more time consuming code used find out avi files not valid, sort them out , concatenate remaining avi files.

so batch file below (not tested):

@echo off set "listfile=%temp%\mylist.txt" set "outputfile=output.avi"  :preparemerge if exist "%listfile%" call :deletelistfile if exist "%outputfile%" call :deleteoutputfile  echo == list avi files convert list file == %%f in (*.avi) echo file '%%~ff'>>"%listfile%" if not exist "%listfile%" goto cleanup  echo == merge avi files output file == ffmpeg.exe -v error -f concat -i "%listfile%" -c copy "%outputfile%" if not errorlevel 1 goto success  echo. echo ================================================= echo error: 1 or more avi files corrupt. echo ================================================= echo.  echo == checking avi valid (with ffprobe) == %%f in (*.avi) (     ffprobe.exe -v error "%%~ff"     if errorlevel 1 (         echo corrupt file: %%~nxf         ren "%%~ff" "%%~nf.bad"     ) ) goto preparemerge  :deletelistfile echo deleting list file. del "%listfile%" goto :eof  :deleteoutputfile echo deleting output file. del "%outputfile%" goto :eof  :success echo == merging completed == call :deletelistfile  :cleanup set "listfile=" set "outputfile=" 

if not errorlevel 1 means if errorlevel not greater or equal 1 means 0 (or negative).


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -