I am attempting to encode from file(mainly MP4) to HTTP Live Streaming(HLS) compatible streams. I'd like to encode segments with metadata, just like I can with single-file mpegts files.
The problem I encountered is when I specify metadata for the HLS segments, the metadata is confirmed in the console, but when I check the segments with FFprobe, it shows the default metadata. When I specify to output "mpegts" instead of "ssegment", the output file contains the metadata I specified.
./ffmpeg.20130129 -report -i ./source_media/bigbuckbunny_1500.mp4 -frames:v 480 -c:v libx264 -crf 25 -profile:v baseline -g 48 -sc_threshold 0 -flags +cgop -c:a aac -strict -2 -b:a 112k -map 0:v:0 -map 0:a:0 -f ssegment -metadata "service_provider=Some Provider" -metadata "service_name=Some Channel Name" -segment_time 10 -segment_format mpegts "hls_%02d.ts"
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v:0'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a:0'.
Reading option '-metadata' ... matched as option 'metadata' (add metadata) with argument 'service_provider=Some Provider'.
Reading option '-metadata' ... matched as option 'metadata' (add metadata) with argument 'service_name=Some Channel Name'.
Applying option map (set input stream mapping) with argument 0:v:0.
Applying option map (set input stream mapping) with argument 0:a:0.
Applying option metadata (add metadata) with argument service_provider=Some Provider.
Applying option metadata (add metadata) with argument service_name=Some Channel Name.
[adts @ 0x2d74760] Encoder did not produce proper pts, making some up.
ffmpeg-report_hls.log​ (61.8 KB) - added by nealzebub 6 years ago.
ffmpeg-report_single-ts.log​ (61.8 KB) - added by nealzebub 6 years ago.
Report from encoding to mpegts output, specifying metadata. For comparison.
ffprobe-report_hls.log​ (2.4 KB) - added by nealzebub 6 years ago.
FFprobe report reading the first HLS segment with specifed metadata.
ffprobe-report_single-ts.log​ (18.2 KB) - added by nealzebub 6 years ago.
FFprobe report reading the single mpegts file with specifed metadata. For comparison.
diff.txt​ (737 bytes) - added by kccpac 6 years ago.
this is a known issue. The problem is that you here specify the metadata for the segment muxer, which does not propagate them to the chained muxer (TS in this case). I'll see if there is some way to fix it.
The "fail to write customized metadata for HLS creation" problem is that the metadata information is not propagated into AVFormatContext object properly.
I attached a hack to fix the problem.
Please use tools/patcheck to fix the cosmetic issues with your patch (do not put braces on new lines), then send the (fixed) patch to ffmpeg-devel, patches receive much more attention there.