[FFmpeg-user] VoD with HLS, different video and audio

Guido Holz guido at sportograf.com
Sun Feb 14 14:47:37 CET 2016


Hi,

I would like to generate a m3u8 file for HLS-streaming. The video has no
sound and i would like to add an additional audio stream to it.

My root video is a mp4 video

------- output of root.mp4 ----------
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'root.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2016-01-20 10:21:14
  Duration: 00:01:30.09, start: 0.000000, bitrate: 5317 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
bt709), 1280x720 [SAR 1:1 DAR 16:9], 4989 kb/s, 25 fps, 25 tbr, 25k tbn, 50
tbc (default)
    Metadata:
      creation_time   : 2016-01-20 10:21:14
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 317 kb/s (default)
    Metadata:
      creation_time   : 2016-01-20 10:21:14
      handler_name    : #Mainconcept MP4 Sound Media Handler


next I create the segments with
ffmpeg -i root.mp4  -vcodec libx264 -profile:v main -level 3.1 -b:v 500k
-vf "scale=480:-1" -crf 22 -map 0  -an -flags -global_header -segment_time
1 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*5)" -f segment
-reset_timestamps 1  -segment_format mpegts -segment_list index.m3u8
-segment_list_type m3u8 erg%03d.ts

than i extract the audio
ffmpeg -i root.mp4 -c:a libfdk_aac  -profile:a aac_he -b:a 128k -y audio.aac

my m3u8 files are looking like:

------- video.m3u8 ------------
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:6
#EXTINF:5.080000,
erg000.ts
#EXTINF:5.000000,
erg001.ts
#EXTINF:5.000000,
erg002.ts
...
#EXT-X-ENDLIST

------- audio.m3u8 ------------
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:90
#EXTINF:90.0,
audio.aac
#EXT-X-ENDLIST

------- playlist.m3u8 ------------
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="aac",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=688000,NAME="Main",CODECS="avc1.66.30",RESOLUTION=480x270,AUDIO="aac"
video.m3u8

Problem: I'm not realy sure, if the m3u8 files are correct. It's not
possible to play the AAC file with e.g. bitmovin player.  I compared it
with the example from
https://support.jwplayer.com/customer/portal/articles/1761348-multiple-audio-renditions
and downloaded an audiosegment and compared it with
ffprobe -v quiet -print_format json -show_format -show_streams audio.aac
but I don't see any differences.

Maybe someone is doing the same and can help me out to get the correct m3u8
files + a ffmpeg command that generates proper ts and aac file(s) I can
play in players like bitmovin etc.

Maybe there is someone I can hire for this project? It seems, that I need
only the correct commands

thanks for helping

PS: I'm trying now for many days and tried many commands I found but I
didn't find a correct solution
PPS: Why do I split video and audio? because I will replace few
video-segments with some others on demand but the audio should be always
the same.

-- 

Dipl.-Math. (FH) Guido Holz
managing director

www.sportograf.com :: photography for the love of sport

Sportograf GmbH & Co. KG
Dennewartstr. 25/27 :: 52068 Aachen :: Germany
tel/fax:  +49 (0) 241 9633 180
mobil:   +49 (0) 173 5184498
mail:     guido at sportograf.com

Amtsgericht Aachen
HRB 15932


More information about the ffmpeg-user mailing list