Open AmirZandi13 opened 2 years ago
Hi! To add the necessary context to the ts segments, you should use audiowmark hls-prepare
as documented here:
https://github.com/swesterfeld/audiowmark/#preparing-hls-segments
@swesterfeld Thanks about your response. My use case is, getting a ts file from my stream server then put a string in video or audio of that as a watermark, finally return it to the stream server to serve to the pleyer, How can I use this package for this use case? Thanks for your help
This sounds like for your use case you would like to watermark a single .ts file without any context whatsoever. Currently
audiowmark
doesn't support anything like this. The reason is that often a .ts file is fairly short, probably even shorter than a single watermark block. So to create a watermark we can later detect, the watermark from the first .ts must continue in the second .ts and so forth.
Currently for audiowmark hls-prepare
we assume that you have all the content you want to watermark before streaming starts. You prepare all .ts segments adding meta info to each .ts. Later to deliver a single .ts to the user, audiowmark
will use that meta info (like full_flac_mem
) to produce a watemarked .ts that perfectly fits to the .ts segments before the current one and after the current one.
My ts file is not small and it can include 128 kbit message as a watermark, so is it possible to change your code for my case? If yes, how I can do that?
Thanks
Well if it really is just one .ts file that is large, you probably don't need all the extra stuff that the hls-prepare
and hls-add
commands do to make it work for a bunch of smaller segments. I think one way to solve your problem would be
audiowmark
can handle (such as wav)It should be possible to do steps 1 and 3 using ffmpeg
. If your .ts contains audio and video data, you might want to look at https://github.com/swesterfeld/audiowmark/blob/master/src/videowmark for some inspiration how to split/merge stuff. If its just audio data, it should be even easier.
Yes, It's a good way to do my case. The problem is response time, because I want to do that real time and I have to do that below 0.5 second, so I have to make my way as much as optimism.
Thanks about your help and this good package.
To minimize response time, usually it is best to do the watermarking in a pipe, so that the first watermarked bytes can already be sent while the rest of the stream is still being processed. For mp3 I've described how to do decoding, watermarking and reencoding using a pipe here:
https://groups.google.com/g/audiowmark/c/1PPrvwOHhSo
Of course if you have a huge file (like 30 minutes) and the user seeks to a position late in the file, this would still introduce a delay, so in this case splitting into multiple smaller files (using HLS like audiowmark supports it) is the better solution.
Hi @swesterfeld Thanks for this great package. I have a question about adding full_flac_mem to the ts's audio. What we have to do that? Could you please tell me a brief explanation of that?
Thanks