[vlc-devel] Chroma question on geting raw video data

Seven Du dujinfang at gmail.com
Sat Jun 9 13:53:35 CEST 2012




On Saturday, June 9, 2012 at 7:22 PM, Rémi Denis-Courmont wrote:

> Le samedi 9 juin 2012 14:05:08 Seven Du, vous avez écrit :
> > I'm not to VLC, I'm trying to get video data via callbacks in the following
> > code
> >  
> >  
> > libvlc_video_set_format(context->mp, "YUYV", 352, 288, 288 * 2);
>  
> That can't work. YUYV a.k.a. YUY2 is a form of packed YUV 4:2:2. In fact, the  
> name comes from the packing order (Y1, U, Y2, V). Each pixel occupies two  
> bytes. Thus the pitch must be (at least) double the pixel width.
>  
> Furthermore, some code paths assume each lines are aligned on a 16 bytes  
> memory boundary and the number of lines is even.
>  
> > libvlc_video_set_callbacks(context->mp, vlc_video_lock_callback,
> > vlc_video_unlock_callback, vlc_video_display_callback, context);
> >  
> >  
> > I want to use a buffer to get all the decoded or raw data on opening a mp4
> > file with H264 video and AAC audio, and I can get audio data fine, but
> > with video, what the buffer size should be set in the lock callback?  
> > Someone told me 352 * 288 * 1.5 for YUYV, it that true?
> >  
>  
>  
> By definition of the pitch, the buffers must be (at least) as large as product  
> of the line pitch with the pixel height, so 352 * 2 * 288.
>  
> > And I also want to get raw H264 video data without decode, so is it
> > possible to replace the "YUYV" param to sth. like "RAW" ?
> >  
>  
>  
> You need to use the libvlc_video_set_format_callbacks() to preserve the chroma  
> and/or the resolution. AVC is usually decoded to I420, but not always. And, in  
> any case, libvlc_video_set_callbacks() cannot deal with I420 well since I420  
> has multiple planes of different sizes.
>  
> > Or I guess it's
> > not hard to make a module that just copy the raw data to the buffer like
> > the "YUYV" module does, so question is - which module is actually decoding
> > "YUYV" ?
> >  
>  
>  
> YUYV is raw. You cannot "decode" YUYV.
Rémi, Thanks for your input.

I said raw I means the original H264 NALU, I'm trying to get them and send out to other ip phones directly via RTP. I will look the libvlc_video_set_format_callbacks(). Could you highlight me more details on this?


And also here's another question, If I want to mux H264 videos and  AAC audios into a mp4 file, is it possible to use libvlc? I think it could as VLC has the function save to mp4. I looked http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html obviousely mp4 manipulation functions is not listed. Is there any easy to use fuctions and docs like libmp4v2 does?



Thanks again.

Seven.

  
>  
> --  
> Rémi Denis-Courmont
> http://www.remlab.net/
> http://fi.linkedin.com/in/remidenis
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20120609/dcd1f747/attachment.html>


More information about the vlc-devel mailing list