Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:23:02+00:00 2026-06-13T15:23:02+00:00

I am trying to decode audio samples from various file formats using ffmpeg. Therefore

  • 0

I am trying to decode audio samples from various file formats using ffmpeg. Therefore I have started some experimenting based on the code in this discussion: How to decode audio via FFmpeg in Android . I use the latest FFMPEG release (1.0) and compile it using https://github.com/halfninja/android-ffmpeg-x264

AVFormatContext * pFormatCtx;

avcodec_register_all();
av_register_all();

int lError;
if ((lError = avformat_open_input(&pFormatCtx, filename, NULL, 0))
        != 0) {
    LOGE("Error open source file: %d", lError);
    return;
}
if ((lError = avformat_find_stream_info(pFormatCtx, 0)) < 0) {
    LOGE("Error find stream information: %d (Streams: %d)", lError, pFormatCtx->nb_streams);
    return;
}
LOGE("audio format: %s", pFormatCtx->iformat->name);
LOGE("audio bitrate: %d", pFormatCtx->bit_rate);
audioStreamIndex = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_AUDIO,
        -1, -1, &codec, 0);

//if (audioStreamIndex < 0 || audioStreamIndex >= pFormatCtx->nb_streams)
//  audioStreamIndex = 0;

LOGE("Stream: %d (total: %d)", audioStreamIndex, pFormatCtx->nb_streams);
LOGE("audio codec: %s", codec->name);

FFMPEG is compiled using enable-decoder=mp1/mp2/mp3/ogg/vorbis/wav/aac/theora and without any external libraries (e.g. libmp3lame, libtheora, etc.)

Opening of mp3 and wav files works without problems producing the following output for instance for mp3:

audio format: mp3

audio bitrate: 256121

stream: 0 (total: 1)

audio codec: mp3

But when I try to open an ogg file I get this:

Error find stream information: -1 (Streams: 1)

When I manually set audioStreamIndex=0 and comment out the return statement:

Error find stream information: -1 (Streams: 1)

audio format: mp3

audio bitrate: 0

stream: 0 (total: 1)

audio codec: mp3

For m4a (AAC) I get this:

audio format: mp3

audio bitrate: 288000

stream: 0 (total: 1)

audio codec: mp1

but later it fails in avcodec_decode_audio3.

I also tried to manually force a format without success:

AVInputFormat *pForceFormat= av_find_input_format("ogg");
if ((lError = avformat_open_input(&pFormatCtx, filename, pForceFormat, 0))
// continue

Is there something wrong with the loading code which makes it only work with mp3 and wav and fails for other formats?

Regards,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:23:03+00:00Added an answer on June 13, 2026 at 3:23 pm

    The problem was a missing demuxer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have been trying to decode an MP3 file to pcm, using ffmpeg API,
I have some JSON that I am trying to decode -- it is correctly
I am trying to decode a H263 4CIF(704x576) resolution file with ffmpeg, but it
I'm in the process of trying to decode some assembly code generated from a
I'm trying to decode JSON received from twitter streaming API using JSONConvert from NewtonSoft.Json
I'm trying to convert some video file containing video , audio and subtitles streams
I'm trying to decode an MP4 file i've created using mp4creator library. I can't
I am trying to decode an outlook .MSG file to a text file, using
I have a raw audio file captured from a camera in the format u-law
I am trying to decode entities using BeautifulSoup but with no luck. from BeautifulSoup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.