/ Published in: Bash
This will convert videos to MP4 that's optimized and plays on my phone. The said videos should be stored on a directory so this script could parse them.
Requires unstripped codecs from the Medibuntu repository (libavcodec-unstripped-52, libavdevice-unstripped-52, libavformat-unstripped-52, etc.) which contains the MP4 and libfaac Encoders. See: http://ubuntuforums.org/showthread.php?t=1117283 and http://www.medibuntu.org/repository.php
This script also requires the libnotify1 package for the notify-send command (or you can just echo it, instead of using the desktop notification daemon)
Update the ffmpeg statement as needed, check the documentation at http://www.ffmpeg.org/ffmpeg-doc.html
Requires unstripped codecs from the Medibuntu repository (libavcodec-unstripped-52, libavdevice-unstripped-52, libavformat-unstripped-52, etc.) which contains the MP4 and libfaac Encoders. See: http://ubuntuforums.org/showthread.php?t=1117283 and http://www.medibuntu.org/repository.php
This script also requires the libnotify1 package for the notify-send command (or you can just echo it, instead of using the desktop notification daemon)
Update the ffmpeg statement as needed, check the documentation at http://www.ffmpeg.org/ffmpeg-doc.html
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash ############################################################ ## License: Public Domain ## Author: Dax Solomon Umaming ## ## Save in ~/bin then execute on a directory ## with the videos you wish to convert ## ## Take note that you'll need ffmpeg restricted libraries ## On Ubuntu, you can download and install them from the ## Medibuntu Repository at http://medibuntu.org/ ## check the howtos for instruction on how to install them ## you'll need the *-unstripped and *-extra libraries ## ## You'll also need to have libnotify1 package installed ## Since ffmpeg already outputs tons of messages on the ## terminal, the messages this script outputs will only ## be readable (or even usable) using the desktop ## notification daemon ## ############################################################ # get filenames in a directory for origfilename in * do # skip mp4 files, since that is - afterall - our target file format if expr "$origfilename" : "\(.*\.[Mm][Pp]4$\)" > /dev/null 2>&1 then echo "Skipping $origfilename" # process non-mp4 files else # placeholder to be utilized by the array newfilename=$origfilename # set video file extensions in an array vidextensions=(flv avi mkv 3gp ogv m4v f4v) # remove above-declared extensions from the file name for vidext in "${vidextensions[@]}" do newfilename=`echo $newfilename|sed 's/\.'${vidext[@]}'$//g'` done # convert video files to mp4 format notify-send "Converting $origfilename to mp4" ffmpeg -i "$origfilename" -acodec libfaac -ac 2 -vcodec mpeg4 -r 25 -s qvga -metadata title="$newfilename" "$newfilename.mp4" fi done notify-send "Done converting all videos to MP4"