Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with MPEG TS Container support #187

Open
SecureTVBob opened this issue Apr 18, 2022 · 7 comments
Open

Help with MPEG TS Container support #187

SecureTVBob opened this issue Apr 18, 2022 · 7 comments

Comments

@SecureTVBob
Copy link

Hi LiTr is really cool code as was your approach to transcoding.
We have an MPEG2 video in an MPEG TS container from an ATSC video tuner.
LiTr properly transcodes the MPEG2 video to H.264 when the input video is an MP4 container.
On some Set Top Box devices LiTr will not transcode the same MPEG2 video in an MPEG TS container. We adjusted LiTr code to accept mime/mpeg2 video from the file with Transport Stream container.

It seems like when the MPEG TS container with MPEG2 video is open some parameter is not set for the encoder.
The Amlogic OMX encoder error is 0x8001001 which is an error for OMX to report "Unknown error."

Any suggestions on how to get the parameters configured properly so the encoder will work.
What also is interesting is LiTr can decode the MPEG2 video in a MPEG TS container because extract frame and video filters can decode and play the video.

Any suggestions on how to debug or what settings encoder might need or how to fix?

This is link for MPEG2 video in MP4 container that works well with LiTr transcoder:
https://drive.google.com/file/d/1VFoAL1xJNw6pAq-fp1rMhwMfwaQ3uP1o/view?usp=sharing

This link is for same MPEG2 video in MPEG TS container:
https://drive.google.com/file/d/15Qmh12BFCJudwmgiTe8ucI5wdYfsWm24/view?usp=sharing

@izzytwosheds
Copy link
Contributor

Thank you for enjoying LiTr! I didn't realize one could use LiTr on a set top box. Can you tell a bit more about how you guys use it? I am extremely curious.

I will look into this. I tried playing those two videos on my Android device (Samsung Galaxy Note 10), and they are behaving very strange. MP4 video does not play at all, TS video plays audio only. Tried with both built-in player and ExoPlayer, same problem on both. I think, something funky is going on with container parsing,MediaMetadataRetriever was not even able to extract a thumbnail. Can you guys share what you did to make this work, or is proprietary know-how?

As for encoder, one possible idea comes to mind is to maybe try to play around with different colors formats for the encoder. I wonder if decoder is producing frames in some format that is not compatible with what encoder expects. Shouldn't be the case, but might be worth a try. I will keep thinking about it.

@SecureTVBob
Copy link
Author

SecureTVBob commented Apr 19, 2022 via email

@izzytwosheds
Copy link
Contributor

I ran ffprobe, got some strange errors about invalid frame size and some corrupt packets:

[mpeg2video @ 0x7fb74d808800] Invalid frame dimensions 0x0.
Last message repeated 30 times
[mpegts @ 0x7fb74d00f400] PES packet size mismatch
[mpegts @ 0x7fb74d00f400] Packet corrupt (stream = 1, dts = 359012687).
[mpegts @ 0x7fb74d00f400] PES packet size mismatch
[mpegts @ 0x7fb74d00f400] Packet corrupt (stream = 2, dts = 359012687).
Input #0, mpegts, from 'kgtv-10-abc-atsc-capture.ts':
Duration: 00:01:19.55, start: 3909.989856, bitrate: 8355 kb/s
Program 3
Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Side data:
cpb: bitrate max/min/avg: 17598000/0/0 buffer size: 7995392 vbv_delay: N/A
Stream #0:10x34: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
Stream #0:20x35: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s

I wonder if this could be throwing off OMX codecs. QuickTime on Mac was able to play the .ts file, but with artifacts in the beginning.

@SecureTVBob
Copy link
Author

SecureTVBob commented Apr 20, 2022 via email

@izzytwosheds
Copy link
Contributor

Having trouble reproducing this locally. Devices I am trying this on do not have an MPEG2 decoder.

@SecureTVBob
Copy link
Author

Is there something I can do here with some additional debug outputs added?

@izzytwosheds
Copy link
Contributor

One possible way I can think of is comparing mediaFormats in CodecUtil.configureMediaFormat for .ts and MP4 inputs. That would let us see what exactly is being sent to encoder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants