H264 encoding Debug Vs Release modes

H264 encoding Debug Vs Release modes

I hava a bizarre problem.I am encoding H264 data from my webcam using directshow. The video file is fine. IPP UMC was compiled with /MDd flag (debug).I was ready to sign it off, so switched to Release mode and compiled against IPP UMC which was then compiled with /MD (Release) flag.The resulting MP4 file does is "invalid". Windows media player cannot play it. I am flummoxed!It always works in Debug mode meaning the mp4 file is valid, but does not produce valid file in Release mode. No change in code.I am attaching the MP4 file. Can somebody point to what I am doing wrong?I thought I was so close :-)

AttachmentSize
Downloadvideo/mp4 Video.mp4300.7 KB
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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:

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));

		}

	}
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
m_mp4Muxer.PutEndOfStream(m_mp4Muxer.GetTrackIndex(UMC :: VIDEO_TRACK));

Posting thestatus from Premier, in case it may be of wider interest. The different behavior in debug and release builds was traced to the fragmented mp4 implementation (MuxerParams.m_lFlags setting FLAG_FRAGMENTED_AT_I_PICTURES). We are investigating this further.

Leave a Comment

Please sign in to add a comment. Not a member? Join today