问题
I have a video file that is 22 seconds long.
I want to remove the segment from 10 seconds to 12 seconds.
Then return a concatenated video file of seconds 1-10 and 12-22.
I want to do this in a single FFmpeg command.
This is the easy way
Source https://www.labnol.org/internet/useful-ffmpeg-commands/28490/
ffmpeg -i input.mp4 -ss 00:00:00.0 -codec copy -t 10 output_1.mp4
and
ffmpeg -i input.mp4 -ss 00:00:12.0 -codec copy -t 10 output_2.mp4
then create an input file with all the source file names and run
ffmpeg -f concat -i file-list.txt -c copy output.mp4
But I'm looking for a one line solution
Any help would be appreciated.
回答1:
For exact trimming, you'll have to re-encode
Use
ffmpeg -i input.mp4 -vf select='not(between(t,10,12))',setpts=N/FRAME_RATE/TB -af aselect='not(between(t,10,12))',asetpts=N/SR/TB out.mp4
来源:https://stackoverflow.com/questions/54189099/ffmpeg-remove-2-sec-from-middle-of-video-and-concat-the-parts-single-line-solut