Detecting the size of a video before encoding it...

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

Detecting the size of a video before encoding it...

Ferran Gil
Hi all,
I'm encoding lots of videos for a website, using Drupal, and I'm encoding
each video to the original resolution (then, the flash player fits the
video...)

The problem is that I want to use the -s param just when the original video
size is, lets say, 1280 pixels, but not when it's 320x240....

The idea is to just change the resolution for the really big videos, like
limiting the video size to 848 or 720 px...

Any suggestion will be welcomed!
Thanks

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

Re: Detecting the size of a video before encoding it...

The Wanderer-2
Ferran Gil wrote:

> Hi all, I'm encoding lots of videos for a website, using Drupal, and
> I'm encoding each video to the original resolution (then, the flash
> player fits the video...)
>
> The problem is that I want to use the -s param just when the original
> video size is, lets say, 1280 pixels, but not when it's 320x240....
>
> The idea is to just change the resolution for the really big videos,
> like limiting the video size to 848 or 720 px...

As far as I remember, FFmpeg does not support this directly. (If I'm
wrong, someone else will quite certainly point the fact out.) This sort
of conditional logic does not necessarily belong in FFmpeg, either, IMO.

What I would do in a case like this is write an FFmpeg wrapper, which
runs e.g. 'ffmpeg -i filename' to get the resolution and then chooses
whether or not to use the '-s' parameter based on that resolution.

Alternately, instead of using the FFmpeg command-line program you could
write an encoding program of your own using libav* and put the decision
logic in that program. This is, however, probably more effort than is
justified.

--
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

Secrecy is the beginning of tyranny.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Detecting the size of a video before encoding it...

Ferran Gil
Mmmh...
"ffmpeg -i video" could work!
I just need to get that values and run ffmpeg with or without -s.
That was exactly my idea, so I'll look into the wrapper..
Thanks!


On Dec 21, 2007 12:28 PM, The Wanderer <[hidden email]> wrote:

> Ferran Gil wrote:
>
> > Hi all, I'm encoding lots of videos for a website, using Drupal, and
> > I'm encoding each video to the original resolution (then, the flash
> > player fits the video...)
> >
> > The problem is that I want to use the -s param just when the original
> > video size is, lets say, 1280 pixels, but not when it's 320x240....
> >
> > The idea is to just change the resolution for the really big videos,
> > like limiting the video size to 848 or 720 px...
>
> As far as I remember, FFmpeg does not support this directly. (If I'm
> wrong, someone else will quite certainly point the fact out.) This sort
> of conditional logic does not necessarily belong in FFmpeg, either, IMO.
>
> What I would do in a case like this is write an FFmpeg wrapper, which
> runs e.g. 'ffmpeg -i filename' to get the resolution and then chooses
> whether or not to use the '-s' parameter based on that resolution.
>
> Alternately, instead of using the FFmpeg command-line program you could
> write an encoding program of your own using libav* and put the decision
> logic in that program. This is, however, probably more effort than is
> justified.
>
> --
>       The Wanderer
>
> Warning: Simply because I argue an issue does not mean I agree with any
> side of it.
>
> Secrecy is the beginning of tyranny.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
>



--
Verás, el mundo se divide en dos categorías, los que tienen revolver
cargado, y los que cavan. Tú, cavas.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Detecting the size of a video before encoding it...

Michel Bardiaux-2
Ferran Gil a écrit :
> Mmmh...
> "ffmpeg -i video" could work!

Top-posting, however, is a habit you should loose ASAP...

> I just need to get that values and run ffmpeg with or without -s.
> That was exactly my idea, so I'll look into the wrapper..
> Thanks!
>
>
> On Dec 21, 2007 12:28 PM, The Wanderer <[hidden email]> wrote:
>
>> Ferran Gil wrote:
>>
>>> Hi all, I'm encoding lots of videos for a website, using Drupal, and
>>> I'm encoding each video to the original resolution (then, the flash
>>> player fits the video...)
>>>
>>> The problem is that I want to use the -s param just when the original
>>> video size is, lets say, 1280 pixels, but not when it's 320x240....
>>>
>>> The idea is to just change the resolution for the really big videos,
>>> like limiting the video size to 848 or 720 px...
>> As far as I remember, FFmpeg does not support this directly. (If I'm
>> wrong, someone else will quite certainly point the fact out.) This sort
>> of conditional logic does not necessarily belong in FFmpeg, either, IMO.
>>
>> What I would do in a case like this is write an FFmpeg wrapper, which
>> runs e.g. 'ffmpeg -i filename' to get the resolution and then chooses
>> whether or not to use the '-s' parameter based on that resolution.
>>
>> Alternately, instead of using the FFmpeg command-line program you could
>> write an encoding program of your own using libav* and put the decision
>> logic in that program. This is, however, probably more effort than is
>> justified.
>>
>> --
>>       The Wanderer


--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[hidden email]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Detecting the size of a video before encoding it...

Ferran Gil
Thank you.
Will do it.
ferran

On Dec 21, 2007 12:49 PM, Michel Bardiaux <[hidden email]> wrote:

> Ferran Gil a écrit :
> > Mmmh...
> > "ffmpeg -i video" could work!
>
> Top-posting, however, is a habit you should loose ASAP...
>
> > I just need to get that values and run ffmpeg with or without -s.
> > That was exactly my idea, so I'll look into the wrapper..
> > Thanks!
> >
> >
> > On Dec 21, 2007 12:28 PM, The Wanderer <[hidden email]>
> wrote:
> >
> >> Ferran Gil wrote:
> >>
> >>> Hi all, I'm encoding lots of videos for a website, using Drupal, and
> >>> I'm encoding each video to the original resolution (then, the flash
> >>> player fits the video...)
> >>>
> >>> The problem is that I want to use the -s param just when the original
> >>> video size is, lets say, 1280 pixels, but not when it's 320x240....
> >>>
> >>> The idea is to just change the resolution for the really big videos,
> >>> like limiting the video size to 848 or 720 px...
> >> As far as I remember, FFmpeg does not support this directly. (If I'm
> >> wrong, someone else will quite certainly point the fact out.) This sort
> >> of conditional logic does not necessarily belong in FFmpeg, either,
> IMO.
> >>
> >> What I would do in a case like this is write an FFmpeg wrapper, which
> >> runs e.g. 'ffmpeg -i filename' to get the resolution and then chooses
> >> whether or not to use the '-s' parameter based on that resolution.
> >>
> >> Alternately, instead of using the FFmpeg command-line program you could
> >> write an encoding program of your own using libav* and put the decision
> >> logic in that program. This is, however, probably more effort than is
> >> justified.
> >>
> >> --
> >>       The Wanderer
>
>
> --
> Michel Bardiaux
> R&D Director
> T +32 [0] 2 790 29 41
> F +32 [0] 2 790 29 02
> E mailto:[hidden email]
>
> Mediaxim NV/SA
> Vorstlaan 191 Boulevard du Souverain
> Brussel 1160 Bruxelles
> http://www.mediaxim.com/
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
>



--
Verás, el mundo se divide en dos categorías, los que tienen revolver
cargado, y los que cavan. Tú, cavas.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: Detecting the size of a video before encoding it...

Michel Bardiaux-2
Ferran Gil a écrit :
> Thank you.
> Will do it.
> ferran

Do it *NOW*, *BEFORE* posting anything or replying to anything.

>
> On Dec 21, 2007 12:49 PM, Michel Bardiaux <[hidden email]> wrote:
>
>> Ferran Gil a écrit :
>>> Mmmh...
>>> "ffmpeg -i video" could work!
>> Top-posting, however, is a habit you should loose ASAP...
>>
>>> I just need to get that values and run ffmpeg with or without -s.
>>> That was exactly my idea, so I'll look into the wrapper..
>>> Thanks!
>>>
>>>
>>> On Dec 21, 2007 12:28 PM, The Wanderer <[hidden email]>
>> wrote:
>>>> Ferran Gil wrote:
>>>>
>>>>> Hi all, I'm encoding lots of videos for a website, using Drupal, and
>>>>> I'm encoding each video to the original resolution (then, the flash
>>>>> player fits the video...)
>>>>>
>>>>> The problem is that I want to use the -s param just when the original
>>>>> video size is, lets say, 1280 pixels, but not when it's 320x240....
>>>>>
>>>>> The idea is to just change the resolution for the really big videos,
>>>>> like limiting the video size to 848 or 720 px...
>>>> As far as I remember, FFmpeg does not support this directly. (If I'm
>>>> wrong, someone else will quite certainly point the fact out.) This sort
>>>> of conditional logic does not necessarily belong in FFmpeg, either,
>> IMO.
>>>> What I would do in a case like this is write an FFmpeg wrapper, which
>>>> runs e.g. 'ffmpeg -i filename' to get the resolution and then chooses
>>>> whether or not to use the '-s' parameter based on that resolution.
>>>>
>>>> Alternately, instead of using the FFmpeg command-line program you could
>>>> write an encoding program of your own using libav* and put the decision
>>>> logic in that program. This is, however, probably more effort than is
>>>> justified.
>>>>
>>>> --
>>>>       The Wanderer
>>
>> --
>> Michel Bardiaux
>> R&D Director
>> T +32 [0] 2 790 29 41
>> F +32 [0] 2 790 29 02
>> E mailto:[hidden email]
>>
>> Mediaxim NV/SA
>> Vorstlaan 191 Boulevard du Souverain
>> Brussel 1160 Bruxelles
>> http://www.mediaxim.com/
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
>>
>
>
>


--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:[hidden email]

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user