google / ExoPlayer

An extensible media player for Android
Apache License 2.0
21.64k stars 6k forks source link

Interlaced hls with bt470bg in video #8738

Closed PoghosyanRoman closed 3 years ago

PoghosyanRoman commented 3 years ago

Hello, i try to play some interlaced hls lives with exoplayer, them have different codecs. Both h264/acc but some have yuv420p(tv, bt470bg, top first) some is yuv420p(tv, , top first). The streams who have yuv420p(tv, top first) playing normal , streams yuv420p(tv,bt470bg, top first) stuck on buffering. is it normal ?

AquilesCanta commented 3 years ago

No, and interlacing (and all video compression details) is almost surely completely unrelated to buffering. If you want us to assist with this, please provide the information required in the issue template.

PoghosyanRoman commented 3 years ago

player init by :

Player is last 2.13.2 Android 9 stb based on amlogic s905w

 private void Prepare_Player()
    {
        @SuppressLint("WrongConstant") DefaultExtractorsFactory extractorsFactory =
                new DefaultExtractorsFactory()
                        .setTsExtractorFlags(DefaultTsPayloadReaderFactory.FLAG_DETECT_ACCESS_UNITS | DefaultTsPayloadReaderFactory.FLAG_ALLOW_NON_IDR_KEYFRAMES | DefaultTsPayloadReaderFactory.FLAG_OVERRIDE_CAPTION_DESCRIPTORS).setTsExtractorMode( TsExtractor.TS_STREAM_TYPE_AAC_ADTS );
        player =new SimpleExoPlayer.Builder(this, new DefaultRenderersFactory(this)).setTrackSelector(new DefaultTrackSelector(this)).setMediaSourceFactory(
                new DefaultMediaSourceFactory(this, extractorsFactory)).setLoadControl(new DefaultLoadControl.Builder()
                .setPrioritizeTimeOverSizeThresholds(false).build()).setSeekParameters(SeekParameters.CLOSEST_SYNC ).build();
                //new SimpleExoPlayer.Builder(_ctx).build();
        StyledPlayerView pw = findViewById(R.id.player_view);
        pw.setUseController(false);
        pw.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FILL);
        pw.setPlayer(player);

and next i giv him urls by 

 Uri mp4VideoUri = Uri.parse(item.getItemUrl());
            MediaItem mediaItem = new MediaItem.Builder()
                    .setUri(mp4VideoUri)
                    .setDrmUuid(C.WIDEVINE_UUID)
                    .build();

            // Prepare the player with the source.
            player.setMediaItem(mediaItem);

at this time the stream have parametrs Input #0, mpegts, from 'http://10.100.100.9:8888/ngw.ts': Duration: N/A, start: 90621.328378, bitrate: N/A Program 19116 Metadata: service_name : service_provider: Stream #0:00xdd: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 127 kb/s Stream #0:10xde: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 164 kb/s Stream #0:2[0xd3]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:11 DAR 20:11], 25 fps, 50 tbr, 90k tbn, 50 tbc Stream #0:30x401: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)

playing normal without any problem but stream Input #0, hls, from 'http://10.100.100.9:8888/ngw/index.m3u8': Duration: N/A, start: 91505.803044, bitrate: N/A Program 0 Metadata: variant_bitrate : 0 Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp Metadata: variant_bitrate : 0 Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp Metadata: variant_bitrate : 0 Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt470bg), 720x576 [SAR 16:11 DAR 20:11], 50 fps, 50 tbr, 90k tbn, 50 tbc Metadata: variant_bitrate : 0 Stream #0:3: Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) Metadata: variant_bitrate : 0

stuck on buffering

AquilesCanta commented 3 years ago

The provided uri http://10.100.100.9:8888/ngw/index.m3u8 is not accessible to me. It's a reserved IP. Please provide a link to the content which is publicly available.

EDIT: Also, TsExtractor.TS_STREAM_TYPE_AAC_ADTS is not a valid value to pass to setTsExtractorMode().

PoghosyanRoman commented 3 years ago

try this : http://91.205.196.11:8888/ngw/index.m3u8 i open it tempoary

PoghosyanRoman commented 3 years ago

EDIT: Also, TsExtractor.TS_STREAM_TYPE_AAC_ADTS is not a valid value to pass to setTsExtractorMode(). added as try. whithout it not playing too

AquilesCanta commented 3 years ago

I'm able to access http://91.205.196.11:8888/ngw/index.m3u8. However, neither a segment as a standalone file, or the HLS version of the media have "stuck in buffering" issues. Both versions succeed in starting playback. Can you:

PoghosyanRoman commented 3 years ago

how init the player then it play normal ? i show a part of code on my side , and it not play this live

AquilesCanta commented 3 years ago

I don't understand the question. Are you passing DefaultTsPayloadReaderFactory.FLAG_ALLOW_NON_IDR_KEYFRAMES to your DefaultHlsExtractorFactory?

The flag you need to set should be passed to this DefaultHlsExtractorFactory constructor. You need to pass the created DefaultHlsExtractorFactory instance to HlsMediaSource.Factory's setExtractorFactory. And then you use that HlsMediaSource factory to create the media source with which you prepare the player.

I'm assigning to @marcbaechinger in case you have any questions about going from the MediaItem API to customizing the HLS MediaSource.

PoghosyanRoman commented 3 years ago

ok thank you. the problem solved then i use DefaultHlsExtractorFactory and not mediasource