Code Monkey home page Code Monkey logo

Comments (7)

swesterfeld avatar swesterfeld commented on August 23, 2024 1

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

from audiowmark.

swesterfeld avatar swesterfeld commented on August 23, 2024 1

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

  1. extracting / decompressing the audio from the .ts to a format that audiowmark can handle (such as wav)
  2. watermarking the wav file
  3. reencoding the watermarked wav file to .ts

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.

from audiowmark.

AmirZandi13 avatar AmirZandi13 commented on August 23, 2024

@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

from audiowmark.

swesterfeld avatar swesterfeld commented on August 23, 2024

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.

from audiowmark.

AmirZandi13 avatar AmirZandi13 commented on August 23, 2024

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

from audiowmark.

AmirZandi13 avatar AmirZandi13 commented on August 23, 2024

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.

from audiowmark.

swesterfeld avatar swesterfeld commented on August 23, 2024

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.

from audiowmark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.