
sudo apt install gpac ffmpegThree Methods to Trim Video:
- MP4Box -splitx ss:ss input.mp4 -out output.mp4, where- ss:ssare numerical values for start-seconds and stop-seconds. (Fastest, does not transcode)
- ffmpeg -i input.mp4 -ss hh:mm:ss -t hh:mm:ss -async 1 output.mp4, where- hh:mm:ssare numerical values for hours, minutes, seconds.
- ffmpeg -i input.mp4 -vf trim=ss:ss output.mp4, where- ssis a numerical value for seconds.
function to_sec() { echo "$1" | awk -F':' '{if (NF == 2) {print $1 * 60 + $2} else {print $1 * 60 * 60 + $2 * 60 + $3}}'; }to_sec 2:47 or to_sec 1:2:47 or $(to_sec 2:47) or MP4Box -splitx $(to_sec 2:47):$(to_sec 7:33) input.mp4 -out output.mp4Overlay a Logo onto Video:
ffmpeg -i input.mp4 \
-i logo.png \
-filter_complex "X:Y" \  # set logo position
-codec:a copy \  # just copy audio
output.mp4ffmpeg -i input.mp4 \
-ignore_loop 0 -i animated-logo.gif \  # do not ignore looping
-filter_complex "X:Y:shortest=1" \  # limit to input video length
-codec:a copy \
output.mp4:shortest=1 is required, and where X:Y is the horizontal and vertical pixel positioning.  Without shortest, the video transcoding will not end.X and Y may be static numerical values, or ffmpeg built-in variables and equations. Examples:
- Top right with 10 pixel margin : main_w-overlay_w-10:10
- Top left with 10 pixel margin : 10:10
- Bottom left with 10 pixel margin : 10:main_h-overlay_h-10
- Bottom right with 10 pixel margin : main_w-overlay_w-10:main_h-overlay_h-10
Trim First x Seconds off Audio File:
ffmpeg -ss x -i input.mp3 -codec:a copy output.mp3 , where x is a numerical value for seconds.Add Audio to Video and Trim to Shortest Source:
ffmpeg -i input.mp4 -i audio.mp3 -codec copy -shortest output.mp4Overlay Logo and Add Audio with One Command:
ffmpeg -i input.mov \
 -i logo.png \
 -filter_complex "overlay=main_w-overlay_w-10:10" \
 -i music.mp3 -codec:a copy \
 -shortest output.mov~~~

No comments:
Post a Comment
Comments, Suggestions or "Thank you's" Invited! If you have used this info in any way, please comment below and link/link-back to your project (if applicable). Please Share.
I accept Bitcoin tips of ANY amount to: 1GS3XWJCTWU7fnM4vfzerrVAxmnMFnhysL
I accept Litecoin tips of ANY amount to: LTBvVxRdv2Lz9T41UzqNrAVVNw4wz3kKYk