Opened 4 weeks ago
Last modified 2 weeks ago
#11281 new defect
"showwavespic" failed for "Too few samples"?
Reported by: | Danny Weijermans | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | showwavespic |
Cc: | MasterQuestionable | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
ffmpeg is great for creating waveform overviews.
however, it doesn't work with very short - < 200msec - soundfiles.
could this be fixed?
Attachments (6)
Change History (28)
comment:1 by , 4 weeks ago
Cc: | added |
---|---|
Keywords: | audio added; ffmpeg soundfiles removed |
comment:2 by , 4 weeks ago
thanks for your relevant link!
yes, but I'm not using a 'lossy' audio fileformat.
it's a 'firm' wav file, I have put an very short wav file (s.wav) example as an attachment.
my command line (which works on longer wav files) for example:
ffmpeg -i /Users/disjt/Desktop/s.wav -filter_complex "showwavespic=s=640x120" -frames:v 1 output.png
if /Users/disjt/Desktop/s.wav points to a longer wav file it's working perfectly.
if it's a shorter than 200msec it's not working..
comment:3 by , 4 weeks ago
Component: | ffmpeg → avfilter |
---|---|
Keywords: | showwavespic added; waveform creation short audio removed |
Summary: | ffmpeg create waveform overview with short audiofiles doesn't work → "showwavespic" filter failed with very short audio (< 200 ms)? |
͏ https://ffmpeg.org/ffmpeg-filters.html#showwavespic
͏ Cannot reproduce?
͏ ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "sine=d=0.1" -lavfi "showwavespic" "!.png"
͏ ffmpeg -y -v debug -hide_banner -nostdin -nostats -i "s.wav" -lavfi "showwavespic" "s.png"
͏ (tried very much your original command too)
͏ What's the FFmpeg version?
comment:4 by , 4 weeks ago
Hi! I used your code now:
ffmpeg -y -v debug -hide_banner -nostdin -nostats -i "s.wav" -lavfi "showwavespic" "s.png"
and now it works!
so what's the change? is -lavfi needed?
If you use my code, can't you reproduce? :
ffmpeg -i /Users/disjt/Desktop/s.wav -filter_complex "showwavespic=s=640x120" -frames:v 1 output.png
I really need the 'mono' option (mix to mono), 'compand' to compress the dynamic range, and output a specific size: 8000x100
Can you reproduce this?
comment:6 by , 4 weeks ago
I also added a very short stereo soundfile: can you test it with this?
I get an empty file if I use the following code-line:
ffmpeg -y -v debug -hide_banner -nostdin -nostats -i /Users/disjt/Desktop/t.wav -filter_complex "compand,aformat=channel_layouts=mono,showwavespic=s=1400x100:colors=green" -frames:v 1 "t.png"
comment:7 by , 4 weeks ago
I guess it has something to do with the 'filter_complex' option and using "-frames:v 1" instead of using "-lavfi" ?
comment:8 by , 4 weeks ago
Version: | unspecified → 7.0 |
---|
͏ "-filter_complex" and "-lavfi" should be semantically equivalent. (mere alias)
͏ Does it make the difference for you?
͏ (I did tried your original command (comment:2) with only filenames differences: cannot reproduce git-master)
͏ The debug output also reports various information related.
͏ Do you spot anything abnormal?
comment:9 by , 4 weeks ago
Aha! I found it!
Now that I tried a smaller horizontal value (than 1400) it works:
so it must be, that for very short soundfiles the horizontal size has a maximum..
Do you know what's the limit? Or how this is related?
Thanks for all your comments!
No, I didn't find different behaviour between "-filter_complex" and "-lavfi",
but I wasn't familiar with "-lavfi".
Can you reproduce it, when using my '=s=1400x100:' on my given wav file?
comment:10 by , 4 weeks ago
I tested some more, and the 'compand' option, also has different behaviour for very short soundfiles.. but: why??
comment:11 by , 4 weeks ago
I notice that the debug option even mentions 'Too few samples' : but WHY? WHEN are there few samples, and what is it based on?
follow-up: 14 comment:12 by , 4 weeks ago
Summary: | "showwavespic" filter failed with very short audio (< 200 ms)? → "showwavespic" failed for "Too few samples"? |
---|---|
Version: | 7.0 → git-master |
͏ ffmpeg -y -v debug -hide_banner -nostdin -nostats -i "t.wav" -lavfi "showwavespic" "t.png"
͏ ; fails "[Parsed_showwavespic_0] Too few samples"
͏ "s=1400x100" not required.
͏ https://github.com/FFmpeg/FFmpeg/blob/8a951ef5e119afb41e67d8b7dc3dedadc88c0e41/libavfilter/avf_showwaves.c#L594
͏ https://github.com/search?type=code&q=repo:FFmpeg/FFmpeg+/(?-i)(?:%5CW|^)Too+few+samples(?:%5CW|%24)/
͏ https://github.com/search?type=code&q=repo:FFmpeg/FFmpeg+%22Too+few%22+sample
͏ .
͏ I wonder too.
͏ "compand" should be mostly irrelevant:
͏ https://ffmpeg.org/ffmpeg-filters.html#compand
͏ (is parameterless "compand" no-op..?) [ No. ]
by , 3 weeks ago
Attachment: | FLffmpeg.png added |
---|
ffmpeg showwavespic result: samples are truncated on the right side (or: not enough samples are shown)
comment:13 by , 3 weeks ago
a new insight:
when using smaller widths, the wavesample picture gets truncated at the right sight
(or: the wavesample data is not comlete)
uploaded 3 new files:
FL.wav : a short wav file with a recognizable waveform
FLright.png : how FL.wav should look (in 'Snapper')
FLffmpeg.png: how FL.wav looks in ffmpeg showwavespic using for example:
ffmpeg -i /Users/disjt/Desktop/FL.wav -filter_complex "showwavespic=s=500x120" -frames:v 1 FL.png
can you replicate this?
follow-up: 15 comment:14 by , 3 weeks ago
Replying to MasterQuestionable:
͏
ffmpeg -y -v debug -hide_banner -nostdin -nostats -i "t.wav" -lavfi "showwavespic" "t.png"
͏ ; fails "[Parsed_showwavespic_0] Too few samples"
͏ "s=1400x100" not required.
I need a big width in order to have a proper horizontal resolution.
and this is where the 'bug' is..
When I set 1400 smaller for shorter soundfiles it gives results..
͏ https://github.com/FFmpeg/FFmpeg/blob/8a951ef5e119afb41e67d8b7dc3dedadc88c0e41/libavfilter/avf_showwaves.c#L594
͏ https://github.com/search?type=code&q=repo:FFmpeg/FFmpeg+/(?-i)(?:%5CW|^)Too+few+samples(?:%5CW|%24)/
͏ https://github.com/search?type=code&q=repo:FFmpeg/FFmpeg+%22Too+few%22+sample
͏ .
͏ I wonder too.
͏ "compand" should be mostly irrelevant:
͏ https://ffmpeg.org/ffmpeg-filters.html#compand
͏ (is parameterless "compand" no-op..?)
When I use 'compand' without parameters, it looks different (better) than without 'compand':
it shows the waveform a bit 'audio-compressed'..
comment:15 by , 3 weeks ago
͏ I mean it's just reproducible with the default 600x240: the same failure.
comment:16 by , 3 weeks ago
Okay, got it now! Thanks!
Also have a look at my last comment,
because that shines a new light on it
(not the complete number of samples get 'viewed')
comment:17 by , 3 weeks ago
͏ Any width > 2048 fails "Too few samples"..?
͏ "Create frame averaging 1 samples per column"
͏ "Create frame averaging 2 samples per column"
͏ ; alike.
͏ Might somehow relate?
comment:19 by , 3 weeks ago
͏ Worth notice: "FL.wav" is of 2,048 samples.
͏ I guess "showwavespic" currently may not support resolution higher than 1 px/sample:
͏ Thus the "Too few samples" error.
comment:20 by , 3 weeks ago
so does that mean, if soundfiles have less than 2048 samples, I should set the resolution to the number of samples? I think so ;)
comment:21 by , 2 weeks ago
I can report, that it sort of works now for me:
when the soundfile has less than 2049 samples,
I'll set the horizontal pixel-width for 'showwavespic' to the number of samples
comment:22 by , 2 weeks ago
͏ Per the source (comment:12) it's somewhat more complex. ("column"?)
͏ Also I'm unsure if the mirrored display is intended. (disable?)
͏ Probably relevant:
͏ https://trac.ffmpeg.org/ticket/11018#comment:2
͏ What's the command line?