I see that the last few frames of the video is chopped away, meaning that the length of the video is less than the recorded video. My video input is from webcam. I keep feeding data by grabbing samples from directshow. This is my encoding code, nothing special:
[cpp]status = m_mp4Muxer.LockBuffer(&m_outVideoData, m_mp4Muxer.GetTrackIndex(UMC :: VIDEO_TRACK));
if (status == UMC :: UMC_OK) {
status = m_VideoEncoder.GetFrame(&m_inVideoData, &m_outVideoData);
if (status == UMC :: UMC_OK) {
status = m_mp4Muxer.UnlockBuffer(&m_outVideoData,
m_mp4Muxer.GetTrackIndex(UMC :: VIDEO_TRACK));
}
}[/cpp] The status variable always prints 0 meaning success. This is in the debug mode. The last few frames are gone many a time.
Of course, in Release mode the video file is un-playable.
So, How do I ensure I wait for all frames. Especially when status returns success always.
I checked the video file using mediainfo and it says that the video is encoded using High profile. How is that possible? I use defaults. Shouldn't the default be Main profile:
This is the output from mediainfo:
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 1 frame
Muxing mode : Container profile=Baseline@3.0
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 2s 930ms
Bit rate mode : Variable
Bit rate : 765 Kbps
Width : 640 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate mode : Variable
Frame rate : 23.550 fps
Original frame rate : 30.000 fps
Minimum frame rate : 4.422 fps
Maximum frame rate : 30.019 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.106
Stream size : 274 KiB (91%)
Language : English
Encoded date : UTC 2012-05-03 22:58:47
Tagged date : UTC 2012-05-03 22:58:47
Note that in the end, when the user presses stop, I do mark end of stream
[cpp]m_mp4Muxer.PutEndOfStream(m_mp4Muxer.GetTrackIndex(UMC :: VIDEO_TRACK));[/cpp]