2017-03-28 103 views
5

我有兩個MPEG-TS + H.264視頻文件,這是我嘗試與ExoPlayer Android裝置(三星標籤甲10.1" )上讀取:MPEG-TS H.264與ExoPlayer

SimpleExoPlayerView view = new SimpleExoPlayerView(this); 
TrackSelection.Factory videoTrackSelectionFactory = new AdaptiveVideoTrackSelection.Factory(new DefaultBandwidthMeter()); 
TrackSelector trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory); 
SimpleExoPlayer mediaPlayer = ExoPlayerFactory.newSimpleInstance(this, trackSelector, new DefaultLoadControl()); 
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, getString(R.string.app_name))); 
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory(); 
MediaSource source = new ExtractorMediaSource(uri, dataSourceFactory, extractorsFactory, null, null); 
view.setPlayer(mediaPlayer); 
mediaPlayer.setPlayWhenReady(true); 
mediaPlayer.prepare(source); 

第一個成功(圖像正確顯示),但第二個失敗(沒有圖像顯示),雖然它們在視頻特性方面都非常相似,但我想了解其原因。視頻編碼細節

第一個視頻(成功FUL):

General 
ID          : 0 (0x0) 
Complete name       : 1080i.ts 
Format         : MPEG-TS 
File size        : 56.7 MiB 
Duration         : 47s 456ms 
Overall bit rate mode     : Constant 
Overall bit rate       : 10.0 Mbps 

Video 
ID          : 256 (0x100) 
Menu ID         : 1 (0x1) 
Format         : AVC 
Format/Info        : Advanced Video Codec 
Format profile       : [email protected] 
Format settings, CABAC     : Yes 
Format settings, ReFrames    : 2 frames 
Codec ID         : 27 
Duration         : 47s 282ms 
Bit rate         : 9 185 Kbps 
Width         : 1 920 pixels 
Height         : 1 080 pixels 
Display aspect ratio      : 16:9 
Frame rate        : 29.970 fps 
Color space        : YUV 
Chroma subsampling      : 4:2:0 
Bit depth        : 8 bits 
Scan type        : MBAFF 
Bits/(Pixel*Frame)      : 0.148 
Stream size        : 51.8 MiB (91%) 

第二部影片(失敗):

General 
ID          : 1 (0x1) 
Complete name       : fr5.ts 
Format         : MPEG-TS 
File size        : 13.8 MiB 
Duration         : 32s 270ms 
Overall bit rate mode     : Variable 
Overall bit rate       : 3 557 Kbps 

Video 
ID          : 420 (0x1A4) 
Menu ID         : 1045 (0x415) 
Format         : AVC 
Format/Info        : Advanced Video Codec 
Format profile       : [email protected] 
Format settings, CABAC     : Yes 
Format settings, ReFrames    : 4 frames 
Codec ID         : 27 
Duration         : 31s 760ms 
Bit rate         : 3 252 Kbps 
Width         : 1 920 pixels 
Height         : 1 080 pixels 
Display aspect ratio      : 16:9 
Frame rate        : 25.000 fps 
Standard         : Component 
Color space        : YUV 
Chroma subsampling      : 4:2:0 
Bit depth        : 8 bits 
Scan type        : MBAFF 
Bits/(Pixel*Frame)      : 0.063 
Stream size        : 12.3 MiB (89%) 
Color primaries       : BT.709 
Transfer characteristics     : BT.709 
Matrix coefficients      : BT.709 
+0

2個流之間的唯一區別是支持的參考幀的數量。這不太可能是一個問題,因爲玩家將擁有一個通用的解碼器,但仍然可以通過僅使用2個參考幀嘗試其他序列來進行檢查? – prashanthns

回答

1

脫穎而出兩個文件之間的差異的比特率。工作的比特率高得多,並且是恆定的,而破碎的比特率具有相同的高分辨率,但是具有更低的可變比特率。如果不知道提供的統計數字,我會責怪用於編碼視頻的工具。也許關於配置的東西會導致編碼器輸出黑色幀。你是否在不同的設備上嘗試過相同的文件?你可以用稍微不同的設置重新編碼嗎?

+0

我試過幾種不同的設備,總是得到相同的結果。第一個文件是我在網上找到的示例文件。第二個來自iptv流(我不能配置任何東西),我的最終目標是能夠讀取第二個流。 – fiddler

+0

您是否在日誌中看到任何錯誤,表明這是哪種錯誤?如果您正在播放不屬於您的視頻流,則可能受DRM保護。 – Jschools