带有ExoPlayer的MPEG-TS H.264 [英] MPEG-TS H.264 with ExoPlayer

查看:99
本文介绍了带有ExoPlayer的MPEG-TS H.264的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个mpeg-ts + h.264视频文件,我尝试使用ExoPlayer在Android设备(Samsung Tab A 10.1)上读取这些文件:

I have two mpeg-ts + h.264 video files, which I attempt to read on an Android device (Samsung Tab A 10.1") with 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 one succeeds (image is correctly displayed) but the second one fails (no image displayed), though they are both very similar in terms of video characteristics. I'd like to understand why.

我使用 mediainfo 提取视频编码详细信息.

I used mediainfo to extract video encoding details.

第一个视频(成功):

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%)

第二个视频(失败):

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

推荐答案

突出显示的两个文件之间的区别在于比特率.工作的比特率高得多,并且它是恒定的,而损坏的比特率具有相同的高分辨率,但是比特率却低得多且可变.如果不了解所提供的统计信息,我将归咎于用于对视频进行编码的工具.关于配置的某些信息可能会导致编码器输出黑帧.您是否在其他设备上尝试过相同的文件?您可以使用稍微不同的设置重新编码吗?

The differences between the two files that stand out are the bit rates. The working one has a much higher bit rate, and it is constant, whereas the broken one has the same high resolution, but a much lower and variable bit rate. Without knowing more than the provided stats, I would blame the tool used to encode the video. Maybe something about the configuration causes the encoder to output black frames. Have you tried the same files on a different device? Can you re-encode with slightly different settings?

这篇关于带有ExoPlayer的MPEG-TS H.264的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆