Hi Thomas,

Here is a bash script I made to do something similar
I’ve converted is so that ffmpeg will cut 5 seconds from the start and 10 from 
the end.


#!/bin/bash

#------>>>> Set the input video

input="/path/to/VideoInput1.mp4"

#get fps of input video
eval $(ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries 
stream=duration $input)

# ------>>>> Round input to seconds and set as variable


inputduration=${streams_stream_0_duration%.*}


# ------convertsecs converts seconds to hh:mm:ss


convertsecs() {
 ((h=${1}/3600))
 ((m=(${1}%3600)/60))
 ((s=${1}%60))
 printf "%02d:%02d:%02d\n" $h $m $s
}

echo $inputduration
echo $(convertsecs inputduration)
echo $(convertsecs $((inputduration - 10)))


# ------>>>> Set the in (file locations), -ss start encoding here (hh:mm:ss), 
-to end encoding here (hh:mm:ss - 10seconds)


ffmpeg -i $input -ss 00:00:05 -to $(convertsecs $((inputduration - 10))) -codec 
copy "VideoPath/VideoOutput1.mp4”


#------>>>> End of Bash Script!



It will run ffprobe and get the duration of the input video, convert it to 
seconds, convert that to hh:mm:ss then run ffmpeg and cut off 5 seconds from 
the start and 10 seconds from the end.

Good luck!

Aidan


> On 19 Jan 2016, at 7:51 am, [email protected] wrote:
> 
> Hi
> 
> I am been trying almost every combination of switches to be able to cut 5
> sec from the start and 5 sec from the ending of variable length mp4 files.
> 
> I have not been successful at doing either.  I guess I really don't
> understand the usage.  I have more than 100 files to do.
> 
> Can anyone suggest a command string that will work?
> 
> 
> 
> Thanks
> 
> Thomas
> 
> 
> 
> _______________________________________________
> ffmpeg-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

_______________________________________________
ffmpeg-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

Reply via email to