Cutting - Video Missing

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Cutting - Video Missing

Denis Połeć
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


_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Cutting - Video Missing

Carl Eugen Hoyos-2
Am So., 28. Feb. 2021 um 12:32 Uhr schrieb Denis Połeć <[hidden email]>:

> I have question about simple cutting/slice a video.

> I am working with a bash script

Instead please test (only) the ffmpeg command line
that fails or does not work as expected, and post
the command line including the complete, uncut
console output here, do not use -hide_banner.

Please remember to test current FFmpeg git head
before reporting issues or asking questions here.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".