<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">Hi Anfrew,</span><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px"><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; so how can i to pass video frames into avcodec_encode_video2? (i'm interested only in video and not audio frames). After this i want to write the packets into a file.h264.</span></div>
<div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:'times new roman','new york',times,serif;font-size:16px"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:'times new roman','new york',times,serif;font-size:16px">Can you help me? </span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:'times new roman','new york',times,serif;font-size:16px"><br>
</span></div><div style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:'times new roman','new york',times,serif;font-size:16px">Thanks</span></div><div style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:'times new roman','new york',times,serif;font-size:16px"><br></span></div><div style="font-family:arial,sans-serif;font-size:13px">Any suggestion is appreciated.<br><br>Thanks</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/22 Andrew Sherepenko <span dir="ltr"><<a href="mailto:andrew.sherepenko@gmail.com" target="_blank">andrew.sherepenko@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello libav users!<br>
<br>
I try to remuxing MPEG-TS to MP4 container.<br>
<br>
MPEG-TS stores H.264 video and AC3 audio. I copy video context to the new container,<br>
but I have to transcode audio to MP3.<br>
<br>
<br>
What I do:<br>
1. Read packet from input context;<br>
2. Decode packet to the frame;<br>
3. Resample audio (use swr_conwert() API method);<br>
4. Encode frame into packet;<br>
5. Write packet into output context.<br>
<br>
AC3 frame stores 1536 samples, and MP3 - only 1152.<br>
In this case we have downsampling. I've found that swr_convert() buffered unprocessed samples (1536 - 1152 = 384 samples per frame).<br>
If I don't read buffered samples I don't have an audio in the and of the movie. So I try to flush data from the swr buffer and encode it too.<br>
I flush after every third input frame (384 * 3 = 1152 - we have one full output extra frame).<br>
In such scenario I have complete audio stream but it has a lot of strange artifacts.<br>
I've tried change PTS/DTS, rescale, etc., but it doesn't help (Or i have audio that plays faster without artifacts , or normal audio speed with artifacts).<br>
<br>
Also may be somebody knows can I use av_samples copy() without swr_convert() in this case.<br>
<br>
I will be glad to any advice.<br>
<br>
Thank you.<br>
WBR,<br>
Andrew Sherepenko<br>
<br>
______________________________<u></u>_________________<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/<u></u>listinfo/libav-user</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Francesco Damato
</div>