visual c++ - Noise occurs while encoding audio from Microphone and latency in video streaming using IMFSourceReader -
i'm developing application capture.mp4 file (video(usb camera)and audio(any microphone) )during video streaming using sourcereader.
my code returning success api's , able save video. i'm facing below 3 issues.
- after 10secs of recording , fps goes 0 , resume 1fps(note: saving video 1080p 60fps). fps not resuming 60fps.
- while playing recorded file, noise audio playing whole file. recorded audio file not playing.
- to stop record, i'm using sinkwriter finalize method. application not responding call method , method taking time release it(time taken release ~3-5mins).
please find code in following dropbox link: https://www.dropbox.com/s/eddwdc1z9wsoh04/videorecord.txt?dl=0
without problem, i'm able capture audio , video using capture engine technique technique supports windows 8. application has support windows 7.
please let me know whether missing configure audio , video? me solve issue.
thanks in advance
i see few mistakes. first, call readsample mf_source_reader_first_video_stream. read video samples. should call readsample (first time , inside onreadsample) mf_source_reader_any_stream instead, in order make read both video , audio samples.
second, following 2 lines wrong:
hr = m_pwriter->writesample(0, psample); hr = m_pwriter->writesample(1, psample);
you should call writesample corresponding stream index according dwstreamindex value in onreadsample. example in case:
if(dwstreamindex == 0) hr = m_pwriter->writesample(m_dwvideostreamindex, psample); else if(dwstreamindex == 1) hr = m_pwriter->writesample(m_dwaudiostreamindex, psample);
Comments
Post a Comment