Editing x264 Video With Frame Level Accuracy

From Nearline Storage
Jump to: navigation, search
  • Encode with lossless codec, making every frame a keyframe:
    ffmpeg -i input.mp4 -vcodec ffvhuff -g 1 -acodec copy temp.mkv
  • Get cutpoint timecodes using avidemux2_gtk against temp.mkv
  • Encode the pieces you want back into x264/mp4 files:
    ffmpeg -threads 8 -i temp.mkv -t 0:46:57.650 -vcodec libx264 -b 800k -vpre main -vpre hq -acodec copy part1.mp4
    ffmpeg -threads 8 -i temp.mkv -ss 0:46:57.108 -vcodec libx264 -b 800k -vpre main -vpre hq -acodec copy part2.mp4
  • Use MP4Box to concatentate the parts:
    MP4Box -cat part1.mp4 -cat part2.mp4 -cat part3.mp4 -new output.mp4