set image width only?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

set image width only?

lovelove
Hi. Sorry for being a newbie, but I have looked everywhere in http://ffmpeg.org/ffmpeg-doc.html and only found -s WxH, but how can I set the width e.g. to 400 without specifying the height (which FFmpeg should determine itself based on the aspect ratio)? (I'm outputting still images). Many thanks.
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Mark Himsley
On 07/09/2011 21:23, lovelove wrote:
> Hi. Sorry for being a newbie, but I have looked everywhere in
> http://ffmpeg.org/ffmpeg-doc.html and only found *-s WxH*, but how can I
> /set the width/ e.g. to 400 /*without specifying the height*/ (which FFmpeg
> should determine itself based on the aspect ratio)? (I'm outputting still
> images). Many thanks.

You missed this part of ffmpeg-doc.html

http://ffmpeg.org/ffmpeg-doc.html#SEC89

--
Mark
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Stefano Sabatini
On date Wednesday 2011-09-07 21:29:02 +0100, Mark Himsley encoded:

> On 07/09/2011 21:23, lovelove wrote:
> >Hi. Sorry for being a newbie, but I have looked everywhere in
> >http://ffmpeg.org/ffmpeg-doc.html and only found *-s WxH*, but how can I
> >/set the width/ e.g. to 400 /*without specifying the height*/ (which FFmpeg
> >should determine itself based on the aspect ratio)? (I'm outputting still
> >images). Many thanks.
>
> You missed this part of ffmpeg-doc.html
>
> http://ffmpeg.org/ffmpeg-doc.html#SEC89

Better to read instead:
http://ffmpeg.org/ffmpeg.html

ffmpeg-doc.html is not updated since ages (and maybe should be removed
from the web-server).
--
ffmpeg-user random tip #0
Please try to use a reasonably recent version of ffmpeg before asking
questions to ffmpeg-user: older versions aren't supported here!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Lou Logan
On Thu, 8 Sep 2011 01:23:01 +0200
Stefano Sabatini <[hidden email]> wrote:

> On date Wednesday 2011-09-07 21:29:02 +0100, Mark Himsley encoded:
> > On 07/09/2011 21:23, lovelove wrote:
> > >Hi. Sorry for being a newbie, but I have looked everywhere in
> > >http://ffmpeg.org/ffmpeg-doc.html and only found *-s WxH*, but how
> > >can I /set the width/ e.g. to 400 /*without specifying the
> > >height*/ (which FFmpeg should determine itself based on the aspect
> > >ratio)? (I'm outputting still images). Many thanks.
> >
> > You missed this part of ffmpeg-doc.html
> >
> > http://ffmpeg.org/ffmpeg-doc.html#SEC89
>
> Better to read instead:
> http://ffmpeg.org/ffmpeg.html

More specifically see the scale filter information:
http://ffmpeg.org/ffmpeg.html#SEC155

Which currently states:
"If the value for width or height is -1, the scale filter will use, for
the respective output size, a value that maintains the aspect ratio of
the input image."
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

lovelove
In reply to this post by Stefano Sabatini
Stefano Sabatini wrote
Better to read instead:
http://ffmpeg.org/ffmpeg.html

ffmpeg-doc.html is not updated since ages (and maybe should be removed
from the web-server).
Thank you all, it works now.

Although I don't really understand the difference between
-s 400x300
and
-vf "scale=400:300"

*IF* there is no functional difference, then one parameter should be discontinued, because it is IMO bad practice to have redundant (and thus confusing) parameters.
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Mark Himsley
In reply to this post by Stefano Sabatini
On 08/09/11 00:23, Stefano Sabatini wrote:

> ffmpeg-doc.html is not updated since ages (and maybe should be removed
> from the web-server).

Or perhaps a redirect...

--
Mark
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

lovelove
In reply to this post by lovelove
lovelove wrote
I don't really understand the difference between
-s 400x300
and
-vf "scale=400:300"
Aside from the difference from the -s parameter being unclear,
the -vf scale parameter you suggested to me somehow interferes with key frame detection.

This extracts all key frames of a video as single images:
ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 -f image2 outputfile.AVI-%03d.tif*

But when adding -vf scale, ALL images are extracted, not just keyframes:
ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync 0 -vf "scale=400:-1" -f image2 outputfile.AVI-%03d.tif*

What's going wrong? thank you.
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Tim Nicholson
On 09/09/11 03:35, lovelove wrote:

>
> lovelove wrote:
>>
>> I don't really understand the difference between
>> *-s 400x300*
>> and
>> *-vf "scale=400:300"*
>>
>
> Aside from the difference from the -s parameter being unclear,
> the -vf scale parameter you suggested to me somehow interferes with key
> frame detection.
>
> This extracts all key frames of a video as single images:
> *ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync
> 0 -f image2 outputfile.AVI-%03d.tif**
>
> But when adding -vf scale, *ALL* images are extracted, not just keyframes:
> *ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)" -vsync
> 0 -vf "scale=400:-1" -f image2 outputfile.AVI-%03d.tif**
>
> What's going wrong? thank you.
>

At a guess, because you haven't ordered the filters the resize is
happening first and therefore all frames become keyframes...

You need to take the ouptut of the select and feed it into the scale...

Try:-

ffmpeg.exe -i inputfile.avi -vsync 0 -vf
"select=eq(pict_type\,PICT_TYPE_I) [select]; [select] scale=400:-1
[out]" -f image2 outputfile.AVI-%03d.tif


--
Tim

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                       
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

Tim Nicholson
On 09/09/11 07:20, Tim Nicholson wrote:

> On 09/09/11 03:35, lovelove wrote:
>>
>> lovelove wrote:
>>>
>>> I don't really understand the difference between
>>> *-s 400x300*
>>> and
>>> *-vf "scale=400:300"*
>>>
>>
>> Aside from the difference from the -s parameter being unclear,
>> the -vf scale parameter you suggested to me somehow interferes with key
>> frame detection.
>>
>> This extracts all key frames of a video as single images:
>> *ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)"
>> -vsync
>> 0 -f image2 outputfile.AVI-%03d.tif**
>>
>> But when adding -vf scale, *ALL* images are extracted, not just
>> keyframes:
>> *ffmpeg.exe -i inputfile.avi -vf select="eq(pict_type\,PICT_TYPE_I)"
>> -vsync
>> 0 -vf "scale=400:-1" -f image2 outputfile.AVI-%03d.tif**
>>
>> What's going wrong? thank you.
>>
>
> At a guess, because you haven't ordered the filters the resize is
> happening first and therefore all frames become keyframes...
>
> You need to take the ouptut of the select and feed it into the scale...
>
> Try:-
>
> ffmpeg.exe -i inputfile.avi -vsync 0 -vf
> "select=eq(pict_type\,PICT_TYPE_I) [select]; [select] scale=400:-1
> [out]" -f image2 outputfile.AVI-%03d.tif
>
>

And before someone else points it out, this can be simplified to:-

ffmpeg.exe -i inputfile.avi -vsync 0 -vf
"select=eq(pict_type\,PICT_TYPE_I), scale=400:-1" -f image2
outputfile.AVI-%03d.tif

Read up on http://ffmpeg.org/ffmpeg.html#SEC113 about the filtergraph
syntax.

--
Tim

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                       
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: set image width only?

lovelove
Tim Nicholson wrote
ffmpeg.exe -i inputfile.avi -vsync 0 -vf
"select=eq(pict_type\,PICT_TYPE_I), scale=400:-1" -f image2
outputfile.AVI-%03d.tif
just to confirm that this works and to thank you.

What I find extremely curious, is that this command doesn't generate a console output with repeating lines. The output is as follows:

frame=    1 fps=  0 q=0.0 size=      -0kB time=00:00:00.04 bitrate=  -4.4kbits/s
frame=    2 fps=  0 q=0.0 size=      -0kB time=00:00:03.04 bitrate=  -0.1kbits/s
frame=    3 fps=  2 q=0.0 size=      -0kB time=00:00:06.04 bitrate=  -0.0kbits/s
frame=    4 fps=  2 q=0.0 size=      -0kB time=00:00:09.04 bitrate=  -0.0kbits/s
frame=    5 fps=  2 q=0.0 size=      -0kB time=00:00:12.04 bitrate=  -0.0kbits/s
frame=    6 fps=  2 q=0.0 size=      -0kB time=00:00:15.04 bitrate=  -0.0kbits/s
frame=    7 fps=  2 q=0.0 size=      -0kB time=00:00:18.04 bitrate=  -0.0kbits/s
frame=    8 fps=  2 q=0.0 size=      -0kB time=00:00:21.04 bitrate=  -0.0kbits/s
frame=    9 fps=  2 q=0.0 size=      -0kB time=00:00:24.04 bitrate=  -0.0kbits/s
frame=   10 fps=  2 q=0.0 size=      -0kB time=00:00:27.04 bitrate=  -0.0kbits/s
frame=   11 fps=  2 q=0.0 size=      -0kB time=00:00:30.04 bitrate=  -0.0kbits/s
[...]

whereas

ffmpeg.exe -i inputfile.flv -r 0.1 -f image2 output-%03d.jpeg

generates repeating lines in console and is much slower (hence my fear that each output image is overwritten several times, thus slowing down the process). Is there something wrong with the command?

frame=    2 fps=  0 q=2.7 size=      -0kB time=00:00:20.00 bitrate=  -0.0kbits/s
frame=    2 fps=  0 q=2.7 size=      -0kB time=00:00:20.00 bitrate=  -0.0kbits/s
frame=    2 fps=  1 q=2.7 size=      -0kB time=00:00:20.00 bitrate=  -0.0kbits/s
frame=    2 fps=  1 q=2.7 size=      -0kB time=00:00:20.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    3 fps=  1 q=1.6 size=      -0kB time=00:00:30.00 bitrate=  -0.0kbits/s
frame=    4 fps=  1 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    4 fps=  1 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    4 fps=  1 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    4 fps=  1 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    4 fps=  1 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    4 fps=  0 q=1.6 size=      -0kB time=00:00:40.00 bitrate=  -0.0kbits/s
frame=    5 fps=  1 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s
frame=    5 fps=  1 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s
frame=    5 fps=  1 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s
frame=    5 fps=  0 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s
frame=    5 fps=  0 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s
frame=    5 fps=  0 q=1.6 size=      -0kB time=00:00:50.00 bitrate=  -0.0kbits/s