Comments (6)
oh, seems like I didn't test it well.
just noticed any piped input generates the error
user@laptop:~/ $ cat ~/work/audiowatermark/original.wav | ~/src/audiowmark/src/audiowmark add - - 0123456789abcdef0011223344556677 > /dev/null
Input: -
Output: -
Message: 0123456789abcdef0011223344556677
Strength: 10
Time: 124:16
Sample Rate: 48000
Channels: 6
audiowmark: error: input frames (357913941) != output frames (6045696)
user@laptop:~/ $ file ~/work/audiowatermark/original.wav
~/work/audiowatermark/original.wav: RIFF (little-endian) data, WAVE audio, 6 channels 48000 Hz
user@laptop:~/ $ ~/src/audiowmark/src/audiowmark add ~/work/audiowatermark/original.wav - 0123456789abcdef0011223344556677 > /dev/null
Input: ~//work/audiowatermark/original.wav
Output: -
Message: 0123456789abcdef0011223344556677
Strength: 10
Time: 2:05
Sample Rate: 48000
Channels: 6
Data Blocks: 2
from audiowmark.
Seems like the problem is in this line of libsndfile
psf->sf.frames = psf->datalength / psf->blockwidth ;
maybe its parameters are wrong or the computation itself. But when the file comes as an audiowmark param libsndfile goes another branch and psf->sf.frames
is computed a different way.
from audiowmark.
got it. the problem is not in libsndfile but in ffmpeg with which I got my original.wav
via pipe.
apparently ffmpeg can't properly detect number of frames from an encoded audio track and writes some large number to the wav header and of course it can't fix it in the end of the processing because of pipes nature.
I guess it's somewhat unfixable and I need workarounds.
from audiowmark.
apparently ffmpeg can't properly detect number of frames from an encoded audio track and writes some large number to the wav header and of course it can't fix it in the end of the processing because of pipes nature.
Yes, this is probably what is happening here. There are other cases that trigger this, for instance if you want to use madplay to decode mp3s and then watermark the result, like described here:
https://groups.google.com/g/audiowmark/c/1PPrvwOHhSo
The thing is, even if we don't know the number of input samples, we can watermark the audio file just fine. The error message is generated after the watermarking is complete, so you can use the audio that is produced by audiowmark
even if the error occurs. Of course we then also won't know the number of output samples when writing our output wav header. But in some cases (like if you want to re-encode as mp3) this doesn't matter at all.
So I think while it makes sense to have this check, I think in the future we somehow should support these cases without generating an error. One possible solution would be to make this a warning, and possibly add an extra option to treat warnings as errors (this is what flac does).
from audiowmark.
I agree about warning.
But I'm a little worried about libsndfile if it has any special logic which may operate on invalid number of frames.
So I guess we need to some option for libsndfile too, like "force unknown number of frames, ignore number in the header".
In any case it's nice to have some FAQ/Known Issues doc with this problem.
from audiowmark.
I agree about warning.
I made it a warning now, you can use --strict
to get back the old behaviour.
But I'm a little worried about libsndfile if it has any special logic which may operate on invalid number of frames.
I'm not too worried here, as far as I know libsndfile can deal with these files just fine, these are valid wave files which just happen to have a large number of frames. But the libsndfile sample number counter sf_count_t is a 64bit integer, whereas the number of frames in a traditional wave file is a 32bit integer for the number of bytes, so there shouldn't be any problem with arithmetic operations on the wave file size.
from audiowmark.
Related Issues (20)
- How do I extract the watermark from the ts file?
- sprintf is deprecated on macOS 13 HOT 1
- fails to compile with clang15 HOT 2
- hello please HOT 1
- Zita-resampler issue HOT 1
- zita-resampler not found after compiling from source HOT 3
- autoconf issue: AC_LIB_HAVE_LINKFLAGS HOT 1
- syncfinder
- How to find synchronization bits HOT 1
- Build for Windows HOT 18
- Audible noise in watermarked audio even with --strength 5, also not extractable even at --strength 100 HOT 11
- Build for Mac OSX High Sierra HOT 6
- Using 48kHz files
- Supported formats?
- --with-ffmpeg: deprecation warnings with libavcodec 7:5.1.4-0+deb12u1 HOT 1
- Enhancement Request: Preserve MP3 Metadata When Watermarking HOT 1
- Preserving Video Metadata When Watermarking
- Hope to support mingw32
- weird results with hls when original audio source is mono HOT 3
- Video Watermarking: support for multiple audio tracks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audiowmark.