ffmpeg-tutorial icon indicating copy to clipboard operation
ffmpeg-tutorial copied to clipboard

Audio broken

Open pockethook opened this issue 11 years ago • 18 comments

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 avatar Jun 17 '13 10:06 pockethook

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.

pockethook avatar Jun 17 '13 13:06 pockethook

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

pprahul avatar Aug 16 '13 08:08 pprahul

@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.

Maniulo avatar Aug 16 '13 11:08 Maniulo

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.

illuusio avatar Sep 05 '13 17:09 illuusio

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

tetepoive974 avatar Jan 30 '15 06:01 tetepoive974

Audio issues are solved in my repo..

illuusio avatar Jan 30 '15 07:01 illuusio

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

tetepoive974 avatar Jan 30 '15 07:01 tetepoive974

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

illuusio avatar Jan 30 '15 09:01 illuusio

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

tetepoive974 avatar Jan 30 '15 10:01 tetepoive974

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.

illuusio avatar Jan 30 '15 12:01 illuusio

Thanks you very much for your help

tetepoive974 avatar Jan 30 '15 13:01 tetepoive974

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

tetepoive974 avatar Feb 15 '15 18:02 tetepoive974

Try asking on the ffmpeg mailing list.

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

On Monday, February 16, 2015, tetepoive974 [email protected] 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 .

mpenkov avatar Feb 16 '15 00:02 mpenkov

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.

illuusio avatar Feb 16 '15 07:02 illuusio

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

mrglobal avatar Aug 14 '17 19:08 mrglobal

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.

balapradeepswork avatar Apr 18 '18 13:04 balapradeepswork

Without seeing code there is not much anyone can do

illuusio avatar Apr 19 '18 18:04 illuusio

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

MilaCridlig avatar Jul 10 '18 19:07 MilaCridlig