I have an ffmpeg command that changes the PTS of several segments of a video file. the problem is that all the segments are being re encoded (instead of COPY), even the segments that retain the same PTS, and the operation is very slow

ffmpeg -i t.mp4 -i y.wav -filter_complex  "[0:v]trim=0.0:60.859,setpts=PTS-STARTPTS[v1];[0:v]trim=60.859:64.379,setpts=1.2946875*(PTS-STARTPTS)[v2];[0:v]trim=64.379:70.858,setpts=PTS-STARTPTS[v3];[0:v]trim=70.858:72.378,setpts=1.1231231*(PTS-STARTPTS)[v4];[0:v]trim=72.378:,setpts=PTS-STARTPTS[v5];[0:a]atrim=0.0:60.859,asetpts=PTS-STARTPTS[a1];[0:a]atrim=60.859:64.379,asetpts=PTS-STARTPTS,atempo=0.7723871590634805[a2];[0:a]atrim=64.379:70.858,asetpts=PTS-STARTPTS[a3];[0:a]atrim=70.858:72.378,asetpts=PTS-STARTPTS,atempo=0.8903743498820388[a4];[0:a]atrim=72.378:,asetpts=PTS-STARTPTS[a5];[v1][a1][v2][a2][v3][a3][v4][a4][v5][a5]concat=n=5:v=1:a=1" -map 0:v:0 -map 1:a:0 output.mp4

I tried appending -map "[v]" -map "[a]" -c:v copy -c:a copy to the command but i get an error Streamcopy requested for output stream fed from a complex filtergraph. Filtering and streamcopy cannot be used together.

Is there a way to do that task without running a separate ffmpeg command for each segment and then concatenating them at the end?




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.