[FFmpeg-user] HLS/fmp4 contains 0x47 in unfortunate places

David Ing ding at panopto.com
Wed Feb 15 00:19:00 EET 2023


I am generating HLS/fmp4 as follows:

ffmpeg -hide_banner -loglevel warning
   -itsoffset 0.010666450 -i audio.121063.m4a
   -i video.242528.m4v
   -i video.141815.m4v
   -i video.84763.m4v
   -map 0:a:0 -map 1:v:0 -map 0:a:0 -map 2:v:0 -map 0:a:0 -map 3:v:0
   -c:a copy
   -c:v copy
   -copyts
   -bsf:v setts=pts='not(not(N))*PTS'
   -var_stream_map "a:0,v:0,name:363591 a:1,v:1,name:262878
a:2,v:2,name:205826"
   -hls_flags single_file+independent_segments
   -hls_playlist_type vod
   -hls_segment_type fmp4
   -hls_list_size 0
   -hls_time 9
   -hls_segment_filename hls/%v/fragmented.mp4
   -f hls hls/%v/index.m3u8


The resulting HLS/fmp4 seems to be valid, but at least one player (hls.js)
has a problem.  The player believes the fmp4 file is mpegts because it sees
the byte 0x47 appearing three times in the stream, with very specific
offsets:

   - 0x47 @ i
   - 0x47 @ i + 188
   - 0x47 @ i + 376

This does not happen in most cases, just in one unlucky case (with specific
media files).

I have 2 questions about this:

   1. Is there an ffmpeg command that can insert short (meaningless) byte
   sequences to prevent the mpegts pattern (described above) from appearing?
   2. If not, I'd like to build my own.  Is there a particular escape
   sequence that allows one to insert a meaningless byte into the stream of
   mp4 bytes?


More information about the ffmpeg-user mailing list