Recording quiet audio data in ffmpeg C ++ file

I want to record silence / nullified audio sampling of data in a mov container file inside audio data. My audio data is G711 linear single-channel PCM data. Currently my code is as follows:

 AVFrame* pSilentData = av_frame_alloc(); memset(&pSilentData->data[0], 0, iDataSize); pkt.data = (uint8_t*) pSilentData; pkt.size = iDataSize; // ... av_freep(&pSilentData->data[0]); av_frame_free(&pSilentData); 

But instead of silence, it sounds like dot to dot . What is the problem?

+1
source share
1 answer

For μ-law audio, a null value is represented as 0xff , so change:

 memset(&pSilentData->data[0], 0, iDataSize); 

in

 memset(&pSilentData->data[0], 0xff, iDataSize); 
+4
source

Source: https://habr.com/ru/post/1257507/


All Articles