1
我有一個C++庫,實時編碼視頻從網絡攝像頭到MP4文件(H264)。是我有設置如下:如何使用ffmpeg編碼視頻以在Android上播放?
codecContex->profile=FF_PROFILE_H264_BASELINE; //Baseline
codecContex->gop_size=250;
codecContex->max_b_frames=0;
codecContex->max_qdiff=4;
codecContex->me_method=libffmpeg::ME_HEX;
codecContex->me_range=16;
codecContex->qmin=10;
codecContex->qmax=51;
codecContex->qcompress=0.6;
codecContex->keyint_min=10;
codecContex->trellis=0;
codecContex->level=13; //Level 1.3
codecContex->weighted_p_pred = 2;
codecContex->flags2|=CODEC_FLAG2_WPRED+CODEC_FLAG2_8X8DCT;
這將創建一個在iOS設備和Windows Phone 7個設備,但不會在Android設備上播放MP4文件。我讀過Android僅支持使用基準配置文件編碼的電影。這些設置應該會生成基準電影,但是當我使用MediaInfo查看生成的MP4文件時,它會顯示它是AVC([email protected])。這也許就是爲什麼它不工作,但我似乎無法得到它的產生與AVC([email protected])的東西......
如果我刪除最後一行:
codecContex->flags2|=CODEC_FLAG2_WPRED+CODEC_FLAG2_8X8DCT;
然後MediaInfo將文件報告爲「AVC([email protected])」 - 但這些標誌是基線配置文件的一部分!