添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to concat multiple videos with ffmpeg, im using a text file as input but im getting "Files.txt: Invalid data found when processing input".

My command:

ffmpeg -i Files.txt -filter_complex "[0:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v0];[0:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a0];[1:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v1];[1:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1" -movflags +faststart output.mp4

My text file:

file '1.mp4'
file '2.mp4'

Only the concat demuxer accepts a text file list

Either use the concat demuxer:

ffmpeg -f concat -i input.txt output.mp4

Or list the inputs normally and use the concat filter:

ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex "[0:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v0];[0:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a0];[1:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v1];[1:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1]concat=n=2:v=1:a=1" -movflags +faststart output.mp4

You can't use a text file listing inputs unless you use the concat demuxer as shown above, or if you use some capability in your shell to interpret the list as inputs. ffmpeg has no such feature.

Im using filter complex for a reason, concat makes no sense for my usecase. The second option works but im trying to do it with a text file. – GoekhanDev Feb 2, 2021 at 17:03 @VRX This answer directly answers the question "Invalid data found when processing input", but it now seems the actual question is "how can I use a file list as input with ffmpeg (but not for concat demuxer)"? – llogan Feb 2, 2021 at 17:11 Not it's not answering the question since it's very obvious what im trying to do. Im using filter complex, because every video that Im trying to merge is not the same format. If I would've use "concat" the video output is corrupted. The solution that im looking for is avoid the issue I am getting. Not a diffrent way to use a text file as input since there is no other way. – GoekhanDev Feb 2, 2021 at 17:35 @VRX You can't use a text file as an input unless: A) you are using the concat demuxer, or B) you use some capability of your shell. It's not a feature in ffmpeg. – llogan Feb 2, 2021 at 17:37 @VRX ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -filter_complex "[0:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v0];[0:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a0];[1:v]fps=25,format=yuv420p,setpts=PTS-STARTPTS[v1];[1:a]aformat=sample_rates=44100:channel_layouts=stereo,asetpts=PTS-STARTPTS[a1];[v0][a0][v1][a1][2:v][2:a]concat=n=3:v=1:a=1" -movflags +faststart output.mp4 – llogan Feb 3, 2021 at 1:36 Im using filter complex because the videos don't have the same format. If I would use concat the video output would be corrupted. – GoekhanDev Feb 2, 2021 at 17:36

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.