Open smlz opened 5 years ago
I can't reproduce this here on debian/stable with ffmpeg 3.2.12 , libavcodec 57.64.101
$ ./src/silan /tmp/padded/padded.mp3
0.191927 Sound On
0.830272 Sound Off
$ ./src/silan /tmp/padded/padded.ogg
0.197891 Sound On
0.825397 Sound Off
$ ./src/silan /tmp/padded/padded.flac
0.200023 Sound On
0.825374 Sound Off
seems like an ffmpeg, avcodec related issue.
Hm. I'll see if i can dig a bit deeper. Thanks for trying out.
It seems the API avcodec_decode_audio4()
was already deprecated again in recent ffmpeg. Perhaps the wrapper function that ffmpeg4.x provides for the old API does not handle stereo or joint stereo correctly!?
I guess silan's ffmpeg audio-decoder needs to use the new avcodec_receive_frame()
API with ffmpeg4.x ; libavcodec 58.x
I tried both, full stereo and joint stereo, and get strange values in both cases:
$ file padded-jointstereo.mp3 padded-stereo.mp3
padded-jointstereo.mp3: Audio file with ID3 version 2.4.0, extended header, contains:MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, JntStereo
padded-stereo.mp3: Audio file with ID3 version 2.4.0, extended header, contains:MPEG ADTS, layer III, v1, 128 kbps, 44.1 kHz, Stereo
$ silan padded-jointstereo.mp3
0.367868 Sound On
1.677347 Sound Off
$ silan padded-stereo.mp3
0.093583 Sound On
1.677687 Sound Off
Here are the two MP3 files: padded-mp3s.zip
@x42 as I tried using the audio_decoder library on my own, I found decoding to be bad on FFmpeg 4.1.2. The MP3 decoding is generating junk output.
For example is the sample recording of /usr/share/sounds/alsa/Front_Center.wav
, vs LAME conversion of the same file.
When testing our audio chain with different file formats I found that silan does return the different results, depending on the file format. I was expecting small disparities, but the result when analyzing an MP3 file was off by more than half a second.
The test audio starts with 200ms silence, followed by 600ms noise, followed by 1200ms silence. I used FLAC, ogg vorbis and MP3 as file formats. This was the output by silan:
As you can see, the ogg vorbis and FLAC files are okay, but the MP3 is off.
I checked the individual files with a spectrum analyzer, and they seem to be okay.
MP3:
Ogg Vorbis:
FLAC:
Here is a zip with the three audio files: padded-audio.zip
I tried out different different silan options, but no luck so far.
The following versions were used: