ffmpeg and TIME OFFSET for thumbnail generation in Quicktime Movies

FredP101

Joined: 2006-02-03
Posts: 15
Posted: Sat, 2006-02-04 06:43

I finally got ffmpeg working to generate thumbnails, and like I owuld expect, it uses frame 1 as the thumbnail.

But for reasons too long to describe, I need to use the offset function that I know ffmpeg can use to generate the quicktime from FRAME 12 of all of my quicktimes.

I am using Gallery2, with ffmpeg. Can someone please walk me through how I change the DEFAULT action to always use frame 12 of the movie for the thumbnail.

Thanks

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sat, 2006-02-04 19:26

the thumbpage module gives you a UI to pick a time offset for the thumbnail.
if you just want to change the default behavior you can look at the code in modules/ffmpeg/classes.

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Sun, 2006-02-05 00:38

As far as I can tell, ffmpeg is just being controlled by gallery. So there is no user interface at all the way I am using it. So I assume gallery is sending commands to the app. But I dont know where those would be or how to change the default action.

What file in modules/ffmpeg/classes would I edit to make it happen?

Fred

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Sun, 2006-02-05 00:43

I have found these in the FfmpegToolKit.class file:

if (isset($context['ffmpeg.offset'])) {
array_unshift($args, '-ss', $context['ffmpeg.offset']);
unset($context['ffmpeg.offset']);
}

case 'select-offset':
// Doesn't change file; just remembers offset for future operation..
$context['ffmpeg.offset'] = $parameters[0];
if ($sourceFilename != $destFilename) {

and these in the FfMpegToolKitHelper.class file

if ($supportsOffset) {
$operations['select-offset'] = array(
'params' => array(array('type' => 'float',
'description' => $gallery->i18n('offset in seconds'))),
'description' => $gallery->i18n('Select time offset in movie file'),
'mimeTypes' => $mimeTypes,
'outputMimeType' => null);
}

But I dont know how to edit them or what the syntax is for it to work correctly. I would like Frame 12 to be the thumbnail.....

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2006-02-05 01:34
Quote:
As far as I can tell, ffmpeg is just being controlled by gallery. So there is no user interface at all the way I am using it.

right, that's why i told you the thumbpage module gives you a UI.
(thumbnail tab on "edit movie")

or, just replace

if (isset($context['ffmpeg.offset'])) {
array_unshift($args, '-ss', $context['ffmpeg.offset']);
unset($context['ffmpeg.offset']);
}

with

array_unshift($args, '-ss', '0.2');

to always use a fixed offset (that would be 0.2 seconds).

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Sun, 2006-02-05 21:35

that second bit helps alot THANK YOU! The first part confused me because my gallery in edit movie doesnt have a thumbnail tab. It only has a place in the general tab where you can specify the thumbnail size. but there doesnt seem to be any other interface for thumbnails.

but i will try the hard coded offset now, that will work great!

Thanks again

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2006-02-05 22:07

there is a module called "thumbnail page".. activate it to get a "thumbnail" tab in "edit movie"

:)

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Sun, 2006-02-05 23:56

mindless,

I appreciate all of your help. I added the module, but however there is still no third tab on the edit movie page. I only have a General, and a Movie Size Tab on that page.

??

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-02-06 03:26

don't know what to tell you.. maybe deactivate both thumbpage and ffmpeg and then reactivate both, ffmpeg first.

http://codex.gallery2.org/index.php/Gallery2:Modules:thumbpage

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Thu, 2006-02-09 07:14

As it turns out, it seems my version of ffmpeg doesnt support the -ss option.

I have no idea what to try next.
Fred

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-02-10 18:35

ah, good catch.. can you try a version of ffmpeg that supports it?

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Fri, 2006-02-10 22:37

OK, First hurdle down. now there is a tab in the edit movie window.. My next need is to get it to automatically generate thumbnail from the 12 frame of the video.

Now that it is working do you think the replacement you suggested would work?

Fred

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2006-02-10 22:56

yup

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Wed, 2006-02-15 20:19

Ok great! Everything working. Now the real tricky part!

The code you have me to replace works! Thank you. But how would I do this.

With the offset hard coded like the example above, it always uses that offset even if the user enters a new offset manually from the interface.

I would like to leave the ability to change the thumbnail offset in gallery, but to have a default. So if none is specifified, use a 1.5 offset. But if the user specifies one, then use that one.

Can you help with that?

Thanks!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-02-15 21:33

instead of replacing that block of code from above, just add this after it:
else { array_unshift($args, '-ss', '0.2'); }
now it will use the requested offset and just default to 0.2 if none is given.

 
FredP101

Joined: 2006-02-03
Posts: 15
Posted: Thu, 2006-02-16 05:23

Worked like a dream! Thanks! Mindless, i owe you a case of beer!

Fred

 
mygster

Joined: 2009-05-15
Posts: 1
Posted: Fri, 2009-05-15 08:47

Thanks, works perfect.
http://www.pengeautomaten.dk

 
krasymir

Joined: 2010-05-26
Posts: 5
Posted: Wed, 2010-06-02 07:56

in gallery2\modules\thumbpage\module.inc and gallery2\modules\core\classes\GalleryModule.class
-no if (isset($context['ffmpeg.offset'])) {
array_unshift($args, '-ss', $context['ffmpeg.offset']);
unset($context['ffmpeg.offset']);
}

 
gzbst

Joined: 2010-06-04
Posts: 1
Posted: Fri, 2010-06-04 02:31

But for reasons too long to describe, I need to use the offset function that I know ffmpeg can use to generate the quicktime from FRAME 12 of all of my quicktimes.
discount tiffnay jewelry
I am using Gallery2, with ffmpeg. Can someone please walk me through how I change the DEFAULT action to always use frame 12 of the movie for the thumbnail.
Chanel Bags Online
Thanks
Worked like a dream! Thanks! Mindless, i owe you a case of beer!
polo t shirts