W3C home > Mailing lists > Public > public-media-fragment@w3.org > March 2009

Re: Action 53 - Check whether ffmpeg can be used from clipping and cropping

From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
Date: Sat, 28 Mar 2009 08:07:55 +1100
Message-ID: <2c0e02830903271407o689875efyf576e61dbbe12c7f@mail.gmail.com>
To: Davy Van Deursen <Davy.VanDeursen@ugent.be>
Cc: Jack Jansen <Jack.Jansen@cwi.nl>, Media Fragment <public-media-fragment@w3.org>
On Sat, Mar 28, 2009 at 8:07 AM, Silvia Pfeiffer
<silviapfeiffer1@gmail.com> wrote:
> To get a quick and dirty implementation, ffmpeg is indeed useful. It
> will demonstrate some things of what we discussed.
>
> I agree with Davy: I don't think ffmpeg will do fragmented versions
> from the original file, but I expect it to rather create transcoded
> versions from it. This will be a problem when we get to caching, since
> there will be very little if any overlap between the original file and
> the newly created one which claims to be a fragment of the original
> one. I'm not even sure it will do the right thing for Ogg even though
> Ogg has clear specifications on how to do so (in the temporal domain).
>
> Jack: did you check whether ffmpeg did indeed create fragmented
> versions of the original file or a fully trascoded version for each of
> the examples?

As for tools to help do this: oggz-dump may be a good helper.
S.

>
> Cheers,
> Silvia.
>
> On Thu, Mar 26, 2009 at 3:14 AM, Davy Van Deursen
> <Davy.VanDeursen@ugent.be> wrote:
>> Hi Jack,
>>
>> very interesting! However, other issues/thoughts I can imagine:
>> - spatial cropping is obtained by transcoding the media files, but (lossy)
>> transcoding is not allowed to extract media fragments
>> - is there any transcoding involved in case of temporal cropping? In other
>> words, does ffmpeg look for the closest previous intra coded frame (i.e., no
>> transcoding) or does it create an intra coded frame from the current frame
>> (i.e., transcoding)?
>>
>> Best regards,
>>
>> Davy
>>
>> --
>> Ghent University - IBBT
>> Department of Electronics and Information Systems Multimedia Lab
>> URL: http://multimedialab.elis.ugent.be
>>
>>>-----Original Message-----
>>>From: public-media-fragment-request@w3.org [mailto:public-media-fragment-
>>>request@w3.org] On Behalf Of Jack Jansen
>>>Sent: woensdag 25 maart 2009 14:58
>>>To: Media Fragment
>>>Subject: Action 53 - Check whether ffmpeg can be used from clipping and
>>>cropping
>>>
>>>I've investigated using ffmpeg for clipping and cropping, and the
>>>results are largely positive.
>>>
>>>Why positive:
>>>- ffmpeg can do temporal clipping
>>>- ffmpeg can do spatial clipping
>>>- ffmpeg can do track selection
>>>- ffmpeg can usually[*] read from a pipe and write to a pipe (on Unix/
>>>Linux/OSX), making it relatively easy to integrate.
>>>
>>>Why largely (as opposed to unqualified positive):
>>>- [*] reading from a pipe does not always work. For me, it worked for
>>>ogg/vorbis/theora but not for mpeg-4/h264/aac.
>>>- the current ffmpeg (built from their subversion repository) appears
>>>to have a glitch: some things I tried gave an error (such as
>>>unsupported conversion or so) but re-running the exact same command
>>>would make it work.
>>>- using this still requires some knowledge of the media file, as can
>>>be seen from the examples below[**]
>>>
>>>Here's how I configured an ffmpeg that could be used for cropping/
>>>clipping both ogg/vorbis/theora and mpeg-4/h264/aac
>>>- Build and install libfaad, libfaac, libx64, libogg, libvorbis,
>>>libtheora (or make sure they're available, or fix the configure below,
>>>at the expense of not being able to do both formats)
>>>- Configure ffmpeg with
>>>       ./configure --enable-gpl --enable-libfaad --enable-libx264 --enable-
>>>libvorbis --enable-libtheora
>>>
>>>Here's how to use it. I'm using the examples from our "existing
>>>technology" wikipage, creating a temporal clip from 12.3s to 21.16s,
>>>and a spatial crop to l=25%, t=25%, w=50%, h=50%:
>>>
>>>Simplest, copy file-to-file, do a temporal clip
>>>       ffmpeg -i fragf2f.ogv -ss 12.3 -t 8.86 fragf2f-clipped.ogv
>>>Same, but using pipes for input/output
>>>       cat fragf2f.ogv | ./ffmpeg -i - -ss 12.3 -t 8.86 -acodec libvorbis
>> -
>>>f ogg - > fragf2f-clipped.ogv
>>>Same, but also do spatial cropping:
>>>       cat fragf2f.ogv | ./ffmpeg -i - -ss 12.3 -t 8.86 -acodec libvorbis -
>>>croptop 120 -cropbottom 120 -cropleft 160 -cropright 160 -f ogg - >
>>>fragf2f-clipped-cropped.ogv
>>>Same, selecting only video stream:
>>>       cat fragf2f.ogv | ./ffmpeg -i - -ss 12.3 -t 8.86 -an -croptop 120 -
>>>cropbottom 120 -cropleft 160 -cropright 160 -f ogg - > fragf2f-clipped-
>>>cropped-vidonly.ogv
>>>
>>>[**] As you can see from these examples, code using ffmpeg to do
>>>clipping and cropping will still need some knowledge of the media. For
>>>example, the -cropXXX parameters cannot be computed from our media
>>>fragment without knowing the native video size. Also, parameters like
>>>"-acodec libvorbis" and "-f ogg" depend on the source/destination
>>>media format. Also,
>>>the video stream selection example depends on knowing there's only one
>>>audio stream and one video stream in the source material.
>>>
>>>There's also an options to specify times in hh:mm:ss format, but I
>>>don't think it's frame-accurate, I haven't investigated fully.
>>>
>>>All in all, if you would want to use this in a production system there
>>>would still be a lot of things that would need more investigation, but
>>>for the proof-of-concept implementations we're thinking of ffmpeg
>>>should be good enough.
>>>--
>>>Jack Jansen, <Jack.Jansen@cwi.nl>, http://www.cwi.nl/~jack
>>>If I can't dance I don't want to be part of your revolution -- Emma
>>>Goldman
>>>
>>>
>>>
>>
>>
>>
>>
>
Received on Friday, 27 March 2009 21:10:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 21 September 2011 12:13:32 GMT