mpenkov / ffmpeg-tutorial

A set of tutorials that demonstrates how to write a video player based on FFmpeg
http://www.ffmpeg.org/documentation.html
1.23k stars 396 forks source link

Audio broken #11

Open pockethook opened 11 years ago

pockethook commented 11 years ago

A lot of noise/clicking/garbage can be heard in addition to something that vaguely resembles what should be heard.

I've tried tutorial 3 and 7 but neither play audio correctly. I've tried this on both Windows 7 and Arch Linux with the latest versions of g++/VC++, FFMpeg and SDL to the same avail. FFPlay works fine on both machines.

pockethook commented 11 years ago

The problem only occurs with non-PCM_S16 audio. MP3/MP2 audio plays back slightly off and at a higher pitch, playing back FLAC produces noise.

pprahul commented 11 years ago

I also had same problem playing mpeg1 video and mp2 audio (mpa) in an mp4 container. Is it the problem with the inability of SDL to play audio which is in planar format.

Tried setting the decode format to non-planar using the below code (inserted in stream_component_open) , and seems to be fixed:

... if (codecCtx->sample_fmt == AV_SAMPLE_FMT_S16P) { codecCtx->request_sample_fmt = AV_SAMPLE_FMT_S16; }

..

Does it solve the problem for you too ? @pockethook

Maniulo commented 11 years ago

@pprahul I've been struggling with this issue for several days now too, and your fix did work, thanks!

Also, without the fix, tutorials run fine on FFmpeg 1.0.1 and below.

illuusio commented 11 years ago

This one is fixed on https://github.com/illuusio/ffmpeg-tutorial and pull request https://github.com/chelyaev/ffmpeg-tutorial/pull/17. tutorial03.c ain't fixed but I goes the same.

tetepoive974 commented 9 years ago

Hi, I have the same issue with a mp4 video in h264 and AAC.Do you know how to fix it? thanks

illuusio commented 9 years ago

Audio issues are solved in my repo..

tetepoive974 commented 9 years ago

Yes but Do you try with a mp4 video in h264 and an AAC audio? I try it but the song seem to be very slow.Can you confirm me ?thanks

illuusio commented 9 years ago

which version of ffmpeg? Can you provide sample of non working..

tetepoive974 commented 9 years ago

it's the version 2.0.1 and with the version 2.5.2 it's the same thing. Can you try with this video ? http://we.tl/i1wIOwRwh7 thanks you

illuusio commented 9 years ago

Ok.. you have pretty high rate video bit crappy audio :dancers: . Problem is no working conversion from 22000 to you wanted output. So audio sound little bit chubby. I'll try to fix it but takes awhile.

tetepoive974 commented 9 years ago

Thanks you very much for your help

tetepoive974 commented 9 years ago

Hi, Do you know what is the process to obtain a good sound with the example I give you?I will try to corrige by myself . thanks

mpenkov commented 9 years ago

Try asking on the ffmpeg mailing list.

https://www.ffmpeg.org/contact.html

On Monday, February 16, 2015, tetepoive974 notifications@github.com wrote:

Hi, Do you know what is the process to obtain a good sound with the example I give you?I will try to corrige by myself . thanks

Reply to this email directly or view it on GitHub https://github.com/chelyaev/ffmpeg-tutorial/issues/11#issuecomment-74428940 .

illuusio commented 9 years ago

I'm currently over burned with work so take alook at http://roxlu.com/2014/039/decoding-h264-and-yuv420p-playback they should lead your way. They are made for AVConv but should work on FFmpeg also and most of the time asking questions like this on FFmpeg mailing list will lead you just be ashamed not be pro.

mrglobal commented 7 years ago

I pinged Tuukka and with his gracious help, I got this working on QT on Windows 10 and FFMPEG build from https://ffmpeg.zeranoe.com/builds/ latest Aug 1st 2017 build. I use 32 bit, Shared and Dev.

Tut_04_illusio.zip

regards

Sean

balapradeepswork commented 6 years ago

I tried doing all these fix for non planer output in tutorial 05 but there is no sound at all. However, if I don't do resampling to AV_PIX_FMT_S16 there is some noise. Can you help me Please.

illuusio commented 6 years ago

Without seeing code there is not much anyone can do

MilaCridlig commented 6 years ago

Was able to play a mp4 video with audio whose codecs appear below. Based on http://dranger.com/ffmpeg/ and updates from https://github.com/illuusio/ffmpeg-tutorial, it runs Windows x64, Visual Studio 2015, SDL2, ffmpeg 4.0 and C++.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘crawl.mp4’: Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01T00:00:00.000000Z Duration: 00:00:29.00, start: 0.000000, bitrate: 689 kb/s Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1344x680, 612 kb/s, 10 fps, 10 tbr, 10 tbn, 20 tbc (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 75 kb/s (default) Metadata: creation_time : 1970-01-01T00:00:00.000000Z handler_name : SoundHandler screen final size: 1344x680