Advertisement
fangfufu

ffmpeg cut and merge

Oct 25th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/bin/bash
  2. ffmpeg -i video_a.mp4 -ss 00:00 -to 01:40 -vcodec copy  -acodec copy section1.mp4
  3. ffmpeg -i video_a.mp4 -ss 01:40 -to 17:06 -vcodec copy  -acodec copy section2.mp4
  4. ffmpeg -i video_a.mp4 -ss 17:06 -to 18:04 -vcodec copy  -acodec copy section3.mp4
  5. ffmpeg -i video_b.mp4 -vcodec copy -an section2_video.mp4
  6. ffmpeg -i section2.mp4 -acodec copy -vn section2_audio.mp4
  7. ffmpeg -i section2_audio.mp4 -i section2_video.mp4 -vcodec copy -af atempo=0.97885835 section2_new.mp4
  8. ffmpeg -i section1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
  9. ffmpeg -i section2_new.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
  10. ffmpeg -i section3.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate3.ts
  11. ffmpeg -i "concat:intermediate1.ts|intermediate2.ts|intermediate3.ts" -c copy -bsf:a aac_adtstoasc output.mp4
  12. rm section1.mp4 section2*.mp4 section3.mp4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement