google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

MPEG-TS NO_SUPPORTED_TYPE #2069

Closed dmfrey closed 7 years ago

dmfrey commented 7 years ago

I am attempting to play MPEG-TS streams that are recorded on a MythTV Backend in the app MythTV Player. However, every attempt to produce a MediaSource from the input url. The EventLogger output from the demo app produces this output:

11-14 23:34:48.413 16480-16480/org.mythtv.android D/EventLogger: sourceInfo [periodCount=1, windowCount=1
11-14 23:34:48.413 16480-16480/org.mythtv.android D/EventLogger:   period [?]
11-14 23:34:48.413 16480-16480/org.mythtv.android D/EventLogger:   window [?, false, false]
11-14 23:34:48.413 16480-16480/org.mythtv.android D/EventLogger: ]
11-14 23:34:48.441 16480-16680/org.mythtv.android W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
11-14 23:34:48.476 16480-16680/org.mythtv.android I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
11-14 23:34:48.481 16480-16480/org.mythtv.android D/EventLogger: Tracks [
11-14 23:34:48.481 16480-16480/org.mythtv.android D/EventLogger:   Renderer:0 [
11-14 23:34:48.481 16480-16480/org.mythtv.android D/EventLogger:     Group:0, adaptive_supported=N/A [
11-14 23:34:48.481 16480-16480/org.mythtv.android D/EventLogger:       [ ] Track:0, id=null, mimeType=video/mpeg2, res=1920x1080, supported=NO_UNSUPPORTED_TYPE
11-14 23:34:48.481 16480-16480/org.mythtv.android D/EventLogger:     ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:   ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:   Renderer:1 [
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:     Group:0, adaptive_supported=N/A [
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:       [ ] Track:0, id=null, mimeType=audio/ac3, channels=6, sample_rate=48000, language=eng, supported=NO_UNSUPPORTED_TYPE
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:     ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:     Group:1, adaptive_supported=N/A [
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:       [ ] Track:0, id=null, mimeType=audio/ac3, channels=1, sample_rate=48000, language=eng, supported=NO_UNSUPPORTED_TYPE
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:     ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger:   ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger: ]
11-14 23:34:48.482 16480-16480/org.mythtv.android D/EventLogger: positionDiscontinuity
11-14 23:34:48.483 16480-16480/org.mythtv.android D/EventLogger: loading [false]

Of note here are the following lines:

11-14 23:34:48.441 16480-16680/org.mythtv.android W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
11-14 23:34:48.476 16480-16680/org.mythtv.android I/VideoCapabilities: Unsupported profile 4 

I have tried searching this issue and have not found a whole lot of details regarding these unsupported types.

I, unfortunately, cannot provide a stream to test as their file sizes make these files not easy to share. The range in the 3-15 Gb. I could, however, work with someone directly with an URL to my own backend, but this will have to be taken off-list.

I have setup the code to match the ExoPlayer demo app. I can point to a branch in my repo. It is using ExoPlayer version r2.0.4.

There is no bug report to produce as the output above is the only output. No exception has been thrown.

Testing is being performed on a Nexus 6 running Android 7.0. I can also test on a Samsung Galaxy S7 running Android 6.0.

AquilesCanta commented 7 years ago

Does the stream play well on the same device using other player (i.e. MediaPlayer)? If not, then the device probably does not support the any of the formats (as stated in the provided log message).

We can have a look if you provide a stream for us to look at. Since it's a TransportStream, you should be able to cut the file at any reasonable(in terms of file size, say 30MB) point and provide us with that.

andrewlewis commented 7 years ago

Also, what device are you trying to play this stream on? AC-3 playback requires either HDMI passthrough on Android L (or later), or an on-device decoder for AC-3. Also, not all Android devices have MPEG-2 video decoders. This stream is unlikely to be playable on many non-TV devices.

dmfrey commented 7 years ago

It does play in VLC for Android. I am working on getting a chunk of a file to share.

Here is a 30M file that was truncated from a recording. It's about 20 seconds long.

https://drive.google.com/open?id=0B4KM23cDPRz_YklTSUgxTnFqTVU

It plays fine with both audio and video on VLC for Android.

Is it possibly because DRM or extensions aren't set up?

andrewlewis commented 7 years ago

For playing the audio with ExoPlayer, you can either rely on HDMI passthrough or use the ffmpeg extension (you'd need to compile FFmpeg with an AC-3 decoder).

We don't provide an extension for decoding MPEG-2 video. According to the CDD, including an MPEG-2 decoder is "strongly recommended" for Android TV devices.

VLC probably bundles software codecs for MPEG-2 video and AC-3 audio decoding so it doesn't rely on platform support for decoding these formats.

dmfrey commented 7 years ago

Thank you for your response. I have a few questions.

  1. The demo app shows how to integrate ffmpeg. Is that all that is required to handle the audio?
  2. I will gladly provide an mpeg2 codec. Can you point me in the right direction for obtaining one? Is it also imported as an extension, like ffmpeg?
ojw28 commented 7 years ago

As an aside, note that even if you get this stream working, you still wont be able to seek within it. See here. We have no plans to enable seeking in containers that do not efficiently support it. Note also that a software MPEG-2 decoder is likely going to perform significantly worse and consume more battery than the hardware backed H264 decoders available on many Android devices (some newer devices also have hardware backed H265 and VP9 decoders).

If this is for playback on mobile devices (as opposed to an AndroidTV) then I'd suggest you investigate the alternative path of transcoding your streams into a more suitable format. Searching for "mythtv transcode" on Google suggests there are tools and resources to do this.

dmfrey commented 7 years ago

I understand your concerns regarding battery life and not being able to seek. This is a request from users who don't have a backend that is powerful enough to perform HLS transcodes. The app already supports HLS viewing and it will cast those streams to Chromecast.

My goal with ExoPlayer was to not have to require the users to have an external video player installed.

I do support Android TV as well, so, in that case, this should fit nicely. If they can't seek, no big deal. If they don't want commercials, they can always transcode it with a commercial flag cutlist to remove them.

I was going down the road of implementing that cutlist and autoskipping commerccials, but since seeking in these containers isn't possible, i'm gonna abandon that. Doing this with HLS is also not always reliable, so I may just abandon that altogether. It would be nice to be on par with an actual MythTV Frontend, but if the platform doesn't support it, I won't be able to either.

ojw28 commented 7 years ago

To answer your specific questions above:

dmfrey commented 7 years ago

I got the ffmpeg extension setup, so audio plays now. Added --enable-decoder=ac3.

I did --enable-decoder=mpeg2video, but then I saw that the extension was only for audio.

For the video, when I looked at this page https://google.github.io/ExoPlayer/supported-formats.html, specifically under Standalone container formats, MPEG-TS is listed there. So I'm wondering why the video isn't playing. Does that not handle video/mpeg2?

ojw28 commented 7 years ago

Read the top of that page about the difference between container format and sample format. We support MPEG-TS as a container format, but the underlying platform still needs to provide a decoder for the sample format for playback to work. See the second column of the table here for supported sample formats, which does not contains video/mpeg2 (aka H262, I think).

Note that in addition, it's necessary for us to do some work to support each sample format at the container format level (e.g. parsing the correct decoder initialization data). It looks like we've already done that for H262 in MPEG-TS, here.

So in summary, if the device doesn't have a video/mpeg2 decoder you'll need to implement an extension that provides one, as per my previous response above.

dmfrey commented 7 years ago

Thanks for the update. I'm still working on figuring out the differences between levels.