[FFmpeg-user] Generate individual HLS-compatible .ts segments on-demand by downloading as little bytes as possible from a remote input file
Romain Cointepas
romain.cointepas at gmail.com
Thu Dec 1 02:46:42 EET 2016
Hey,
I’m trying to generate individual HLS-compatible .ts segments on-demand by
downloading/reading as little bytes as possible from a remote input file
(hosted on a server supporting byte-ranges requests).
One of the application for this would be to be able to transcode and play
on Apple TV (via Airplay) a remote file that is not Airplay compatible,
without having to download the entire file first.
I am generating the playlist myself, and I have access to the ffprobe
results for the remote file (that gives video duration, etc.).
I have something working that plays via Airplay but with small video and
audio glitches between each segments when I use the following command to
generate each segment:
ffmpeg -ss 30 -t 6 -i http://s3.amazonaws.com/misc-12345/avicii.vob -f
mpegts -map 0:v:0 -map 0:a:0 -c:v libx264 -bsf:v h264_mp4toannexb
-force_key_frames "expr:gte(t,n_forced*6)" -forced-idr 1 -pix_fmt yuv420p
-colorspace bt709 -c:a aac -async 1 -preset ultrafast pipe:1
Note: above command is for segment 6.ts, and in the m3u8 playlist I
advertise each segment duration as 6 seconds.
Here is a Youtube video showing the audio/video glitches between segments:
https://www.youtube.com/watch?v=0vMwgbSfsu0
The segment or hls modules of ffmpeg can’t be used because they both
generate all the segments at once.
I’ve been struggling on this for some days now and I would really
appreciate some help!
Thanks,
Romain
More information about the ffmpeg-user
mailing list