Francesco Romani wrote:
On Mon, 2007-06-11 at 12:08 -0400, Cyrus A wrote:
[...]
Ok, here it is. It has took a bit longer than expected due to
ever-standing real life work issues and due to needed refactoring that
this task has pulled in. Anyway.
filter_astat in CVS HEAD (should) can now detect if an audio track is
silence only.
Just use
transcode -i file -a X -J astat
Euhrystic implemented is a bit harsh, maybe it still needs some
extensions/tuning. Can't do it now, but It's planned before 1.1.0
released. Feedback very-welcome.
filter_detectsilence can do a stuff like that as well, but is
trickier. In practice, filter_detectsilence really detects the silence
*intervals* between audio chunks (useful to separate songs or track
parts, for example). Of course, if a silence interval is very long,
one can assume that the whole audio track is silence only, but isn't
so straightforward.
I tried 'transcode -i soundtest2.mp3 -a X -J astat' on one of my files
and got an error:
[EMAIL PROTECTED] transcode]# transcode -i soundtest2.mp3 -a X -J astat
transcode v1.0.2 (C) 2001-2003 Thomas Oestreich, 2003-2004 T. Bitterberg
[transcode] critical: invalid parameter for option -a
There is a couple of errors in there.
First, transcode 1.0.x (including 1.0.2, 1.0.3 and any future release)
just doesn't have the feature we're talking about: you need a snapshot
of future 1.1.0.
Second, there is an error in -a option usage. -a expects as argument the
index of the audio track to be processed, starting the count from 0
(zero). So, -a 0 (or no -a at all since 0 is the default index) should
work on your case.
PS: don't use transcode as root :)
Again, I'm a total stranger to transcode. Can you tell me what configure
options I should be using (if any) to make this work?
Except for using a 1.1.0 snapshot (just remember to fetch sources from
HEAD branch, NOT from 1.0.x branch), you don't need anything special.
Also, in a later post, you mentioned using filter_detectsilence instead
of astat. Which should I use? If detectsilence, then how?
Both astat and detectsilence filters scan the whole (given) audio track,
but they do in a fairly different way.
filter_astat:
astat filter finds some basic audio statistics: minimum and maximum
sample value. The purpose of doing this is to find the appropriate
values to properly rescale the audio (so user no longer need to fire up
the speakers at maximum power to actually hear something).
We have a nice side effect: if minimum AND maximum sample values are
between a given range, we can assume that the whole audio track contain
only (roughly) silence. In current version of the filter, this treshold
is hardcoded and set to 0 (zero). That is pretty strict and can be
relexed in future release.
So, quick summary: astat filter can tell the user about the minimum and
maximum audio values in a track. It can detect (with some tuning) if THE
WHOLE track is silence or not.
filter_detectsilence:
detectsilence scan the audio track for silence intervals, if any. The
eurhystic adopted to find silence is like (but not identical) the one
used in astat filter above, so it is possible that the two filters emit
different results on same audio source. However, it's matter of tuning.
What silence interval detection is good for? To give an example, is
useful to find some cut points for split an audio track: splitting the
audio when there is silence is of course better then split in the middle
of a song. filter_detectsilence can just output the silence intervals
(except for bugs of course :P) ot it can be emit a commandline to be
used with tcmp3cut.
Side effect of all this above: if we have a silence interval long enough
(i.e.: 75% of the track, or even larger) we can deduce that the whole
track is silence only. But that's a deduction that uses a side effect of
this filter, so it can be (blatantly :) ) wrong.
So, quick summary: detectsilence can tell the user about silence
intervals in a track, if there is any of them. Detecting if the whole
track is silence or not is NOT the job of this filter, even if it can
accomplish something fairly similar.
I hope that's a bit clearer now (it not, don't hesitate to ask more).
If your (IIRC) task is to just detect if an audio track is ENTERELY made
by silence or not, astat is better suited.
I'll download your sample that you have linked in another mail and I'll
do some further tuning in astat filter. Unfortunately, I'm still bretty
busy those days (hey, I need some holydays!), so this can take some
days.
Bests,
It's very close to working now. After running 'transcode -i
soundtest2.mp3 -a 0 -J astat' (also with soundtest.mp3 (the silent one))
the program hangs. However, when I hit ctrl-c to kill it, it then gives
me the information I'm looking for in the form of "[filter_astat.so]
audio track seems only silence" or other information if the track is not
silent. Why is it hanging?
--------------------------
[EMAIL PROTECTED] transcode]$ transcode -i soundtest.mp3 -a 0 -J astat
transcode v1.1.0-cvs (C) 2001-2003 Thomas Oestreich, 2003-2007 transcode
team
[dvd_reader.c] critical: no support for DVD reading configured - exit.
[transcode] auto-probing source soundtest.mp3 (ok)
[transcode] V: import format | unknown MP3 (module=null)
[transcode] A: import format | unknown MP3 (module=mp3)
[transcode] V: import frame | disabled
[transcode] V: bits/pixel | 0.000 (unknown)
[transcode] V: decoding fps,frc | 25.000,0
[transcode] V: video format | YUV420 (4:2:0) aka I420
[transcode] A: import format | 0x55 MPEG layer-3 [44100,16,2] 192
kbps
[transcode] A: export | disabled
[transcode] V: encoding fps,frc | 25.000,3
[transcode] A: bytes per frame | 7056 (7056.000000)
[transcode] A: adjustment | [EMAIL PROTECTED]
[transcode] V: IA32/AMD64 accel | sse3 sse2 sse 3dnowext 3dnow mmxext
mmx cmove asm
[transcode] warning: no option -o found, encoded frames send to "/dev/null"
[transcode] V: video buffer | 10 @ 0x0 [0x2]
[transcode] A: audio buffer | 10 @ 44100x2x16
[import_mp3.so] v0.1.4 (2003-08-04) (audio) MPEG
[import_null.so] v0.2.0 (2002-01-19) (video) null | (audio) null
[filter_astat.so] v0.2.0 (2007-06-06) audio statistics filter plugin
[export_null.so] v0.1.2 (2001-08-17) (video) null | (audio) null
[import_mp3.so] MP3->PCM
[import_mp3.so] tcextract -a 0 -i "soundtest.mp3" -x mp3 -d 0 | tcdecode
-x mp3 -d 0 -z 0
Can't step back 511!
[transcode] (sighandler) SIGINT receivedT: 0:00:29, ( 0| 0| 3)
----
HAAAANNNNGGGG
(ctrl-c)
----
[filter_astat.so] audio track seems only silence
[transcode] encoded 749 frames (0 dropped, 0 cloned), clip length 29.96 s