madebyhiro / codem-transcode

Offline video transcoder written in node.js
Other
153 stars 68 forks source link

Generate SPRITE image for thumbnail #61

Closed patademahesh closed 8 years ago

patademahesh commented 8 years ago

Hi,

First of all i would like to say a big Thank You for creating such a wonderful software and donating it to OpenSource community. I have one question, we have such a requirement where we want to generate thumbnail of every 10 seconds and create its sprite image. I know ffmpeg command to do this. Is it possible to do this with CODEM ?

Thanks, Mahesh

tieleman commented 8 years ago

Hi Mahesh,

Could you post an example command you would normally use in ffmpeg?

patademahesh commented 8 years ago

Sure, here is the command:

ffmpeg -threads 8 -ss 10 -i input.mp4 -f image2 -vf "thumbnail=10,scale=120:96,tile=12x10" -pix_fmt yuvj420p -an -vsync 0 -y output-120x69-thumb-%03d.jpg

Thanks, Mahesh

patademahesh commented 8 years ago

I tried to create preset using above command but it creates separate image for each thumb. I think it is because of codem does not supports tile and scale options in thumbnail.. ??

Note: specified output-120x69-thumb-%03d.jpg in output file name.

Thanks, Mahesh

tieleman commented 8 years ago

Hi Mahesh,

It seems to work for me using this command to create a job:

curl -d '{"source_file": "/path/to/input.mp4","destination_file":"/path/to/output-120x69-thumb.jpg","encoder_options": "-ss 10 -threads 8 -f image2 -vf thumbnail=10,scale=120:96,tile=12x10 -pix_fmt yuvj420p -an -vsync 0 -y"}' http://localhost:8080/jobs

You're also using %03d for interpolation, but I don't think filename interpolation is needed here, is it? Anyway, can you verify this works for you?

patademahesh commented 8 years ago

Hi tieleman,

Sure i'll try this way. But the thing is thumbnail=10 is dynamic value, which tells after every n number of frames it should take snaps. We do calculations and decide this. But in codem we can specify after specific seconds we can take snaps(eg. 10 sec). I want to use that feature of codem and create sprite image.

Thanks for your response.

Mahesh

tieleman commented 8 years ago

Ah, that is currently not possible using a thumbnail job. Alternatively, If you need to know details about your input file to calculate the thumbnail parameter for the sprite image you can use a probe job to get file information (this will tell you the frame rate of the input video). Then, if you know the frame rate of your input file (for example 25 fps) you could use thumbnail=250.

patademahesh commented 8 years ago

Ok. I'll do this way only. Thanks for your valuable inputs.

Mahesh