1

Recently I am using FFmpeg for a project. I used FFmpeg to convert mp3 bitrates and other stuff. Those are working perfectly. But now I want to add mp3%2Fmusic%2F[outputN.ts]?alt=media for every outputN.ts texts inside the m3u8 file. This my m3u8 file data structure,


#EXTM3U

#EXT-X-VERSION:3

#EXT-X-TARGETDURATION:2

#EXT-X-MEDIA-SEQUENCE:0

#EXTINF:2.005333,

'output000.ts'

#EXTINF:2.005333,

'output001.ts'


For Example, Now I want to apply mp3%2Fmusic%2F and ?alt=media for every text (output000.ts,output001.ts and so on) inside this m3u8 file using windows cmd. For instance,


#EXTINF:2.005333,

mp3%2Fmusic%2Foutput000.ts?alt=media

#EXTINF:2.005333,

mp3%2Fmusic%2Foutput001.ts?alt=media


Isuru Bandara
  • 310
  • 1
  • 3
  • 14
  • Please review the SO help https://stackoverflow.com/help regarding providing an MRE (Minimal Reproducable Example). Without an MRE, this question should be migrated to https://superuser.com/ – lit Aug 13 '20 at 18:27

1 Answers1

1

You can use the -hls_segment_filename as parameter when creating your hls output.

example:

ffmpeg -i in.nut -hls_segment_filename 'file%03d.ts' out.m3u8

This outputs the files file000.ts, file001.ts, file002.ts, etc.

You could put as string param -hls_segment_filename mp3%2Fmusic%2Foutput%03d.ts?alt=media to get your result.

You can find more in the Documentation

Dirk V
  • 1,373
  • 12
  • 24
  • Thank you for effort, but I used your command before asking the question to add file names, it worked fine without reserved characters. But, windows does not let use reserved characters(in this case "?" ) in windows. If I'm going to use string param will it work? – Isuru Bandara Aug 14 '20 at 03:21
  • The `?` character is not permitted in a filename on Windows. https://stackoverflow.com/a/1976050/447901 – lit Aug 14 '20 at 14:02