Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate mp4 file.Can't play by media player. #180

Open
GoogleCodeExporter opened this issue Oct 4, 2015 · 0 comments
Open

Generate mp4 file.Can't play by media player. #180

GoogleCodeExporter opened this issue Oct 4, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link
Contributor


I use mp4v2 to generate mp4 file.
vlc can play.
But media player can't play it.

m_pAviFile = MP4CreateEx("test.mp4", 0xFFFFFFFF, 1, 0, 0, 0, 0); // 
創建mp4文件  1.mp4 ,存在會蓋過去



if(m_pAviFile==MP4_INVALID_FILE_HANDLE)
    return false;


 MP4SetTimeScale(m_pAviFile, 90000 );

   //添加h264 track

 m_video = MP4AddH264VideoTrack(m_pAviFile, 90000 , 90000 / 30 , 600 , 480 ,
     0x64 , // sps[1] AVCProfileIndication 
     0x00 , // sps[2] profile_compat 
     0x1f , // sps[3] AVCLevelIndication 
     3 ); // 4 bytes length before each NAL 



if (m_video == MP4_INVALID_TRACK_ID) //ok return video:1
{
    MP4Close(m_pAviFile);
    m_pAviFile=NULL;
    m_video=0;
    m_audio=0;
    return false;
}

MP4SetVideoProfileLevel(m_pAviFile, 0x7F);

//add audio
m_audio = MP4AddAudioTrack(m_pAviFile, 8000, 1024, MP4_MPEG4_AUDIO_TYPE);


if (m_audio == MP4_INVALID_TRACK_ID) 
{
    MP4Close(m_pAviFile);
    m_pAviFile=NULL;
    m_video=0;
    m_audio=0;
    return false;
}

MP4SetAudioProfileLevel(m_pAviFile, 0x2);

Original issue reported on code.google.com by gn01887...@gmail.com on 24 Jul 2015 at 7:30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant