To extract and get some parts/clips out of a MP4 file to be concatenated into another
How to extract/get some parts/clips out of a MP4 file to be concatenated into another new MP4 file tried to get/extract out only first 19 seconds, also a part beginning from 32th up to its next 37 seconds, and finally part beginning from 2 min 29th s up to its next 99 seconds, by this: $ ffmpeg -t 19 -i Example.mp4 -ss 0:0:32 -t 37 -i Example.mp4 -ss 0:2:29 -t 99 -i Example.mp4 -ss 0:0:0 -c copy ~/Downloads/ExampleOut.mp4 to no avail sincere help is appreciated
On Jul 22, 2021, at 3:26 AM, Budi <budikusasi@gmail.com> wrote:
How to extract/get some parts/clips out of a MP4 file to be concatenated into another new MP4 file
tried to get/extract out only first 19 seconds, also a part beginning from 32th up to its next 37 seconds, and finally part beginning from 2 min 29th s up to its next 99 seconds, by this:
$ ffmpeg -t 19 -i Example.mp4 -ss 0:0:32 -t 37 -i Example.mp4 -ss 0:2:29 -t 99 -i Example.mp4 -ss 0:0:0 -c copy ~/Downloads/ExampleOut.mp4 to no avail
sincere help is appreciated
It looks as though you're using macOS. I’m using Big Sur 11.5. This works for me, but I don’t seem to have the command line savvy to use named pipes, so I wind up with 3 intermediate files in addition to the desired output file. My source file (Example.mp4) is in ~/Downloads. inputfileName=$(echo 'Example.mp4');/usr/local/bin/ffmpeg -i ~"/Downloads/$inputfileName" -ss 00:00:00.00 -t 00:00:19.00 -c copy -map 0 -movflags +faststart ~/Downloads/1Out.mp4;/usr/local/bin/ffmpeg -i ~"/Downloads/$inputfileName" -ss 00:00:32.00 -t 00:00:37.00 -c copy -map 0 -movflags +faststart ~/Downloads/2Out.mp4;/usr/local/bin/ffmpeg -i ~"/Downloads/$inputfileName" -ss 00:02:29.00 -t 00:01:39.00 -c copy -map 0 -movflags +faststart ~/Downloads/3Out.mp4;loggedInUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' );echo "file /Users/$loggedInUser/Downloads/1Out.mp4 file /Users/$loggedInUser/Downloads/2Out.mp4 file /Users/$loggedInUser/Downloads/3Out.mp4 " > ffmpegCatList;sleep 3;/usr/local/bin/ffmpeg -f concat -safe 0 -i ffmpegCatList -c copy ~'/Downloads/ExampleOut.mp4';sleep 1 ;/bin/echo ' ========================== ExampleOut.mp4 FINISHED! ========================== ';mv ffmpegCatList ~'/.Trash/‘ Laine Lee
On Jul 23, 2021, at 1:00 AM, llee040@sbcglobal.net wrote:
';mv ffmpegCatList ~'/.Trash/‘
I’m not sure why, but the last character of the last line of the script included in my previous post was changed to a curly single quote instead of a single quote. The last line should be ';mv ffmpegCatList ~'/.Trash/' If it happens again, it’ll have to be fixed for the script to work. Laine Lee
participants (2)
-
Budi -
llee040@sbcglobal.net