ensure that ffmpeg completes successfully before removing source file
This commit is contained in:
parent
5e4eb51b4b
commit
c9c9fda6ed
1 changed files with 3 additions and 4 deletions
|
@ -1,10 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
for i in `fdfind video.mp4`; do
|
||||
if [ $(ffprobe -show_streams $i 2>&1 | grep fps | awk '{split($0,a,"fps")}END{print a[1]}' | awk '{print $NF}') -gt 30 ]; then
|
||||
snap run ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i "$i" -c:a copy -c:v h264_nvenc -filter:v fps=30 "${i}_30.mp4"
|
||||
rm "$i"
|
||||
mv "${i}_30.mp4" "$i"
|
||||
if [[ (( $(ffprobe -show_streams $i 2>&1 | grep fps | awk '{split($0,a,"fps")}END{print a[1]}' | awk '{print $NF}') > 30 )) ]]; then
|
||||
snap run ffmpeg -hide_banner -hwaccel cuda -hwaccel_output_format cuda -i "$i" -c:a copy -c:v h264_nvenc -filter:v fps=30 "${i}_30.mp4" && \
|
||||
rm "$i" ; mv "${i}_30.mp4" "$i"
|
||||
fi
|
||||
echo "no edit for $i"
|
||||
done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue