![]() |
anyone know their way around with ffmpeg?
I need a php file that automatically grabs a screen cap of the first second of a flv video, using ffmpeg. I want to be able to use it in LongTail Video's flash player.
Anyone know how to do this? |
this bitch dropped fast
|
Quote:
|
Maybe this php file will work for you:
http://sourceforge.net/project/showf...roup_id=122353 ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...) |
If you're using LongTail I will have to assume you took my advice
|
Quote:
|
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html
For extracting images from a video: ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg This will extract one video frame per second from the video and will output them in files named `foo-001.jpeg', `foo-002.jpeg', etc. Images will be rescaled to fit the new WxH values. If you want to extract just a limited number of frames, you can use the above command in combination with the -vframes or -t option, or in combination with -ss to start extracting from a certain point in time. |
Google is your friend.
|
prob only like 5 lines of code
|
Quote:
|
<?php
echo exec("/usr/local/bin/ffmpeg -i /home/account/public_html/video/video.flv -an -ss 1 -t 00:00:01 -r 1 -y -s qcif -f mjpeg /home/account/public_html/snapshot/snapshot.jpg"); ?> |
i thought this was about the mac program ffmpegX that i use to convert my avi's to mov for my apple tv ;x
|
Quote:
<?php foreach (glob("*.flv") as $filename) { echo exec("/usr/local/bin/ffmpeg -i /home/account/public_html/video/$filename -an -ss 1 -t 00:00:01 -r 1 -y -s qcif -f mjpeg /home/account/public_html/snapshot/$filename.jpg"); } ?> drop the php file in the folder with the flv's p.s. change the paths to your paths of course |
Quote:
|
Quote:
Code:
<? Code:
so.addVariable("image", "imgflv.php?f=video.flv"); |
Quote:
plus you could do it easier via a shell script Code:
for i in *.flv; do ffmpeg -an -y -t 00:00:01 -i "$i" -f image2 "`echo $i |sed 's/.flv$/.jpg/'`" ;done |
this thread gave me a headache but i keep staring at fris' avatar
mmmmmmm |
Quote:
|
Wow, thanks a lot guys! Didn't expect so much input.
I'll test it out asap and let you know if it worked and share the whole solution. |
Ok sweet it works like a charm! Here's a recap of the whole situation & solution for those with the same problem:
Since LongTail's FLV player does not automaticallly create a preview on the actual video page I had two choices, either enable autoplay so no preview is required, or use a little ffmpeg php script to make a screen cap of the video. The second seemed like a better option to save a lot of bandwidth (it's still user friendly since he only has to click a big ass play button to start the video). I installed FFMPEG and FFMPEG-PHP (not sure if I needed both but whatever they're both on my server here now. Here are the tutorials for Linux: FFMPEG tutorial: http://www.mysql-apache-php.com/ffmpeg-install.htm FFMPEG-PHP tutorial: http://ffmpeg-php.sourceforge.net/ I made a PHP file (thanks Fris & Killswitch) called imgpreview.php and added this code to it. Code:
<? Thanks again guys. |
Anytime ;)
|
LoL LoL
|
Code:
function grabScreen($clip, $thumb, $dimensions) { |
Smokey hitted it...
|
Quote:
|
Quote:
Code:
<? |
guess i misunderstood the question, sorry i attempted to help you. i'll just keep me trap shut next time :winkwink:
|
Quote:
Quote:
|
All times are GMT -7. The time now is 02:31 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123