i want to sync my video using ffmpeg
I create my program which play multimedia files using ffmpeg library.
I'm trying to sync video and audio. my decode source following line. //////////////////////////////////////////////////////////////// if(av_read_frame(m_pFormatCtx, &packet) >= 0) { if(packet.stream_index == m_nAudioStream) { audioDecoded = avcodec_decode_audio(m_pAudioCtx, m_outbuf, &m_count, packet.data, packet.size); play_sound(); } if(packet.stream_index == m_nVideoStream) { bytesDecoded = avcodec_decode_video(m_pCodecCtx, m_pFrame, &frameFinished, packet.data, packet.size); if(frameFinished) { ImgReSampleContext *s; s = img_resample_full_init( m_width, m_height, m_pCodecCtx->width, m_pCodecCtx->height, 0, 0, 0, 0 ,0 ,0, 0 ,0); img_resample(s, (AVPicture *)m_pic, (AVPicture *)m_pFrame); img_convert((AVPicture *)m_pFrameRGB, PIX_FMT_RGB24, (AVPicture *)m_pic, PIX_FMT_YUV420P, m_width, m_height); img_resample_close(s); //////////////////////////////////////////////////////////////////////// anyway sync is correct because play_sound function. but i can't use play_sound to sync audio and video anyone who use ffmpeg libaray to decode video files ? |
All times are GMT -5. The time now is 05:52 PM. |