Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 05-19-2009, 01:36 PM   #1
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
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?
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 01:59 PM   #2
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
this bitch dropped fast
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:09 PM   #3
polish_aristocrat
Too lazy to set a custom title
 
Join Date: Jul 2002
Posts: 40,377
Quote:
Originally Posted by JamesK View Post
this bitch dropped fast
that's because only 3.75% of GFY'ers know what you're talking about
__________________
I don't use ICQ anymore.
polish_aristocrat is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:16 PM   #4
stevo
Confirmed User
 
Join Date: Aug 2002
Location: Orlando, Florida
Posts: 2,051
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...)
stevo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:25 PM   #5
HorseShit
Too lazy to set a custom title
 
Join Date: Dec 2004
Posts: 17,513
If you're using LongTail I will have to assume you took my advice
HorseShit is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:28 PM   #6
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
Quote:
Originally Posted by Justin View Post
If you're using LongTail I will have to assume you took my advice
Yep, I knew about the player and used it before but with the AdSolution plugin it really does everything I need it to do
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:28 PM   #7
Tube Ace
So Fucking Banned
 
Industry Role:
Join Date: Nov 2008
Location: with your dream girl
Posts: 4,941
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.
Tube Ace is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 02:32 PM   #8
AdultSoftwareSolutions
Confirmed User
 
AdultSoftwareSolutions's Avatar
 
Join Date: Mar 2009
Posts: 193
Google is your friend.
__________________
Adult Software Solutions (ICQ 559884738)
PHP, MySQL, Flash, Actionscript, Java, Wowza, CMS, Tube, VOD, CRM, Dating, Social Networks, Paysites, TGPs, Directories and more.
If you can think it I can build it.
AdultSoftwareSolutions is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:20 PM   #9
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
prob only like 5 lines of code
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:29 PM   #10
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by stevo View Post
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...)
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:41 PM   #11
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
<?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");
?>
__________________
hatisblack at yahoo.com

Last edited by SmokeyTheBear; 05-19-2009 at 03:43 PM..
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:41 PM   #12
Chris
Too lazy to set a custom title
 
Chris's Avatar
 
Industry Role:
Join Date: May 2003
Location: icq: 71462500 Skype: Jupzchris
Posts: 27,880
i thought this was about the mac program ffmpegX that i use to convert my avi's to mov for my apple tv ;x
__________________
[email protected]
Chris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:49 PM   #13
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by SmokeyTheBear View Post
<?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");
?>
if you want to do every flv in a directory at once try this
<?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
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:51 PM   #14
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by Chris View Post
i thought this was about the mac program ffmpegX that i use to convert my avi's to mov for my apple tv ;x
ffmpegx includes ffmpeg so yes
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:52 PM   #15
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by JamesK View Post
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 is really rough, prob could be done better but.

Code:
<?
$video = $_GET['f'];
$movie = new ffmpeg_movie($video, false);
$frames = $movie->getFrameCount();
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
imagejpeg($im,"$video.jpg");
imagedestroy($im);
header("Content-type:image/jpeg");
readfile("$video.jpg");
?>
then call it via a flashvar

Code:
so.addVariable("image", "imgflv.php?f=video.flv");
you get the idea.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 03:59 PM   #16
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by SmokeyTheBear View Post
if you want to do every flv in a directory at once try this
<?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
he wants it to do it via the flash player, that will do a directory.

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
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 04:02 PM   #17
Chris
Too lazy to set a custom title
 
Chris's Avatar
 
Industry Role:
Join Date: May 2003
Location: icq: 71462500 Skype: Jupzchris
Posts: 27,880
this thread gave me a headache but i keep staring at fris' avatar


mmmmmmm
__________________
[email protected]
Chris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-19-2009, 04:35 PM   #18
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by fris View Post
this is really rough, prob could be done better but.

Code:
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
then call it via a flashvar

Code:
so.addVariable("image", "imgflv.php?f=video.flv");
you get the idea.
I cleaned it up for you.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 01:22 AM   #19
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
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.
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 02:57 AM   #20
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
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:
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
And added image=imgpreview.php?f=videofile.flv to the flashvars. If you're using TubeAce like me, you should replace videofile.flv to {video_file} and you're set!

Thanks again guys.
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 06:35 AM   #21
wizzart
scriptmaster
 
wizzart's Avatar
 
Industry Role:
Join Date: May 2006
Location: Serbia
Posts: 5,237
Anytime ;)
wizzart is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 06:35 AM   #22
wizzart
scriptmaster
 
wizzart's Avatar
 
Industry Role:
Join Date: May 2006
Location: Serbia
Posts: 5,237
LoL LoL
wizzart is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 06:55 AM   #23
nation-x
Confirmed User
 
nation-x's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
Code:
function grabScreen($clip, $thumb, $dimensions) {
    //$dimensions should be in WxH format
    //$thumb should contain the full path to the image you want created
    $screengrab = "/usr/local/bin/ffmpeg -y -i '{$clip}' -f mjpeg -ss 10 -vframes 1 -s {$dimensions} -an '{$thumb}'";
    @system($screengrab);
}

Last edited by nation-x; 05-20-2009 at 06:57 AM..
nation-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 07:04 AM   #24
CaptainHowdy
Too lazy to set a custom title
 
CaptainHowdy's Avatar
 
Industry Role:
Join Date: Dec 2004
Location: Happy in the dark.
Posts: 93,305
Smokey hitted it...
__________________
"Tjeezers.cam wishes you a nice day”
CaptainHowdy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 07:37 AM   #25
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by nation-x View Post
Code:
function grabScreen($clip, $thumb, $dimensions) {
    //$dimensions should be in WxH format
    //$thumb should contain the full path to the image you want created
    $screengrab = "/usr/local/bin/ffmpeg -y -i '{$clip}' -f mjpeg -ss 10 -vframes 1 -s {$dimensions} -an '{$thumb}'";
    @system($screengrab);
}
whats the difference between using ffmpeg executable and the php module?
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 08:08 AM   #26
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by JamesK View Post
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:
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(50);
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
And added image=imgpreview.php?f=videofile.flv to the flashvars. If you're using TubeAce like me, you should replace videofile.flv to {video_file} and you're set!

Thanks again guys.
If you wanna make it more random, say just a random frame from the video, you can do this...

Code:
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(rand(1, getFrameCount());
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-20-2009, 08:34 AM   #27
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
guess i misunderstood the question, sorry i attempted to help you. i'll just keep me trap shut next time
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 05-21-2009, 10:30 AM   #28
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
Quote:
Originally Posted by Killswitch View Post
If you wanna make it more random, say just a random frame from the video, you can do this...

Code:
<?
$movie = new ffmpeg_movie($_GET['f'], false);
$frame = $movie->getFrame(rand(1, getFrameCount());
$im = $frame->toGDImage();
header('Content-type:image/jpeg');
imagejpeg($im);
imagedestroy($im);
?>
Thanks bud, that'll come in handy

Quote:
Originally Posted by SmokeyTheBear View Post
i'll just keep me trap shut next time
Please don't, I love you too
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.