- From: Davy Van Deursen <Davy.VanDeursen@ugent.be>
- Date: Wed, 25 Mar 2009 17:14:20 +0100
- To: "'Jack Jansen'" <Jack.Jansen@cwi.nl>
- Cc: "'Media Fragment'" <public-media-fragment@w3.org>
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 Wednesday, 25 March 2009 16:29:01 UTC