2

To remove the first 10 seconds of a video without any transcoding I can use the following command:

ffmpeg -i input.webm -vcodec copy -acodec copy -ss 10 output.webm

The problem is that if the key frames are located at 8 seconds then at 12 seconds, the video will start from the 8th second. If I do the following I will get the correct timing, but the whole stream will be transcoded:

ffmpeg -i input.webm -ss 10 output.webm

Is there any way (using avcodec of ffmpeg) to transcode only the part from the 10th to the 12th second then copy the rest of the stream?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Gabriel Diego
  • 950
  • 2
  • 10
  • 22
  • This has to be done manually using a multiple step process.First, you segment the file in copy mode to two segments. Then re-encode the first segment with the same bitstream specs as the rest of the file. Then stitch the two together. – Gyan May 15 '17 at 07:51
  • I tried that but the remuxer messed-up the sound (Theora) of the second segment. Theora uses some Huffman tables in the beginning of the bitstream. I guess that the muxer didn't copy these tables again for the second segment. – Gabriel Diego May 15 '17 at 08:09
  • Segment only the video stream. In the final concat step, feed the original file, map its audio with accurate `-ss`. – Gyan May 15 '17 at 09:03
  • Sounds a good idea. I'll try that later. You can write this as an answer. – Gabriel Diego May 15 '17 at 09:04

0 Answers0