mentby.com
Blog | Jobs | Help | Signup | Login

loading
Hi, all:

Sorry for my naive questions. I'm trying to decode audio stream using
avcodec_decode_audio4(). After I obtained the audio frame by
avcodec_decode_audio4(), I'd love to resample audio signals using
swr_convert() ----

its definition is pasted as follows:

int swr_convert(struct SwrContext *s, uint8_t **out, int out_count,

                                const uint8_t **in , int in_count);

Now, my question:
1) is swr_convert() able to convert audio signals from 1 channel to 2
channels ????
2) for swr_convert(), if there are 2 audio channels (stereo audio signals),
how is the data organized in unit8_t **out?
Does out[0] only contain the left channel audio signals?
Does out[1] contain the right channel audio signals?
Why in my case, out[1] always points to NULL ?

Please do help... Thank you...

Best Regards

--

Pei JIA

Email: jp4work*******
cell:    +1 604-362-5816

Welcome to Vision Open http://www.visionopen.com
Hi, all:

Is there a ffmpeg command to analyse an audio file?

1) How many samples are in this audio file?
2) How many audio channels are in this audio file? 1 or 2?

Cheers

--

Pei JIA

Email: jp4work*******
cell:    +1 604-362-5816

Welcome to Vision Open http://www.visionopen.com

Revisit FFmpeg Frame Lost

Fri, 15 Feb 2013 15:42:26 -0800 Post Comments

Hi, all:

Sorry to bug all of you. This is actually a very old topic, but I still
would like to mention it again.

Actually what I've done so far is:
1) using the following 2 commands to create 2 video files from the same
image sequence (268 images in total)
*ffmpeg -i %3d video.mpg*
*ffmpeg ii %3d video.mp4*

2) trying to use the following patch of code to decode these 2 video files
--- in the following patch, I just count the number of frames in these 2
video files.

int e = ERROR_NONE;

    AVPacket pkt;

    av_init_packet(&pkt);

    if( av_read_frame(this->m_pFormatCtxDec, &pkt) < 0)

    {

        return (e = ERROR_ENDOFFILE);

    }

    if(pkt.stream_index == this->m_iVideoStreamIdx)

    {

        int got_picture = 0;

        int len = avcodec_decode_video2(this->m_pCodecCtxDecVideo,

                                        this->m_pVideoFrame,

                                        &got_picture,

                                        &pkt);

        if(!got_picture)

            return (e = ERROR_GOTPICTUREPTR);

        if(len < 0)

            return (e = ERROR_VIDEODECODING);

        ++this->m_iNbOfFrames;

    }

As mentioned in *av_read_frame()* documentation,
*For video, the packet contains * exactly one frame*

So, what I've been expecting is: this->m_iNbOfFrames
should be equal to 268 (total number of frames inside video files. )

However,
for .mpg, I got 267 images after decoding; (lack of 1 frame)
for .mp4, I got 260 images after decoding (lack of 8 frames)

It seems  http://ffmpeg.org/doxygen/trunk/api-example_8c-source.html  is able
to handle the "frame lost" issue, but it uses* fread()* instead of *
av_read_frame()*. If I insist on using *av_read_frame()*, how can I avoid
this "frame lost" issue?

Please do help.. Thank you very much.

--

Pei JIA

Email: jp4work*******
cell:    +1 604-362-5816

Welcome to Vision Open http://www.visionopen.com
Recent discussion with
Profile Widget
Copy and paste this HTML code to your blog or website: