Home

Add a comment

 

Re: Movies

Do you have unix on your server?  You can do all the conversions automatically, even create a thumbnail.  I do not know how much you've researched, but here is the script I use:
...........................

#!/bin/bash

PATH=$PATH:/usr/local/bin

function video
{
while read line
do

dest_name=`basename $line`
dest="${current}/flash/"${dest_name%.wmv}".flv"
thumb="${current}/flash/thumbs/"${dest_name%.wmv}".jpg"

# For Best Quality WMV to FLV

mencoder $line -o $dest -of lavf -oac mp3lame -lameopts abr:br=96 -ovc lavc -lavcopts vcodec=flv:vqscale=5:mbd=2:mv0:trell:v4mv:keyint=50:cbp:last_pred=3 -srate 44100 -lavfopts 'i_certify_that_my_video_stream_does_not_use_b_frames' -ofps 25000/1001

# Add Metadata

flvtool2 -UP $dest

# Create Thumbnail

ffmpeg -i $dest -vcodec mjpeg -vframes 1 -an -t 00:00:01 -f rawvideo -s 640x480 $thumb < /dev/null

wait

# For Logfile

echo $line

done << EOF
$(/usr/local/bin/php $current/createflash.php)
EOF
}

current=`pwd`
video
...................................

The PHP script I have basically finds all the wmv movies on the server, though it can be anything supported by mencoder, which is a lot of formats.  It spits them out with the full path on the server, one file per line... i.e.

/home/phil/html/wmv/vacation0001.wmv

The mencoder creates the flash, then the flvtools2 adds an xml file for keyframe, so I can stream the whole movie and people can click on the timeline for any point in the movie without having to download the entire thing.  The last step makes a thumbnail.  I put this script on a cron every morning at 6AM to catch any movies anyone in my family wanted to FTP the previous day.

I call it like this (crontab):

0 6 * * * /home/phil/scripts/createflash.sh 2>&1 >> /home/phil/logfiles/createflash`date +\%d\%b\%Y`.log

Re: Movies


Title
Body
HTML : b, strong, i, em, blockquote, br, p, pre, a href="", ul, ol, li, sub, sup
OpenID Login
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).