1

Quick info: Windows 7, latest ffmpeg x64 build

I have multiple segments of video (1080i x264 + ac3 in an mpeg-ts container) that I want to concatenate together. However, for each segment, I also need to trim x seconds from the beginning of the audio, and add y frames/seconds of blank video to the end of the video. With this code, I've managed to concatenate a/v and trim the first x seconds of audio for 2 segments:

ffmpeg64.exe -y -i "FOLDER\1.ts" -i "FOLDER\2.ts" -filter_complex "[0:v]copy[v0];[0:a]atrim=start=1.245[a0];[1:v]copy[v1];[1:a]atrim=start=1.235[a1];[v0][a0][v1][a1]concat=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -q 0 -c:a ac3 -ab 384k -ac 6 -async 1 "FOLDER\Final.ts" > "FOLDER\log.txt" 2>&1

However, I can't seem to add blank frames to the video. How would I do this?

*the "-q 0" is a temporary placeholder for the actual video encoding, which will be lower bitrate x264.

1

Use

ffmpeg64.exe -y -i "FOLDER\1.ts" -i "FOLDER\2.ts" -f lavfi -i color=s=hd1080 -filter_complex "[2]trim=0:y0[tail0];[2]trim=0:y1[tail1];[0:v][tail0]concat[v0];[1:v][tail1]concat[v1];[0:a]atrim=start=1.245[a0];[1:a]atrim=start=1.235[a1];[v0][a0][v1][a1]concat=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" -q 0 -c:a ac3 -ab 384k -ac 6 -async 1 "FOLDER\Final.ts" > "FOLDER\log.txt" 2>&1

(You don't need the copy filters.)

  • Thank you! It works great. Can I just ask you to explain what the "trim=0:y0" means exactly? – Aeon2058 Oct 11 '16 at 4:09
  • It means to trim from 0 seconds to y0 seconds. – Gyan Oct 11 '16 at 4:20
  • Right. That was a dumb question. Thank you. – Aeon2058 Oct 11 '16 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.