<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hi Madhan,Thank you very much in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013788#M23419</link>
    <description>&lt;P&gt;Hi Madhan,&lt;/P&gt;
&lt;P&gt;Thank you very much for the sharing.&amp;nbsp; We confirm there&amp;nbsp;are several&amp;nbsp;dependent&amp;nbsp;bugs with the Flags, which cause the header offset size error in some condition. and right, the&amp;nbsp;solution&amp;nbsp;is to&amp;nbsp;remove the flags setting.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ying&lt;/P&gt;</description>
    <pubDate>Wed, 20 Aug 2014 07:59:58 GMT</pubDate>
    <dc:creator>Ying_H_Intel</dc:creator>
    <dc:date>2014-08-20T07:59:58Z</dc:date>
    <item>
      <title>MP4 muxer with H264 encoder - debug vs release</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013784#M23415</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have some grayscale frames and I need to create an mp4 video with H264 encoding out of it. I am using Intel IPP Samples 7.0.1.&lt;/P&gt;

&lt;P&gt;The application works fine in debug but doesn't in release configuration. The mp4 output in release has the correct size, duration and dimensions, but the image wont play in any player.&lt;/P&gt;

&lt;P&gt;This is not the case in debug mode or when I do debug with breakpoints in release mode (which I guess makes the execution a bit slow for the encoder/muxer to work properly).After some investigation, it seems that due to optimizations in release mode, the execution is very fast and hence proper mp4 output is not generated.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;he documentation says that according to the H264 algorithm there could be some B frames pending in the buffer and they need flushed, so I tried passing NULL to the encoder and retrieve pending frames. But even that didnt help in release mode.&lt;/P&gt;

&lt;P&gt;Should I try flushing the muxer? but at what stage?&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I am attaching the input 8 bit grayscale image (1024 X 1024 X 100 frames).&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Please find my code below&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//initialize code for the mp4 creator
bool MP4::Initialize(const int&amp;amp; numFrames, const int&amp;amp; frameWidth, const int&amp;amp; frameHeight, const int&amp;amp; frameRate, const std::string&amp;amp; fullfilepath)
{
	m_width = frameWidth;
	m_height = frameHeight;
	m_bitDepth = 8;
	m_numFrames = numFrames;
	m_currentFrameIndex = 0;
	

	vm_string_strcpy(writerParams.m_file_name, fullfilepath.c_str());
	writerParams.m_portion_size = 0;
	result = writer.Init(&amp;amp;writerParams);

	videoInfo.clip_info.height = frameHeight;
	videoInfo.clip_info.width = frameWidth;
	videoInfo.stream_type = UMC::VideoStreamType::H264_VIDEO;
	videoInfo.color_format = UMC::ColorFormat::YUV420;
	videoInfo.interlace_type = UMC::InterlaceType::PROGRESSIVE;
	videoInfo.bitrate = 10000000;
	videoInfo.framerate = float(frameRate);
	videoInfo.streamPID = 0;
	videoInfo.duration = float(numFrames) / frameRate;

	muxerParams.m_lpDataWriter = &amp;amp;writer;
	muxerParams.m_SystemType = UMC::SystemStreamType::H264_PURE_VIDEO_STREAM;
	muxerParams.m_lFlags = FLAG_FRAGMENTED_AT_I_PICTURES;
	muxerParams.m_nNumberOfTracks = 1;
	muxerParams.pTrackParams = new UMC::TrackParams[1];//&amp;amp;videoTrackParams;
	muxerParams.pTrackParams[0].type = UMC::VIDEO_TRACK;
	muxerParams.pTrackParams[0].info.video = &amp;amp;videoInfo;
	muxerParams.pTrackParams[0].bufferParams.m_numberOfFrames = numFrames;
	

	result = m_MP4muxer.Init(&amp;amp;muxerParams);
	
	m_H264EncoderParams.key_frame_controls.method=1;
	m_H264EncoderParams.info.clip_info.height=frameHeight;
	m_H264EncoderParams.info.clip_info.width=frameWidth;
	m_H264EncoderParams.info.bitrate = 10000000;
	m_H264EncoderParams.numThreads = 1;
	m_H264EncoderParams.chroma_format_idc = 1;
	m_H264EncoderParams.numFramesToEncode = numFrames;
	m_H264EncoderParams.info.duration = (float)numFrames/frameRate;
	m_H264EncoderParams.info.framerate = frameRate;
	
	result = m_H264Encoder.Init(&amp;amp;m_H264EncoderParams);
	return result == UMC_OK;
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;//Add frame code for mp4 creator
bool MP4::AddFrame(void* frameData) // framedata is 8 bit grayscale image
{
	int yuvframeSize = m_width * m_height * 3/2;
	Ipp8u* yuvPixels = ippsMalloc_8u(yuvframeSize);
	memset(yuvPixels, 127, yuvframeSize); 						//neutral values for u and v components
	memcpy(yuvPixels, frameData, m_width * m_height); // grayscale to yuv completed

	UMC::VideoData uncompressedData;
	uncompressedData.Init(m_width, m_height, UMC::ColorFormat::YUV420, m_bitDepth);
	uncompressedData.SetBufferPointer(yuvPixels, yuvframeSize);
	uncompressedData.SetDataSize(yuvframeSize);

	UMC::MediaData videoData;
	result = m_MP4muxer.LockBuffer(&amp;amp;videoData, 0);
	result = m_H264Encoder.GetFrame(&amp;amp;uncompressedData, &amp;amp;videoData);

	Ipp64f start = (m_currentFrameIndex/(float)m_numFrames)*m_H264EncoderParams.info.duration;
	Ipp64f end = ((m_currentFrameIndex+1)/(float)m_numFrames)*m_H264EncoderParams.info.duration;
	videoData.SetTime(start,end);
	
	result = m_MP4muxer.UnlockBuffer(&amp;amp;videoData,0);

	ippsFree(yuvPixels);
	m_currentFrameIndex++;
	return result == UMC::UMC_OK;
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;bool MP4::::Close()
{
	UMC::Status status = UMC::UMC_OK;
	status = m_MP4muxer.PutEndOfStream(0);
	status = m_MP4muxer.Close();
	delete [] muxerParams.pTrackParams;
	return status == UMC::UMC_OK;
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Client Code&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include &amp;lt;fstream&amp;gt;
#include &amp;lt;mp4.h&amp;gt;
using namespace std;
using namespace IntelIPP;

void main()
{
	int width = 1024;
	int height = 1024;
	int numFrames = 100;
	int frameRate = 10;
	int frameSize = width*height;

	char* rawData = new char[frameSize* numFrames];

	ifstream fxdFile;
	fxdFile.open("D:\\Temp\\testImage.raw",std::ios::binary);
	fxdFile.read(rawData, frameSize*numFrames);
	fxdFile.close();

	MP4 mp4creator;
	mp4creator.Initialize(numFrames, width, height, frameRate, "D:\\Temp\\video.mp4");

	char* frame = new char[frameSize];
	for(int i = 0; i&amp;lt;numFrames; i++)
	{
		memcpy(frame, rawData + i*frameSize, frameSize);
		mp4creator.AddFrame(frame);
	}

	mp4creator.Close();
}&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 08:03:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013784#M23415</guid>
      <dc:creator>Madhan_S</dc:creator>
      <dc:date>2014-07-30T08:03:26Z</dc:date>
    </item>
    <item>
      <title>I am attaching the mp4 videos</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013785#M23416</link>
      <description>&lt;P&gt;I am attaching the mp4 videos generated in release and debug mode. And the hex comparison between the two. Please note that mostly the frame data appears to be the same, and there is a pattern in the differences - 1 bit lesser in the non working video&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 08:13:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013785#M23416</guid>
      <dc:creator>Madhan_S</dc:creator>
      <dc:date>2014-07-30T08:13:40Z</dc:date>
    </item>
    <item>
      <title>Could not find the actual</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013786#M23417</link>
      <description>&lt;P&gt;Could not find the actual reason but the stco table values were all offset by 16.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 14.30880069732666px;"&gt;muxerParams.m_lFlags = FLAG_FRAGMENTED_AT_I_PICTURES;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; line-height: 14.30880069732666px;"&gt;I removed explicit setting of the muxerParams flags as shown above and went along with the default initialization. And it worked !&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 12:54:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013786#M23417</guid>
      <dc:creator>Madhan_S</dc:creator>
      <dc:date>2014-07-30T12:54:45Z</dc:date>
    </item>
    <item>
      <title>Hi Madhan S, </title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013787#M23418</link>
      <description>&lt;P&gt;Hi Madhan S,&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Glad to know it works finally. &amp;nbsp;We will investigate the reason if possible.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;P&gt;Ying&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2014 02:09:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013787#M23418</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-07-31T02:09:38Z</dc:date>
    </item>
    <item>
      <title>Hi Madhan,Thank you very much</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013788#M23419</link>
      <description>&lt;P&gt;Hi Madhan,&lt;/P&gt;
&lt;P&gt;Thank you very much for the sharing.&amp;nbsp; We confirm there&amp;nbsp;are several&amp;nbsp;dependent&amp;nbsp;bugs with the Flags, which cause the header offset size error in some condition. and right, the&amp;nbsp;solution&amp;nbsp;is to&amp;nbsp;remove the flags setting.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Ying&lt;/P&gt;</description>
      <pubDate>Wed, 20 Aug 2014 07:59:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1013788#M23419</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2014-08-20T07:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Hi Madhan,Thank you very much</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1233004#M27487</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I know it's 6 years late, but still,&lt;/P&gt;&lt;P&gt;were any of the issues with FLAG_FRAGMENTED_AT_I_PICTURES addressed?&lt;/P&gt;&lt;P&gt;If yes, is there any chance to get a diff with 7.1.1.013 samples or just the code for mp4muxer?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 07:58:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1233004#M27487</guid>
      <dc:creator>AF5</dc:creator>
      <dc:date>2020-12-01T07:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Hi Madhan,Thank you very much</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1233404#M27489</link>
      <description>&lt;P&gt;Hello, this issue has not been addressed and I have to say that this functionality is not part of the current version of IPP anymore.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Dec 2020 07:54:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/MP4-muxer-with-H264-encoder-debug-vs-release/m-p/1233404#M27489</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2020-12-02T07:54:10Z</dc:date>
    </item>
  </channel>
</rss>

