Created
September 17, 2012 09:43
-
-
Save pheraph/3736471 to your computer and use it in GitHub Desktop.
Make OTR-Videos compatible to the AppleTV
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/sh | |
#Author: Raphael Fetzer (pheraph.net/@pheraph) | |
#Tested for .HQ-files from http://www.onlinetvrecorder.com | |
#Use at your own risk! Certified as "Works on my machine" | |
#Needs mp4box (0.5.0) (brew install --env=std mp4box) | |
#Needs ffmpeg (brew install ffmpeg) | |
#Folder with decoded videos (trailing slash!) | |
#temporary files are moved to $source/.tmp (must exist) | |
#converted files are moved to $source/AppleTV (must exist) | |
source="/Users/raphael/Downloads/OTR/" | |
#Create a list of the files in $source | |
filelist=`cd $source ; ls | grep -v unsortiert` | |
#Iterate through filelist | |
for file in $filelist ; do | |
#Ignore AppleTV-Folder | |
if [ $file != "AppleTV" ]; then | |
echo "\n+----------------------------------------------------------------------------------------+" | |
echo $file | |
#Split filename | |
ext=${file##*.} | |
basename=${file%.*} | |
#Extract audio stream | |
MP4Box -aviraw audio "$source""$file" | |
mv "$source""$basename"_audio.mp3 "$source".tmp/"$basename"_audio.mp3 | |
#extract video stream | |
MP4Box -aviraw video "$source""$file" | |
mv "$source""$basename"_video.h264 "$source".tmp/"$basename"_video.h264 | |
echo "Converting MP3 to AAC" | |
ffmpeg -loglevel panic -i "$source".tmp/"$basename"_audio.mp3 -acodec aac -ab 192k -strict experimental "$source".tmp/"$basename"_audio.aac | |
echo "Muxing MP4: $source $basename.mp4" | |
MP4Box -add "$source".tmp/"$basename"_video.h264 -add "$source".tmp/"$basename"_audio.aac -new "$source"AppleTV/"$basename".mp4 | |
echo "+----------------------------------------------------------------------------------------+" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment