I am trying to create a streaming app using ExoPlayer on Android. Most of the streams works fine, only some of them does not play sound on some devices only.
Here is the stream info extracted using this command:
ffprobe -v error -show_format -show_streams http://nasaiptv.com:8000/live/qSplUhwfcy/bE43JqZPSt/477.ts
[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_time_base=1/25
codec_tag_string=[2][0][0][0]
codec_tag=0x0002
width=720
height=576
coded_width=0
coded_height=0
has_b_frames=1
sample_aspect_ratio=16:15
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=8
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
timecode=N/A
refs=1
id=0x100
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/90000
start_pts=3471311880
start_time=38570.132000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[STREAM]
index=1
codec_name=mp2
codec_long_name=MP2 (MPEG audio layer 2)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[3][0][0][0]
codec_tag=0x0003
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=0x101
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/90000
start_pts=3471301664
start_time=38570.018489
duration_ts=N/A
duration=N/A
bit_rate=112000
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[FORMAT]
filename=http://nasaiptv.com:8000/live/qSplUhwfcy/AVbqREBSOh/477.ts
nb_streams=2
nb_programs=1
format_name=mpegts
format_long_name=MPEG-TS (MPEG-2 Transport Stream)
start_time=38570.018489
duration=N/A
size=N/A
bit_rate=N/A
probe_score=50
[/FORMAT]
And this is the way I start playing the stream:
private SimpleExoPlayer player;
private PlayerView exoPlayer;
private void initializePlayer() {
exoPlayer = findViewById(R.id.exo_player);
player = ExoPlayerFactory.newSimpleInstance(
new DefaultRenderersFactory(this, EXTENSION_RENDERER_MODE_ON),
new DefaultTrackSelector(),
new DefaultLoadControl());
player.addListener(listener);
exoPlayer.setPlayer(player);
player.setPlayWhenReady(true);
Uri uri = Uri.parse(stream.getStreamUriString());
MediaSource mediaSource = new ExtractorMediaSource.Factory(
new DefaultHttpDataSourceFactory("exoplayer-codelab")).createMediaSource(uri);
player.prepare(mediaSource, true, false);
}
I also tried with EXTENSION_RENDERER_MODE_OFF
and with EXTENSION_RENDERER_MODE_PREFER
, no success.
This is after importing the extensions in the sample project into my project.
Is this an ffmpeg
problem? In case I have to build the extension from scratch, is there anyway to do it in Windows? Installing Linux on my PC is somewhat problematic. And is there any tutorial to do it correctly, according to my stream info?
ExoPlayer is a great media player, but it really lacks documentation (or is hard to find).