0

I have multiple mpg files from a broken video file recovered from an old CD. I wanted to join all of them into a single video file. I have gone through How can I join multiple .mpg movie files? and I'm using ffmpeg -f concat -i files.txt -c copy output1.mpg to create the output file. However it seems some files are broken beyond recognition and ffmpeg exits with error

[concat @ 0x5598f78d1140] Impossible to open 'recup_dir.6/f5681240.mpg'
files.txt: Invalid data found when processing input

My current approach is to make a script which I will run with the name of the bad file which will delete all the files above the bad file in files.txt and add output.mpg to the top. This works, but requires human intervention and has extra overhead where ffmpeg has to go through the output.mpg file again and create a copy, then start processing the remaining files.

Is there someway to tell ffmpeg to skip the bad files and continue with the concatenation process?

DentFuse
  • 3
  • 1
  • 1
  • 4
  • I don't really know if it's possible or not. However with some appropriate script you could make all the process fully automatic, without the need of manual intervention on each faulty file. First I would try to open separately each file of the list (possibly with `ffprobe`, so no need to read the entire file), catch the errors, and remove the corresponding files from the list. – PierU Oct 06 '22 at 11:54

0 Answers0