[FFmpeg-user] Cutting - Video Missing
Denis Połeć
denis.polec at gmail.com
Sun Feb 28 13:32:17 EET 2021
Hello,
I have question about simple cutting/slice a video. I am working with a bash script, which should simply randomly slice one video in a loop function:
###################################################################################################
function portion(){
durationInput=$(ffprobe -v error -hide_banner -i $1 -show_format | grep duration | cut -d= -f2);\
r=$RANDOM;\
ran=$(printf '%.2f' $(echo "scale=2; $r/32768" | bc ));\
start=$(printf '%.2f' $(echo "scale=2; $durationInput*($ran*0.9)" | bc ));\
duration=$(printf '%.2f' $(echo "scale=2; ($ran*4)+2" | bc ));\
filename=${1%%.*}_portion_$c.mp4
ffmpeg -i "$1" -ss $start -t $duration -c:v copy -c:a copy -y $filename
}
###################################################################################################
in=GoogleMaps_.mp4
for ((c=1; c<=10; c++)); do
portion $in
done
When I am just copying the video codec sometimes the video is missing and I just get a file with sound. If I decode like with -c:v libx264 it works probably what could be the reason?
Thanks. :)
denis
More information about the ffmpeg-user
mailing list