ExoPlayer不会对它们使用FFMPEG设备播放音频 [英] ExoPlayer doesn't play audio on devices which use FFMPEG

查看:791
本文介绍了ExoPlayer不会对它们使用FFMPEG设备播放音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了ExoPlayer传输音频和它精美的作品在某些设备上我有(例如,我的Nexus 5),但在其他它根本没有发挥任何东西。

I've set up ExoPlayer to stream audio and it works beautifully on some devices I have (eg, my Nexus 5) but on others it simply doesn't play anything at all.

要消除我的应用程序的任何问题,我已经改变了晕视频随机MP3我得坐在服务器上修改演示程序。在DefaultRendererBuilder我还回一个空视频轨道渲染和我只是尝试播放音频。

To eliminate any issues with my app, I've modified the demo app by changing the "Dizzy" video to a random MP3 I've got sitting on a server. In DefaultRendererBuilder I'm also returning a null video track renderer and am only attempting to play audio.

显然,每个设备都有自己的一套codeCS,所以我怀疑,也许错了越来越被加载并打破。我见过一对夫妇,其中一个去codeR从MIME类型确定在ExoPlayer源点,我想我已经将范围缩小到一个行 FrameworkSampleSource prepare 方法。

Obviously each device has its own set of codecs and so I suspected that maybe the wrong one was getting loaded and breaking. I've seen a couple of points in the ExoPlayer source where a decoder is determined from a MIME type and I think I've narrowed it down to a line in FrameworkSampleSource in the prepare method.

只要的setDataSource 被调用时,华为伴侣7设备上我使用,所有的地狱破散。它看起来像 MediaExtractor 使用FFMPEG中提取数据,这似乎并不兼容。我已经测试过其他设备不会出现这样做。下面是从LogCat中转储

As soon as setDataSource is called, on the Huawei Mate 7 device I'm using, all hell breaks loose. It looks like the MediaExtractor uses FFMPEG to extract the data, which does not seem to be compatible. Other devices I've tested with do not appear to do this. Here's the dump from LogCat

11-13 16:30:45.600 30793-30793/com.google.android.exoplayer.demo I/ExoPlayerImpl﹕ Init 1.0.13
11-13 16:30:45.605 30793-30881/com.google.android.exoplayer.demo I/﹕ uri = http://this-is-my-server.com/public/mime-test.mp3
11-13 16:30:45.605 30793-30881/com.google.android.exoplayer.demo I/﹕ after judge whether is youtube , isWidevine = 0
11-13 16:30:45.605 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractor﹕ FFMPEGExractor opened file is [http://this-is-my-server.com/public/mime-test.mp3]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo E/FFMPEGExtractor﹕ Can not find video stream!
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo E/FFMPEGExtractorUtils﹕ Couldn't find MIME by codec id 86017 !
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractor﹕ Unknown MIME,try using ffmpegaudiodecorder to decode
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractor﹕ setAudioMeta MIME = audio/ffmpeg
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractor﹕ audio/ffmpeg set kKeyFFmpegCodecID,codec->codec_id =     86017
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ Audio:
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ {
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ kKeyMIMEType = [audio/ffmpeg]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ kKeyDuration = [00:01:43.42]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ kKeyBitRate = [128000 bps]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ kKeyChannelCount = [1]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ kKeySampleRate = [44100 bps]
11-13 16:30:45.790 30793-30881/com.google.android.exoplayer.demo I/FFMPEGExtractorUtils﹕ }
11-13 16:30:45.790 30793-30883/com.google.android.exoplayer.demo I/OMXClient﹕ Using client-side OMX mux.
11-13 16:30:45.795 30793-30883/com.google.android.exoplayer.demo I/MediaCodec﹕ Found 0 pieces of codec specific data.
11-13 16:30:45.795 30793-30883/com.google.android.exoplayer.demo I/ACodec﹕ allocateBuffersOnPort,isHevc = 0
11-13 16:30:45.795 30793-30883/com.google.android.exoplayer.demo I/ACodec﹕ allocateBuffersOnPort,isHevc = 0
11-13 16:30:47.210 30793-30881/com.google.android.exoplayer.demo W/FFMPEGExtractor﹕ retry to read pakcet
11-13 16:30:47.210 30793-30881/com.google.android.exoplayer.demo W/FFMPEGExtractor﹕ retry to read pakcet
11-13 16:30:47.210 30793-30881/com.google.android.exoplayer.demo W/FFMPEGExtractor﹕ retry to read pakcet
11-13 16:30:47.210 30793-30881/com.google.android.exoplayer.demo W/FFMPEGExtractor﹕ retry to read pakcet
11-13 16:30:47.210 30793-30881/com.google.android.exoplayer.demo E/FFMPEGExtractor﹕ Reaching the end of file! streamId : 0

正如你可以看到,它似乎并没有能够正确检测MIME类型。如果我通过在完全相同的文件,该文件在磁盘上的本地版本,它会发挥得很好,只是没有如果是在服务器上。 FFMPEG似乎并不明白MIME是什么,只是使用它自己的bastardised音频/ ffmeg哑剧来代替。它似乎得到持续时间等,但就是无法播放该文件。

As you can see, it doesn't seem to be able to detect the MIME type properly. If I pass in the EXACT SAME file that's a local version on disk, it'll play just fine, just not if it's on the server. FFMPEG doesn't seem to understand what the MIME is and just uses its own bastardised "audio/ffmeg" mime instead. It seems to get the duration and such, but just cannot play the file.

如果我设置一个监听器ExoPlayer,我可以看到它通过每个国家的移动 - preparing,缓冲,但从来没有准备好。这将摆脱'缓冲'到'结束'。

If I set a listener on ExoPlayer, I can see it move through each of the states - preparing, buffering, but NEVER ready. It will move from 'buffering' to 'ended'.

虽然我不知道这是一个特定ExoPlayer-问题,肯定有人一定都遇到过类似这样的东西吗?这是一个pretty基本用例 - 只是用线播放MP3 -

While I'm not sure this is an ExoPlayer-specific issue, surely someone must have encountered something similar to this? It's a pretty basic use-case - just playing an MP3 using the lines -

SampleSource sampleSource = new FrameworkSampleSource(context, uri, headers, RENDERER_COUNT);
audioTrackRenderer = new MediaCodecAudioTrackRenderer(sampleSource, null, true);

没有什么太令人兴奋了那里。我究竟做错了什么?我能做些什么来解决呢?我甚至在内容类型,通过:音频/ MPEG作为标题,它什么都不做。

Nothing too exciting there. What am I doing wrong? What can I do to work around it? I've even passed in "Content-Type": "audio/mpeg" as a header and it does nothing.

推荐答案

Exoplayer现在有一个应用程序级的媒体提取(目前在Dev分支)的,因为它不通过Android的破MediaExtractor运行完全避免了这个问题。

Exoplayer now has an application-level media extractor (currently on the dev branch) which avoids this issue entirely as it doesn't run through Android's broken MediaExtractor.

退房的演示应用程序的PlayerActivity和ExtractorRendererBuilder以获得如何使用它的想法。

Check out the demo app's PlayerActivity and ExtractorRendererBuilder to get an idea of how to use it.

这篇关于ExoPlayer不会对它们使用FFMPEG设备播放音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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