[FFmpeg-user] re-encoding and transcode (codec copy) on same file.

chronek chronek at interia.eu
Sat Apr 8 02:19:05 EEST 2017


You can cut, encode one piece, merge after, but you have to remeber to 
keep container/codec/resolution

(And you will always end with sync or freeze problem in merge place)

example:

ffmpeg -i in.mp4 -to 00:01:00 -c copy 1.mp4
< process 1.mp4 to 2.mp4 >
|ffmpeg -i 2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts temp1.ts ||ffmpeg -i in.mp4 -ss 00:01:00 -c copy -bsf:v h264_mp4toannexb -f mpegts 
temp2.ts|
ffmpeg -i "concat:temp1.mp4|temp2.mp4"|-c copy -bsf:a aac_adtstoasc |out.mp4


W dniu 2017-04-08 o 00:15, YIRAN LI pisze:
> Hi guys,
>
> I'm investigating if it's possible to do editing and transcode on same file.
>
> I mean use -vcodec copy, we can readout packets and write them directly
> into output file without re-encoding. But if it's possible, for example if
> I have a 2 mins video, re-encode 1st min because there're some effects
> applied to that region but copy 2nd part?
>
> My concern is, for example we know H.264 has extradata, if I re-encode
> first part but keep 2nd part, how if new extradata is different from old
> extradta?
>
> Anyone have suggestion on this? and any other possible problems doing this?
>
> Thanks
>



More information about the ffmpeg-user mailing list