Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat /usr/local/bin/a.sh
- #!/bin/bash
- cd /mnt/data/events/9 || exit 1
- tmp="convert.mp4"
- find -type f -iname '*-video.mp4' | while read filename; do
- echo "$filename: converting..."
- nice -n 3 ffmpeg -i $filename -vcodec h264 -threads 1 -b:v 3M -y $tmp >convert.tmp 2>&1
- if [ $? != 0 ]; then
- echo "$filename: failed to convert"
- continue
- fi
- echo "$filename: successfully converted"
- done
- $ /usr/local/bin/a.sh
- ./2021-04-27/23905/23905-video.mp4: converting...
- ./2021-04-27/23905/23905-video.mp4: successfully converted
- 1/24041-video.mp4: converting...
- 1/24041-video.mp4: failed to convert
- ./2021-04-27/24045/24045-video.mp4: converting...
- ./2021-04-27/24045/24045-video.mp4: successfully converted
- 21-04-27/24296/24296-video.mp4: converting...
- 21-04-27/24296/24296-video.mp4: failed to convert
- ./2021-04-27/23709/23709-video.mp4: converting...
- ./2021-04-27/23709/23709-video.mp4: successfully converted
- 273-video.mp4: converting...
- 273-video.mp4: failed to convert
- ./2021-04-27/24179/24179-video.mp4: converting...
- ^C
- ---
- $ cat /usr/local/bin/c.sh
- #!/bin/bash
- cd /mnt/data/events/9 || exit 1
- tmp="convert.mp4"
- dummy()
- {
- return
- }
- find -type f -iname '*-video.mp4' | while read filename; do
- echo "$filename: converting..."
- dummy
- if [ $? != 0 ]; then
- echo "$filename: failed to convert"
- continue
- fi
- echo "$filename: successfully converted"
- done
- $ /usr/local/bin/c.sh
- ./2021-04-27/23905/23905-video.mp4: converting...
- ./2021-04-27/23905/23905-video.mp4: successfully converted
- ./2021-04-27/23754/23754-video.mp4: converting...
- ./2021-04-27/23754/23754-video.mp4: successfully converted
- ./2021-04-27/23988/23988-video.mp4: converting...
- ./2021-04-27/23988/23988-video.mp4: successfully converted
- ./2021-04-27/23989/23989-video.mp4: converting...
- ./2021-04-27/23989/23989-video.mp4: successfully converted
- ./2021-04-27/24081/24081-video.mp4: converting...
- ./2021-04-27/24081/24081-video.mp4: successfully converted
- ./2021-04-27/24189/24189-video.mp4: converting...
- ./2021-04-27/24189/24189-video.mp4: successfully converted
- ./2021-04-27/24327/24327-video.mp4: converting...
- ./2021-04-27/24327/24327-video.mp4: successfully converted
- ./2021-04-27/23593/23593-video.mp4: converting...
- ./2021-04-27/23593/23593-video.mp4: successfully converted
- ./2021-04-27/24244/24244-video.mp4: converting...
- ./2021-04-27/24244/24244-video.mp4: successfully converted
- ./2021-04-27/23584/23584-video.mp4: converting...
- ./2021-04-27/23584/23584-video.mp4: successfully converted
- ./2021-04-27/23963/23963-video.mp4: converting...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement