Use multiple files as input with ffmpeg for Windows
On Linux, cat
is a good way to combine multiple files, and pass them to ffmpeg
, as explained in FFMpeg open a DVD VOB chain?
:
cat first.VOB second.VOB third.VOB | ffmpeg -i - outfile.mp4
This does not seem to work for Windows.
Question: how to use multiple files as input for ffmpeg, with Windows?
These solutions do not seem to work:
ffmpeg -i a.VOB b.VOB c.VOB d.VOB -c:v copy -c:a copy out.avi
ffmpeg -i a.VOB -i b.VOB -i c.VOB -i d.VOB -c:v copy -c:a copy out.avi
Solution 1:
The simplest way seems to be:
copy /b e:/video_ts/vts_*.vob temp.vob
and then encode temp.vob
.
Solution 2:
- You can easily resolve it using this answer from @Gyan
ffmpeg -i "concat:a.VOB|b.VOB|c.VOB|d.VOB|...| nn.VOB" -c:v copy -c:a copy out.avi
In the same way that it is done in mp4, explained here
>input.txt (for %x in (*.VOB)do @echo file '%~x') && ffmpeg -safe 0 -f concat -i input.txt -c:v copy -c:a copy out.avi
This can be done by one line:
>input.txt (for %x in (*.VOB)do @echo file '%~x') && ffmpeg -safe 0 -f concat -i input.txt -c:v copy -c:a copy out.avi
-
Create/Overwrite file
>input.txt
with (command block) output>input.txt (for %x in (*.VOB)do @echo file '%~x')
-
List all files with Name.Extension to output with layout
file '%~x'
>input.txt (for %x in (*.VOB)do @echo file '%~x')
-
Only if last (block command) execution
return 0
(by operator&&
), then runffmpeg
command:... && ffmpeg -safe 0 -f concat -i input.txt -c:v copy -c:a copy out.avi
-
You can also work with different drivers/folders:
>"%temp%\input.txt" (for %x in ("d:\movies\last\*.VOB")do @echo file '%~x') && "c:\ffmepg\bin\ffmpeg.exe" -safe 0 -f concat -i "%temp%\input.txt" -c:v copy -c:a copy "d:\movies\last\concat\out.avi"