convert from avi and mp4 to yuv

Tim Müller tim at centricular.com
Tue Mar 25 03:13:38 PDT 2014


On Tue, 2014-03-25 at 01:48 -0700, Dudi.r wrote:

Hi,

> is there a way to convert avi and mp4 files to yuv with gstreamer? I will be
> happy for example..
> 
> maybe with other program? I found programs that convert from yuv...

Converting to YUV = Decoding in most cases. That can easily be done with
GStreamer. The question then is how do you want to store those raw YUV
frames? Just dumping them to a file is not a good idea, you should put
them into a container of some sort, e.g.:

gst-launch-1.0 -v uridecodebin uri=file:///path/to/file.mp4 name=d \
   d. ! video/x-raw ! videoconvert ! y4menc ! filesink location=file.y4m

This will output just raw yuv frames, but if you do that, the file can't
be played back easily, because players can't know what the format is:

gst-launch-1.0 -v uridecodebin uri=file:///path/to/file.mp4 name=d \
   d. ! video/x-raw ! filesink location=file.yuv

In an application if you need raw yuv frames in a particular format, do
something like this:

gst-launch-1.0 -v uridecodebin uri=file:///path/to/file.mp4 name=d \
   d. ! videoconvert ! appsink caps='video/x-raw,format=(string)I420'

and then you can grab the frames from appsink.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com



More information about the gstreamer-devel mailing list