[Libav-user] Resampling issue

Francesco Damato francesco.damato7 at gmail.com
Wed Nov 27 15:45:46 CET 2013


Hi Anfrew,

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.

Can you help me?

Thanks

Any suggestion is appreciated.

Thanks


2013/11/22 Andrew Sherepenko <andrew.sherepenko at gmail.com>

> Hello libav users!
>
> I try to remuxing MPEG-TS to MP4 container.
>
> MPEG-TS stores H.264 video and AC3 audio. I copy video context to the new
> container,
> but I have to transcode audio to MP3.
>
>
> What I do:
> 1. Read packet from input context;
> 2. Decode packet to the frame;
> 3. Resample audio (use swr_conwert() API method);
> 4. Encode frame into packet;
> 5. Write packet into output context.
>
> AC3 frame stores 1536 samples, and MP3 - only 1152.
> In this case we have downsampling. I've found that swr_convert() buffered
> unprocessed samples (1536 - 1152 = 384 samples per frame).
> 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.
> I flush after every third input frame (384 * 3 = 1152 - we have one full
> output extra frame).
> In such scenario I have complete audio stream but it has a lot of strange
> artifacts.
> 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).
>
> Also may be somebody knows can I use av_samples copy() without
> swr_convert() in this case.
>
> I will be glad to any advice.
>
> Thank you.
> WBR,
> Andrew Sherepenko
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>



-- 
Francesco Damato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131127/2a8bd3ec/attachment.html>


More information about the Libav-user mailing list