<div><br></div><div><div><br></div></div>
<p style="color: #A0A0A8;">On Saturday, June 9, 2012 at 7:22 PM, Rémi Denis-Courmont wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div><div>Le samedi 9 juin 2012 14:05:08 Seven Du, vous avez écrit :</div><blockquote type="cite"><div><div>I'm not to VLC, I'm trying to get video data via callbacks in the following</div><div>code</div><div><br></div><div><br></div><div>libvlc_video_set_format(context->mp, "YUYV", 352, 288, 288 * 2);</div></div></blockquote><div><br></div><div>That can't work. YUYV a.k.a. YUY2 is a form of packed YUV 4:2:2. In fact, the </div><div>name comes from the packing order (Y1, U, Y2, V). Each pixel occupies two </div><div>bytes. Thus the pitch must be (at least) double the pixel width.</div><div><br></div><div>Furthermore, some code paths assume each lines are aligned on a 16 bytes </div><div>memory boundary and the number of lines is even.</div><div><br></div><blockquote type="cite"><div><div>libvlc_video_set_callbacks(context->mp, vlc_video_lock_callback,</div><div>vlc_video_unlock_callback, vlc_video_display_callback, context);</div><div><br></div><div><br></div><div>I want to use a buffer to get all the decoded or raw data on opening a mp4</div><div>file with H264 video and AAC audio, and I can get audio data fine, but</div><div>with video, what the buffer size should be set in the lock callback? </div><div>Someone told me 352 * 288 * 1.5 for YUYV, it that true?</div></div></blockquote><div><br></div><div>By definition of the pitch, the buffers must be (at least) as large as product </div><div>of the line pitch with the pixel height, so 352 * 2 * 288.</div><div><br></div><blockquote type="cite"><div><div>And I also want to get raw H264 video data without decode, so is it</div><div>possible to replace the "YUYV" param to sth. like "RAW" ?</div></div></blockquote><div><br></div><div>You need to use the libvlc_video_set_format_callbacks() to preserve the chroma </div><div>and/or the resolution. AVC is usually decoded to I420, but not always. And, in </div><div>any case, libvlc_video_set_callbacks() cannot deal with I420 well since I420 </div><div>has multiple planes of different sizes.</div><div><br></div><blockquote type="cite"><div><div>Or I guess it's</div><div>not hard to make a module that just copy the raw data to the buffer like</div><div>the "YUYV" module does, so question is - which module is actually decoding</div><div>"YUYV" ?</div></div></blockquote><div><br></div><div>YUYV is raw. You cannot "decode" YUYV.</div></div></div></span></blockquote><div>Rémi, Thanks for your input.</div><div><br></div><div>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?</div><div><br></div><div><br></div><div>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 <a href="http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html">http://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html</a> obviousely mp4 manipulation functions is not listed. Is there any easy to use fuctions and docs like libmp4v2 does?</div><div><br></div><div><br></div><div><br></div><div>Thanks again.</div><div><br></div><div>Seven.</div><div><br></div><div> </div><blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;"><span><div><div><div><br></div><div>-- </div><div>Rémi Denis-Courmont</div><div><a href="http://www.remlab.net">http://www.remlab.net</a>/</div><div><a href="http://fi.linkedin.com/in/remidenis">http://fi.linkedin.com/in/remidenis</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>