Generate individual HLS-compatible .ts segments on-demand by downloading as little bytes as possible from a remote input file

This project received 3 bids from talented freelancers with an average bid price of $39 USD / hour.

Get free quotes for a project like this
Project Budget
$25 - $50 USD / hour
Total Bids
Project Description

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 [url removed, login to view] -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 [url removed, login to view], 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:

[url removed, login to view]

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!

PS: As I'm not sure about what's the best solution to accomplish this, I would be happy to discuss the task ahead and the amount of work this would require.

Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online