Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Sunday, April 20, 2008 12:23:34 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

To create a H264-compressed .MP4 file with LEADTOOLS codecs and filters, you will need the following:

- Container (Target Format): ISO. You will need the LEAD ISO multiplexer.
- Audio Compressor: LEAD AAC Encoder (See AudioCompressor.jpg in the attached file).
- Video Compressor: LEAD H264 Encoder (4.0) (See VideoCompressor.jpg in the attached file).

Important Note: QuickTime does not use DirectShow, instead it uses proprietary software internally and does not use any 3rd party decoders to play files.  Secondly, the file extension should be .mp4.  If it is something like .mov, then the Quicktime will only play the video.  This appears to be a problem with Quicktime, so you should contact them for an explanation.

QuickTime might not handle some types of H264 files, specifically files which are encoded with B frames. It is best that you choose zero number of Bs when converting a file that you want to play on QuickTime.

The attachment also contains 2 video files:
B2.MP4: this file is a valid H264 file, but the number of B frames is set to 2, which causes irregular playback with QuickTime.
B0.MP4: H264 file with number of B frames is set to 0, which causes smooth playback with QuickTime.
File Attachment(s):
Attachment.zip (775kb) downloaded 110 time(s).
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, June 15, 2010 1:13:31 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

The following code shows how to use the "LEAD H264 video Encoder" and "LEAD AAC Audio Encoder" to create ISO files that play correctly using QuickTime:
+------------+
ILMH264Encoder* pLEADH264Encoder;
ILMAACEncoder* m_pAAC;

IltmmCompressors* pCompressors;
m_capture->get_VideoCompressors(&pCompressors); // get the  video compressor collection

IltmmCompressor* pCompressor;
long index;
BSTR bstr = ::SysAllocString(L"@device:sw:{33D9A760-90C8-11D0-BD43-00A0C911CE86}\\LEAD H264 Encoder (4.0)");
pCompressors->Find(bstr,&index);  // get the index of the selected compressor
HRESULT hr = pCompressors->put_Selection(index);
if(FAILED(hr))
{
pCompressors->Release();
}

IUnknown *punk;

hr = m_capture->GetSubObject(ltmmCapture_Object_VideoCompressor, &punk);
if(FAILED(hr))
{
pCompressors->put_Selection(-1);
pCompressors->Release();          
}

hr = punk->QueryInterface(IID_ILMH264Encoder, (void**)&pLEADH264Encoder) ;
punk->Release();
if(FAILED(hr))
{
pCompressors->put_Selection(-1);
pCompressors->Release();
}

pCompressors->Release();

pLEADH264Encoder->put_EncodingThreads(H264THREAD_AUTO);
pLEADH264Encoder->put_OutputFormat(H264FORMAT_STANDARD_H264);
pLEADH264Encoder->put_QualityFactor(28);
pLEADH264Encoder->put_IFrameInterval(15);
pLEADH264Encoder->put_PFrameInterval(0);
pLEADH264Encoder->put_SymbolMode(H264SYMBOL_CAVLC);
pLEADH264Encoder->put_FrameRate(15.0);
pLEADH264Encoder->put_EnableRateControl(VARIANT_TRUE);
pLEADH264Encoder->put_BitRate(256000 - 12200);
pLEADH264Encoder->put_EnableSuperCompression(VARIANT_FALSE);
pLEADH264Encoder->put_TimeQualityFactorFileName(NULL);

IltmmCompressors* compressors;
long i;

//Add AAC_ENCODER
bstr = ::SysAllocString(L"@device:sw:{33D9A761-90C8-11D0-BD43-00A0C911CE86}\\{E2B7DD70-38C5-11D5-91F6-00104BDB8FF9}");
m_capture->get_AudioCompressors(&compressors);
compressors->Find(bstr, &i);
::SysFreeString(bstr);
if(i == -1)
{
compressors->Release();              
}

hr = compressors->put_Selection(i);
if(FAILED(hr))
{
compressors->Release();
}          

hr = m_capture->GetSubObject(ltmmCapture_Object_AudioCompressor, &punk);
if(FAILED(hr))
{
compressors->put_Selection(-1);
compressors->Release();        
}
hr = punk->QueryInterface(IID_ILMAACEncoder, (void**)&m_pAAC) ;
punk->Release();
if(FAILED(hr))
{

compressors->put_Selection(-1);
compressors->Release();              
}

compressors->Release();

m_pAAC->put_OutputBitrate(128);
m_pAAC->put_OutputChannels(LAAC_OC_STEREO);
m_pAAC->put_SimulateSurround(VARIANT_FALSE);
m_pAAC->put_MPEGVersion(LAAC_MPEGVersion_MPEG4);
m_pAAC->put_BlockType(LAAC_BlockType_NORMAL);
m_pAAC->put_ObjectType(LAAC_ObjectType_MAIN);
m_pAAC->put_RateControl(LAAC_RC_CONST_BITRATE);
m_pAAC->put_UseCutoff(VARIANT_FALSE);
m_pAAC->put_StreamFormat(LAAC_STREAMFORMAT_RAW);
m_pAAC->put_OutputSampleRate(48000);
m_pAAC->put_IgnoreTimeDiscontinuity(VARIANT_FALSE);
m_pAAC->put_IgnoreTimeOverlapping(VARIANT_FALSE);

m_capture->put_TargetFormat(ltmmCapture_TargetFormat_ISO);
BSTR FileName = SysAllocString(L"c:\\Qtime.mp4");
m_capture->put_TargetFile(FileName);

hr = m_capture->StartCapture(ltmmCapture_Mode_VideoAndAudio);
+------------+

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.134 seconds.