![]() Trim=start=10:end=20,setpts=PTS-STARTPTS,format=yuv420p Ītrim=start=10:end=20,asetpts=PTS-STARTPTS Rather than concat each step of the way, just do them all at the end.įor each input, define a A/V pair: //Input1: Hope it helps someone.įor those having trouble following ptQa's approach, there's a slightly more streamlined way to go about it. Then just remember to delete ace-files.txt, a.tvshow, c.tvshow and e.tvshow.ĭisclaimer: I have no idea how (in)efficient this is compared to the other approaches in terms of ffmpeg but for my purposes it works better. That concats all the files in abe-files.txt together, copying their audio and video codecs and makes a file ace.tvshow which should just be sections a, c and e. ![]() Then the command: ffmpeg -f concat -i ace-files.txt -c copy ace.tvshow Note the "file" at the beginning and the escaped file name after that. Then once you have a bunch of video files I make a file ace-files.txt like this: file 'a.tvshow' The -ss option says how far to skip into the source video, so it's always relative to the start of the file. The -t says how long each clip is, so if c is 30 seconds long you could pass in 30 or 0:00:30. ![]() That will make files a.tvshow, c.tvshow and e.tvshow. Say you have 6 segments ABCDEF each 5 seconds long and you want A (0-5 seconds), C (10-15 seconds) and E (20-25 seconds) you'd do this: ffmpeg -i show -t 5 a.tvshow -ss 10 -t 5 c.tvshow -ss 20 -t 5 e.tvshow The basic strategy is using -t and -ss to get videos of each segment you want, then join together all the parts for your final version. I also like this approach because if something goes wrong on step 4, you end up with completed steps 1-3 so recovering from errors is a little more efficient. My solution seems a little clunkier because it can leave behind a mess, but if you're throwing it into a script, the clean up can be automated. I can never get ptQa's solution to work, mostly because I can never figure out what the errors from the filters mean or how to fix them. Trim=start=80,setpts=PTS-STARTPTS \Ītrim=start=80,asetpts=PTS-STARTPTS \Ĭoncat concat=v=0:a=1" -map -map out.ts ![]() Trim=start=40:end=50,setpts=PTS-STARTPTS \Ītrim=start=40:end=50,asetpts=PTS-STARTPTS \Ĭoncat concat=v=0:a=1 \ So the command should be: ffmpeg -i utv.ts -filter_complex \ If you want to have audio too, You have to do the same for audio streams. What I did here? I trimmed first 30 sec, 40-50 sec and 80 sec to end, and then combined them into stream out1 with the concat filter, leaving 30-40 sec (10 sec) and 50-80 sec (30 sec).Ībout setpts: we need this because trim does not modify picture display time, and when we cut out 10 sec decoder counter does not see any frames for this 10 sec. Trim=start=40:end=50,setpts=PTS-STARTPTS \ Here is an example, lets assume that you want to cut out three segments at first and end of the video as well as in the middle: ffmpeg -i in.ts -filter_complex \ Well, you still can use the trim filter for that. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |