commit a69b62863b600893ce26fb5784251bc5c390bcc9
parent 6bd0909557d436ed5f5ca7de8893b0e656f379c5
Author: Anders Damsgaard <andersd@riseup.net>
Date: Wed, 20 Dec 2017 10:42:12 -0500
Support spaces in file names
Diffstat:
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/links/bin/ffmpeg-to-mp4.sh b/links/bin/ffmpeg-to-mp4.sh
@@ -1,6 +1,5 @@
#!/bin/bash
-
-output=${1%.*}.mp4
+output="${1%.*}.mp4"
#ffmpeg -i $1 \
#-crf 20 -vcodec libx264 -x264opts keyint=25 \
@@ -10,11 +9,11 @@ output=${1%.*}.mp4
# Generates sufficient keyframes to allow for precise seeking within video.
# The scale argument ensures that dimensions are divisible by 2, a requirement
# for MP4 videos using H.264.
-ffmpeg -i $1 \
+ffmpeg -i "$1" \
-vf scale="trunc(iw/2)*2:trunc(ih/2)*2" \
-c:v libx264 -profile:v high -pix_fmt yuv420p \
-g 30 -r 30 \
- $output
+ "$output"
#ffmpeg -i movie.avi -sameq -vcodec libx264 -x264opts keyint=25 \
#-acodec libfaac -b:a 128k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 \
@@ -23,7 +22,7 @@ ffmpeg -i $1 \
#ffmpeg -i $1 -vcodec libx264 -crf 20 $output
# Output first frame as an image
-ffmpeg -i $1 -vframes 1 -f image2 ${output%.*}.png
+ffmpeg -i "$1" -vframes 1 -f image2 "${output%.*}.png"
# Output last frame as an image
#lastframe_index=$(ffprobe -show_streams "$1" 2> /dev/null | \
@@ -32,4 +31,3 @@ ffmpeg -i $1 -vframes 1 -f image2 ${output%.*}.png
# ${output%.*}-last.png
echo $output
-