<div dir="ltr">Hi Dolevo Jay,<div><br></div><div><span style="font-family:'times new roman','new york',times,serif;font-size:16px">I have the doc/examples programs compiled and running. I use the program demuxing.c to decode an AVI file. From the source code, it looks it calls its own subroutine decode_packet() to decode the next video or audio packet, and that subroutine calls avcodec_decode_video2()to decode the next frame. Now i want to encode this frames in h264. </span></div>
<div><span style="font-family:'times new roman','new york',times,serif;font-size:16px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Any suggestion is appreciated.</span><br style="font-family:arial,sans-serif;font-size:13px">
<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">Thanks</span><span style="font-family:'times new roman','new york',times,serif;font-size:16px"><br>
</span></div>
<div><font face="times new roman, new york, times, serif" size="3"><br></font></div><div><font face="times new roman, new york, times, serif" size="3"><br></font><div><br></div><div><br></div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/10/16 Dolevo Jay <span dir="ltr"><<a href="mailto:cmst@live.com" target="_blank">cmst@live.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">Hi,<br><br>If your raw file is in yuv 420 format, you can simply read from the file as if you are reading from a text file and push it into the encoder. The important thing here is going to be how many bytes to read but you can calculate it by looking at the resolution information. If your raw file contains RGB frames, you need to convert them first to yuv420 before pushing into encoder. If you need further help, you may send a private email.<br>
<br><div><hr>Date: Wed, 16 Oct 2013 16:28:29 +0200<br>From: <a href="mailto:francesco.damato7@gmail.com" target="_blank">francesco.damato7@gmail.com</a><div><div class="h5"><br>To: <a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a><br>
Subject: Re: [Libav-user] Applied pad on the decoded frame<br><br><div dir="ltr">Hi Dolevo Jay,<div><br></div><div>i have a avi and mp4 file. The avcodec_encode_video2 function takes input raw video data from frame, so i demux my file and i obtain a raw video file; now i want encode it, so how i can open the raw file, read the raw frames and encode them into h264??</div>
<div><br></div><div>Thanks for your help!! </div><div><br></div><div>Regards</div></div><div><br><br><div>2013/10/15 Dolevo Jay <span dir="ltr"><<a href="mailto:cmst@live.com" target="_blank">cmst@live.com</a>></span><br>
<blockquote style="border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><br><br><div>> From: <a href="mailto:bruce@spearmorgan.com" target="_blank">bruce@spearmorgan.com</a><br>> Date: Mon, 14 Oct 2013 15:47:05 -0700<div><br>> To: <a href="mailto:libav-user@ffmpeg.org" target="_blank">libav-user@ffmpeg.org</a><br>
> Subject: Re: [Libav-user] Applied pad on the decoded frame<br>> <br></div><div><div>> On Oct 14, 2013, at 4:46 AM, Dolevo Jay <<a href="mailto:cmst@live.com" target="_blank">cmst@live.com</a>> wrote:<br>
> <br>> > I have encoder and decoder application in separate projects. I use x264 to encode the incoming frames and use libav to decode them. If the frame has a specific resolution like 1366 x 768, the decode frame contains extra black border at the right side of the frame. I have debugged it and realized that the av_pic.linesize[0] is 50 more than the linesize during the encoding. <br>
> > Here is the code:<br>> > <br>> > lengthDec = avcodec_decode_video2(c1, av_pic, &pic, &pkt);<br>> > if (pic)<br>> > {<br>> > avpicture_fill((AVPicture *)rgbFrame, RGBimg, PIX_FMT_RGB32, w, h);<br>
> > sws_scale(ctx, av_pic->data, av_pic->linesize, 0, h, rgbFrame->data, rgbFrame->linesize);<br>> > }<br>> > <br>> > So, in this code, I decode the packet and convert the decoded data into the rgb. <br>
> > Why does the avcodec_decode_video2 returns a padded linesize?<br>> > Could anyone tell me how I can eliminate the black border?<br>> <br>> The actual encoded data has padding, added to make encoding and decoding more efficient. The returned frame has the padding still, since it's more efficient again - just decoding into a buffer without having to copy all the lines.<br>
> <br>> That's very standard. Expect to see that in almost all codecs and frame sizes.<br>> <br>> You need to use the viewable width, not the linesize when scaling.<br>> <br>> Bruce<br>> _______________________________________________<br>
> Libav-user mailing list<br>> <a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>> <a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br><br></div></div>Thanks for your reply. I have described the problem in detail with some pictures here: <a href="http://forum.doom9.org/showthread.php?t=169036" target="_blank">http://forum.doom9.org/showthread.php?t=169036</a><br>
It is really strange that it produces no black part (bar) when I set the width = width+1 when calling <span>sws_getContext. Could it be a bug in swscale since I do no scaling?<br><br>Thanks a lot.<br></span></div> </div>
</div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Francesco Damato
</div>
<br>_______________________________________________
Libav-user mailing list
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a></div></div></div> </div></div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Francesco Damato
</div>