0

我正在尝试将定时元数据 (id3) 插入使用 Apple 的mediastreamsegmenter工具创建的实时 HLS 流中。我从 ffmpeg 流中获取视频,这是我运行以从现有文件进行测试的命令:

ffmpeg -re -i vid1.mp4 -vcodec libx264 -acodec aac -f mpegts - | mediastreamsegmenter -f /Users/username/Sites/video -s 10 -y id3 -m -M 4242 -l log.txt

要注入元数据,我运行以下命令:

id3taggenerator -text '{"x":"data dan","y":"36"}' -a localhost:4242

此设置创建了预期的 .ts 文件,我可以毫无问题地播放视频/音频。但是,我尝试插入的元数据在最终文件中不起作用。我知道元数据以某种形式存在,当我将视频的无元数据版本与注入元数据的视频进行文件比较时,我可以在二进制数据中看到 ID3 标签。

坏文件分析

当我使用 ffmpeg 分析生成的文件时:

ffprobe -i video1.ts

我得到的输出是:

[mpegts @ 0x7fb00a008200] start time for stream 2 is not set in estimate_timings_from_pts[mpegts @ 0x7fb00a008200] stream 2 : no TS found at start of file, duration not set[mpegts @ 0x7fb00a008200] Could not find codec parameters for stream 2 (Audio: mp3, 0 channels): unspecified frame sizeConsider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

Input #0, mpegts, from 'video1.ts':  Duration: 00:00:10.02, start: 0.043444, bitrate: 1745 kb/s  
Program 1   
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 848x464 [SAR 1:1 DAR 53:29], 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 130 kb/s  
No Program  
Stream #0:2[0x102]: Audio: mp3, 0 channels

请注意第三个流(流 #0:2)如何标记为mp3 ......这是不正确的!它还说“无程序”,而不是在“程序 1”中。

当我分析使用 Apple 的mediafilesegmenter工具创建的插入了 ID3 元数据的正确编码的视频文件时,分析显示“timed_id3”轨道,并且该元数据轨道在我的网络浏览器中正常工作。

良好的文件分析

ffprobe -i video1.ts
—Input #0, mpegts, from 'video1.ts':  Duration: 00:00:10.08, start: 19.984578, bitrate: 1175 kb/s  
Program 1   Stream #0:0[0x101]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 848x464, 30 fps, 30 tbr, 90k tbn, 180k tbc  
Stream #0:1[0x102]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 67 kb/s  
Stream #0:2[0x103]: Data: timed_id3 (ID3  / 0x20334449)

据我所知,我必须使用mediastreamsegmenter,因为这是实时流所必需的。有谁知道我如何将定时 ID3 元数据正确地放入实时 HLS 流中?

4

0 回答 0