MPEG-TS H.264 with ExoPlayer

I have two mpeg-ts + h.264 video files that I am trying to read on an Android device (Samsung Tab A 10.1) using 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); 

The first is successful (the image is displayed correctly), but the second fails (the image is not displayed), although both of them are very similar in terms of video characteristics. I would like to understand why.

I used mediainfo to extract video encoding details.

First video (successful):

 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 : High@L4.0 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%) 

Second video (failed):

 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 : High@L4.0 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 
+5
source share
1 answer

The differences between the two allocated files are bit rates. A worker has a much higher data rate, and he is constant, while a broken one has the same high resolution, but much lower and variable transmission speed. Without knowing more than the statistics provided, I would blame the tool used to encode the video. Perhaps something about the configuration is causing the encoder to output black frames. Have you tried the same files on another device? Can you recode several different settings?

+1
source

Source: https://habr.com/ru/post/1266026/


All Articles