Audio Noise Issue

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

ShilpiR_beesys

  • Posts: 8
  • Joined: Mon Apr 22, 2019 7:15 am
  • Real Name: Shilpi Rustagi

Audio Noise Issue

PostThu Aug 29, 2019 10:53 am

Hi....

I am using DeckLink Quad2 card and Blackmagic DeckLink SDK 10.11.4.. Do I have any way to know that the live video I am capturing using ATEM switcher does have an audio or not.. actually the issue is when I am capturing the live through ATEM switcher there is some noise coming from the live iff the live is not having any audio and the noise is constantly increasing... PFA the pcm that is created on capturing audio packet from function VideoInputFrameArrived
Code: Select all
HRESULT    DeckLinkDevice::VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket)
{

   if (audioPacket)
   {
      long lSampleCount = 0;
      lSampleCount = audioPacket->GetSampleFrameCount();
      _audioSamplesPerframe = bmdAudioSampleType16bitInteger * 2 * lSampleCount;
      BYTE* pBYTE = NULL;
      audioPacket->GetBytes((LPVOID*)&pBYTE)
      if (m_pFileIn == NULL)
      {
         fopen_s(&m_pFileIn, "D:\\AudioIn.pcm", "wb+");
      }
      if (m_pFileIn)
      {
         fwrite(pBYTE, sizeof(BYTE), _audioSamplesPerframe, m_pFileIn);
      }
      int n = 0;
   }
}
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 203
  • Joined: Mon Sep 04, 2017 4:05 am

Re: Audio Noise Issue

PostMon Sep 02, 2019 3:34 am

Hi Shilpi,

Thanks for providing your code sample, I can see 2 potential issues:
  • Assuming that you have enabled audio input with 2 channels, your calculation for _audioSamplesPerframe is actually the bit length (as bmdAudioSampleType16bitInteger = 16), whereas the call to fwrite is expecting byte count
  • I would avoid performing any file writes within the context of VideoInputFrameArrived callback, This operation has potential to delay subsequent VideoInputFrameArrived callback and if continual callback delay, this would eventually lead to drop frames. Increment the reference to IDeckLinkAudioInputPacket, store in a queue and handle in a different thread context. Refer to the FileCapture sample for example of how to do this (Desktop Video SDK 11.3).

Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 4 guests