Last active
August 29, 2015 14:21
-
-
Save chintak/23b4893dc413ecbda131 to your computer and use it in GitHub Desktop.
ffmpeg/avconv tricks and tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Break a video into multiple fixed length segments | |
~/libs/ffmpeg-2.6.2/ffmpeg -i test3.mp4 -acodec copy -vcodec copy -map 0 -f segment -segment_time 10 -reset_timestamps 1 clips/test3__%05d.mp4 | |
# Decode and encode file to create accurate video segments | |
ffmpeg -i t2.mp4 -c:v libx264 -crf 22 -map 0 -segment_time 10 -g 10 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*10)" -f segment -reset_timestamps 1 out%04d.mp4 | |
# Iterate through all the files and run a command | |
base_dir=/media/chintaksheth/LB_Recordings_07/pilot/ | |
for f in $(find $base_dir -wholename "*.mp4"); do | |
new_dir=$(dirname $f)_clips/ | |
mkdir -p $new_dir | |
file_name=${f##*/} # extract the file name and extension from the entire path | |
new_name=${file_name%.*}__\%05d.mp4 # extract only the file name without the extension | |
/home/chintaksheth/libs/ffmpeg-2.6.2/ffmpeg -i $f -y -acodec copy -vcodec copy -map 0 -f segment -segment_time 10 -reset_timestamps 1 $new_dir$new_name | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment