I am using a combination of ffmpeg
and Apple's mediastreamsegmenter
and id3taggenerator
to create a HLS stream with metadata (ID3) embedded in it. I have all of the applications running and am able to retrieve the metadata out of the stream on the client side, but the issue is that after what seems like a random amount of time, the client stops receiving metadata on the stream.
Here is what I have working now:
This is the ffmpeg
and mediastreamsegmenter
part:
ffmpeg -i udp://@:5010 -c:v libx264 -crf:v 22 -b:v 500k -preset:v veryfast -c:a libfdk_aac -b:a 64k -f mpegts - | mediastreamsegmenter -b http://localhost/stream -f /usr/local/nginx/html/stream/ -t 10 -s 4 -S 1 -D -y id3 -m -M 4242 -l log.txt
This is taking a udp stream on the localhost on port 5010 and encoding the video and audio to H.264 and AAC, respectively. It is pipping the MPEG-2 transport stream segments to the mediastreamsegmenter
, which in turn is generating the .M3U8
file and associated .ts
files and placing them on a NGINX
webserver. The mediastreamsegmenter
is also listening on port 4242 for tcp traffic from the id3taggenerator
which I will show how I am using it now:
id3taggenerator -text '{"x":"12","y":"36"}' -a localhost:4242
As you can see, I am sending some simple x-y coordinates in JSON as text to the mediastreamsegmenter
listening on port 4242. I am actually using a Python script to send some test data at the moment. Here is the script:
#!/usr/local/bin/python3
from subprocess import call
from time import sleep
for i in range(0, 10):
for j in range(0, 10):
x = str(20 * i)
y = str(20 * j)
print("X: " + x + " - Y: " + y)
call(["id3taggenerator", "-text", "{\"x\":\"" + x + "\",\"y\":\"" + y + "\"}", "-a", "localhost:4242"])
sleep(1.0)
This script is just sending a bunch of x-y coordinates using the id3taggenerator
CLI. I have adjusted the sleep
amount from 0.1 to 15 and it doesn't seem to make any difference. The client application that is getting the metadata out of the stream only prints out anywhere from 4 to 35 points, but never has it ever received all of the x-y coordinates.
I am wondering if there is a limit to the amount of metadata that can sent per frame, but I cannot seem to find anything that specifies a hard-limit value for any of these tools...