I'm trying to stream to mobile devices with ffmpeg and apache2.2 but I haven't been successful.
I used this command to create the segments and the playlist:
ffmpeg -i http://x.x.x.x:8080 -codec:v libx264 -r 25 -pix_fmt yuv420p -profile:v baseline -level 3 -b:v 500k -s 640x480 -codec:a aac -strict experimental -ac 2 -b:a 128k -movflags faststart -flags -global_header -map 0 -f hls -hls_time 10 -hls_list_size 5 -hls_allow_cache 0 -sc_threshold 0 -hls_flags delete_segments -hls_segment_filename out%05d.ts list.m3u8
The source is a http stream which is streamed by VLC media player.
Example content of the list.m3u8 file:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:89
#EXTINF:10.000000,
out00089.ts
#EXTINF:10.000000,
out00090.ts
#EXTINF:10.000000,
out00091.ts
#EXTINF:10.000000,
out00092.ts
#EXTINF:9.000000,
out00093.ts
#EXT-X-ENDLIST
I created another playlist file - playlist.m3u8:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=512000
http://x.x.x.x/list.m3u8
If I open this (playlist.m3u8) file in VLC media player then it plays. It also works in desktop chrome and desktop firefox browsers with Video-js plugin flash fallback.
I set the correct MIME types to the .ts and .m3u8 files in .htaccess file:
AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts
FFprobe output for playlist.m3u8:
Input #0, hls,applehttp, from 'playlist.m3u8':
Duration: N/A, start: 1.400000, bitrate: N/A
Program 0
Metadata: variant_bitrate : 512000
Stream #0:0: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 90k tbn, 50 tbc
Metadata: variant_bitrate : 512000
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 128 kb/s
Metadata: variant_bitrate : 512000
What should I do to make it work?
UPDATE
It works if I provide a link to list.m3u8 file (created by ffmpeg).
Be careful .m3u8
stream is not fully supported in Android devices,
"I have seen a lot of people have problems playing .M3U8, it depends on the codecs used for the streaming and compatibility with the device, for example some of my .m3u8 files are only supported in devices with screens of 1200 x800 and higher."
Source: Play m3u8 video in android
like an option use .mp4 streaming
or you can use a Framework like: , https://www.vitamio.org/en/