Saturday, August 27, 2022

ffmpeg - fast audio video edit

 Cut video segment

 Download the ffmpeg.exe and run it from cmd. https://ffmpeg.org/

ffmpeg.exe -ss 00:12:58 -t 00:04:29 -i video.mp4 -acodec copy -vcodec copy segment.mp4

-ss -> set first time interval
-t -> how much to cut in hours minutes seconds
* note this is not the second time position in the original video but it is t2-t1 - where t1 is the time mentioned with -ss
-i -> the input video

For exemaple original video has 20 minutes and we want to cut a segment from time 00:12:58 to time 00:17:39. si 17:39-12:58 = 04:29 -> 4 minutes and 29 seconds.

 next two to copy both video and sound 
and last argument segment.mp4 the name of the output video.

Cut a song from a video and then convert to mp3. 

ffmpeg -i song2.mp4 -vn song2.mp3

-vn option explicitly drops video so the conversion is much much faster.

Repeat song / video

ffmpeg -stream_loop 3 -i input.mp4 -c copy output.mp4

Extract audio mp3

ffmpeg -i input.mp4 out.mp3

ffmpeg -i input.mp4 -vn -acodec copy out.aac/mp3 - check with mediainfo

ffmpeg -i out.aac out.mp3


Sample rate = 1 sec = 44.000 samples

44khz -> 2 chanells of 22 khz each 

human hearing 20hz - 20khz

CD 44khz. DVD 48khz HD 96khz

Subtitles

ffmpeg -i "in.mp4" -lavfi "subtitles=sub.srt:force_style='Alignment=2,OutlineColour=&H100000000,Outline=1,Shadow=0,Fontsize=18,MarginV=70'" "output.mp4"


No comments:

Post a Comment