Beispiel #1
0
 /// <summary>
 /// Close the input file. Once closed, NextFrame cannot be used
 /// </summary>
 public void Close()
 {
     if (wavFile != null)
     {
         wavFile.Close();
         wavFile = null;
         //DeleteExistingFile(wavFilePath);
     }
     if (videoFrameReader != null)
     {
         videoFrameReader.Dispose();
         videoFrameReader = null;
     }
 }
Beispiel #2
0
        private void PrepareAudioExtraction(string filePath, int bufferSize, double videoFrameRate)
        {
            CreateWavFileFromAVFile(filePath);
            wavFile = new WavFile(wavFilePath);

            frame.AudioSampleRateHz = wavFile.SamplesPerSec;
            if (bufferSize == 0)    //Combined audio/video extraction
            {
                frame.AudioBuffer = new Int16[(int)((double)wavFile.SamplesPerSec / videoFrameRate)];
            }
            else      //Audio extraction only
            {
                frame.AudioBuffer = new Int16[bufferSize];
                frameDurationSec  = (double)bufferSize / (double)frame.AudioSampleRateHz;
            }
        }