Difference between revisions of "ffmpeg file trimming"
From thelinuxwiki
(Pushed from thelinuxwiki.com.) |
|||
(4 intermediate revisions by one user not shown) | |||
Line 1: | Line 1: | ||
== trim an mp3 file == | == trim an mp3 file == | ||
− | Example | + | Example: trim time before 10 seconds and after 10+40=50 seconds, keeping the time in between: |
− | ffmpeg -i input_file.mp3 - | + | ffmpeg -i input_file.mp3 -c copy -ss 00:00:10 -t 00:00:40 output_filename.mp3 |
+ | |||
+ | ==trim a video file== | ||
+ | ffmpeg -i videoin.mp4 -c:v libx264 -ss 00:00:10 -t 00:00:40 videoout.mp4 | ||
+ | |||
+ | used libx264 to avoid "deadlock buffer" issue on playback due to ffmpeg bug (version 5.1.4) | ||
[[category:ffmpeg]] | [[category:ffmpeg]] |
Latest revision as of 16:41, 25 June 2024
trim an mp3 file
Example: trim time before 10 seconds and after 10+40=50 seconds, keeping the time in between:
ffmpeg -i input_file.mp3 -c copy -ss 00:00:10 -t 00:00:40 output_filename.mp3
trim a video file
ffmpeg -i videoin.mp4 -c:v libx264 -ss 00:00:10 -t 00:00:40 videoout.mp4
used libx264 to avoid "deadlock buffer" issue on playback due to ffmpeg bug (version 5.1.4)