Created
February 4, 2014 11:48
-
-
Save mpampols/8802263 to your computer and use it in GitHub Desktop.
Bash that checks a folder for .mp4 files without STREAMING string and reencodes them using ffmpeg to move the moov atom at the beginning of the file in order to enable web streaming.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for file in /opt/web/streaming/*.mp4 | |
do | |
echo "Check if file ${file% STREAMING.mp4} STREAMING.mp4 exists" | |
if [ ! -f "${file% STREAMING.mp4} STREAMING.mp4" ]; then | |
echo "-- New afile detected:" | |
echo "-- Running: ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4" | |
ffmpeg -i "$file" -c:a copy -c:v copy -movflags faststart "${file%.mp4} STREAMING".mp4 | |
mv "$file" /opt/videos-originals | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment