Hello!
First of all - Thank you very much for a great job (I mean CPG and your great plugin).
I am newbie here but wanna to share some info about this plugin.
I have my own server box powered by gentoo and my gallery with my family photos. My photocamera allows me to make short movies in MOV format (i think it's quicktime codecs).
I added a lot of such videos and used quicktime plugin for browser until found that new cpg was released with this great plugin.
So what can I say about it. First - I add new video, this plugin converts it to flv format, makes thumb JPGs. Thats all ok. But when you are trying to add some more new videos to the same album - cpg as always select by default new files you have uploaded by ftp (i think it uses mySQL to compare what new files were added to directory). So here is the problem - cpg selects by default all FLV files as they are new one in that dir. So you have to uncheck all checkboxes with flv files, because you don't add them. These files were generated by plugin. As the solution I think plugin must register all generated FLVs in DataBase tables.
Second problem I faced with plugin that command line in main script where main video encoding runs doesn't work for me. And it fails here:
-acodec mp3
I have gentoo and emerged ffmpeg with mp3 support:
# emerge -pv ffmpeg
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] media-video/ffmpeg.... USE="bzip2 encode jpeg2k mmx mp3 network threads x264 xvid zlib
So I emerged next lame
# emerge -pv lame
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild R ] media-sound/lame.....
and change the audio codec like this:
-acodec libmp3lame
and it works for me fine. May be it helps someone.
One more thinf I found in plugin (think it's a bug!). It generates normal and thumb preview for images BUT when it generate JW player object to insert it's HTML into cpg output it uses !thumb! images but NOT !normal!
So when you load your vide and JW player opens it's preview (screenshot from your video) it uses small image and it looks so ugly! So here is the line I corrected in your plugin:
/**
* Function to return html required for displaying the flv palyer
*/
function video2flash_ffmpeg_file_data($pic_data) {
global $CONFIG;
.................
//$thumb = $CONFIG['fullpath'] . $pic_data['filepath'] . $CONFIG['thumb_pfx'] . $matches[1].".jpg";
$normal = $CONFIG['fullpath'] . $pic_data['filepath'] . $CONFIG['normal_pfx'] . $matches[1].".jpg";
$flashvars = '';
if (file_exists($normal)) {
$flashvars = '&image=' . $CONFIG['ecards_more_pic_target'] . $normal;
}
because we need normal image size. Normal in this plugin as i see is the size of JW player object but not the original video width.
One more thing. ffmpeg by default generates FLVs with very poor quality. To fix this problem I added this param - "sameq" to CMD line:
$cmd = "{$CONFIG['video2flash_ffmpeg_ffmpeg_path']} -y -i $src_file -acodec libmp3lame -ar 22050 -f flv -sameq $ff_dest_file";
It helps to make FLVs with much more better quality (some thing near to it's original) but with a bit bigger size of FLV files.
(note: please be careful with your OS. Look at this line
if (eregi("win", $_ENV['OS'])) {
and choose you CMD line)
And one moe thing but very important. As I already said there were a lot of MOV files. So There was a problem for me to convert that files to FLVs, because this plugin only runs on video adding action. So I had to learn some bash basics and wrote this little script to convert all my MOVs to FLVs.
#!/bin/bash
#Script just put commands into file that can be used as a shell programm to encode video and make ScreenShots
#Done like this because ffmpeg always breaks the while cycle
ConvertTaskFileName=~/ConvertTask.sh
if [[ ! -f $ConvertTaskFileName ]]; then
echo "#!/bin/bash" > $ConvertTaskFileName
chmod u+x $ConvertTaskFileName
fi
FullFileName=$1
#Get File name, dir and extension (in this version we don't need extension)
dir=$(dirname $FullFileName)
filename=$(basename $FullFileName)
extension=${filename##*.}
filename=${filename%.*}
#Encode to Flv our video files
echo "ffmpeg -y -i ${FullFileName} -acodec libmp3lame -ar 22050 -f flv -sameq ${dir}/${filename}.flv" >> $ConvertTaskFileName
#make a thumb ScreenShot. In my case it's 100x75 pixels
echo "ffmpeg -i ${dir}/${filename}.flv -an -ss 00:00:07 -r 1 -vframes 1 -s 100x75 -y ${dir}/thumb_${filename}.jpg" >> $ConvertTaskFileName
#make normal screenShots. In my case it's the same as video width x height so I don't need to convert it to JW Player's size
echo "ffmpeg -i ${dir}/${filename}.flv -an -ss 00:00:07 -r 1 -vframes 1 -y ${dir}/normal_${filename}.jpg" >> $ConvertTaskFileName
Then go to your album dir and run this script as
# find $PWD/upload/ \( -name "*.MOV" -o -name "*.mov" \) -type f -exec ~/encode.sh {} \;
It finds all MOV and mov files (as I said my camera makes only MOVs).
but you can use any vide extensions as you want (I think this will work):
# find $PWD/upload/ \( -name "*.ext1" -o -name "*.ext2" -o -name "*.ext3" \) -type f -exec ~/encode.sh {} \;
Then go to home dir and run the programm that was generated by my script:
# ./ConvertTask.sh
Note: I advise you to run it in screen, especially if you have a lot of video files and use ssh to connect to your server.
I am not an expert in such programming stuff but that worked out in my case.
And it will be very great if such feature as encoding old video files will be as a part of this plugin in the future.
I hope that it my post will help someone.
Thanks a lot. Thats all for now.
