Support for the new feature silencedetect

Issues involving a Windows version of FFmpeg. Do not post general usage questions here.

Support for the new feature silencedetect

Postby MythBuster » Thu Mar 08, 2012 5:58 am

Hi,

I am delighted to see the amount of effort that has gone in enhancing FFMPEG till date. I would like to thank the whole FFMPEG team here. Keep up the good work! :)

I am trying to use the silencedetect feature as mentioned in http://ffmpeg.org/ffmpeg.html#toc-silencedetect at the command-line(ffmpeg -f lavfi -i amovie=silence.mp3,silencedetect=noise=0.0001 -f null -). But, it seems the feature isn't still integrated with the latest ffmpeg.exe release available - http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-git-a4c22e3-win32-static.7z. Please let me know if anything else I need to do in order to use this feature.

Thank you for your time.

Cheers.
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am

Re: Support for the new feature silencedetect

Postby MythBuster » Mon Mar 12, 2012 6:17 pm

Okay, it's indeed present in the latest two releases(FFmpeg git-a4c22e3 32-bit Static - http://ffmpeg.zeranoe.com/builds/win32/ ... -static.7z and FFmpeg git-1eabd71 32-bit Static - http://ffmpeg.zeranoe.com/builds/win32/ ... -static.7z). My bad in not figuring out its presence! :)

Well, now that I have figured out the usage of this new feature, silencedetect, I am able to detect the silence as indicated with the necessary parameters only for the non-drive specific paths under Windows(guess the Linux's drive-less logic has bitten the Windows' drive oriented file-system hierarchy here!). By non-drive specific paths I mean all those paths which don't refer to a specific drive with its drive letter in an absolute manner.

For drive specific paths under Windows, the paths specified for amovie is being misinterpreted as a key/value pair as it consists a colon(:) in it. So, I think this needs to be sorted out in order to handle the drive-specific paths under Windows with respect to the audio source - amovie of the FFMPEG library - Libavfilter.

Here is what I have been trying.

Working command :

(Here "45 2.mp3" is the audio source located at the root level of f-drive).
F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie=45 2.mp3,silencedetect=noise=0.001:d=6
0" -f null -

--- Successful execution.

Troublesome commands(Have tried the below variations to see if they work) :

F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie=f:\45 2.mp3,silencedetect=noise=0.001:
d=60" -f null -

Error reported :
[movie @ 0216B800] Missing key or no key/value separator found after key '45 2.m
p3'
[amovie @ 0216B780] Error parsing options string: '45 2.mp3'
[lavfi @ 0216AC40] Error initializing filter 'amovie' with args 'f:45 2.mp3'
amovie=f:\45 2.mp3,silencedetect=noise=0.001:d=60: Invalid argument


F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie=f:\\45 2.mp3,silencedetect=noise=0.001
:d=60" -f null -

Error reported :
[movie @ 0216B800] Missing key or no key/value separator found after key '45 2.m
p3'
[amovie @ 0216B780] Error parsing options string: '\45 2.mp3'
[lavfi @ 0216AC40] Error initializing filter 'amovie' with args 'f:\45 2.mp3'
amovie=f:\\45 2.mp3,silencedetect=noise=0.001:d=60: Invalid argument


F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie="f:\\45 2.mp3",silencedetect=noise=0.0
01:d=60" -f null -

Error reported :
[movie @ 0216B7A0] Missing key or no key/value separator found after key '45'
[amovie @ 0216B720] Error parsing options string: '\45'
[lavfi @ 0216AC60] Error initializing filter 'amovie' with args 'f:\45'
amovie=f:\\45: Invalid argument


F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie=\"f:\\45 2.mp3\",silencedetect=noise=0
.001:d=60" -f null -

Error reported :
[movie @ 0216B820] Missing key or no key/value separator found after key '45 2.m
p3"'
[amovie @ 0216B780] Error parsing options string: '\45 2.mp3"'
[lavfi @ 0216AC60] Error initializing filter 'amovie' with args '"f:\45 2.mp3"'
amovie="f:\\45 2.mp3",silencedetect=noise=0.001:d=60: Invalid argument


F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie='f:\\45 2.mp3',silencedetect=noise=0.0
01:d=60" -f null -

Error reported :
[movie @ 0216B820] Missing key or no key/value separator found after key '\45 2.
mp3'
[amovie @ 0216B780] Error parsing options string: '\\45 2.mp3'
[lavfi @ 0216AC60] Error initializing filter 'amovie' with args 'f:\\45 2.mp3'
amovie='f:\\45 2.mp3',silencedetect=noise=0.001:d=60: Invalid argument


F:\>c:\lxm\ffmpeg.exe -f lavfi -i "amovie='f:\45 2.mp3',silencedetect=noise=0.00
1:d=60" -f null -

Error reported :
[movie @ 0216B800] Missing key or no key/value separator found after key '45 2.m
p3'
[amovie @ 0216B780] Error parsing options string: '\45 2.mp3'
[lavfi @ 0216AC40] Error initializing filter 'amovie' with args 'f:\45 2.mp3'
amovie='f:\45 2.mp3',silencedetect=noise=0.001:d=60: Invalid argument


I think the below part of the code needs to be fixed to handle the above scenarios properly.

Code: Select all
Location - http://ffmpeg.org/doxygen/trunk/src__movie_8c.html#09818ca01d6510cb4703b8a29188770d

00100     if (args)
00101         movie->file_name = av_get_token(&args, ":");


And I think the fix would be changing the delimiter for the filename in the arguments passed to be something other than the colon(:) which retains its sense on all the target platforms. And this something else can be the surrounding double quotes around the filename. Well, this is just a suggestion from my side. :)

Nevertheless, please let me know if there are any other ways in which I can deal with the drive-specific paths for amovie source of Libavfilter.

Thank you for your time.

Cheers.
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am

Re: Support for the new feature silencedetect

Postby MythBuster » Tue Mar 13, 2012 6:07 pm

In addition to the above problem related to drive specific paths, I did find that the audio source given for amovie is expected to be having Linux-like DirectoryName-separators in a path. As a result, any backward slash needs to be converted into forward slash to have any path as audio source for amovie under Windows.

As of now, I have managed to resolve the already reported drive-specific path problem by switching to the respective drive and stripping off the initial drive-specifier from the path so that we have a relative path which in turn is subjected to a BackwardSlash-to-ForwardSlash conversion if needed before supplying the same to FFMPEG for SilenceDetection.

With the above steps, I am able to successfully detect the silence in the supplied audio source under Windows regardless of whether the path supplied is a drive-specific path or is having a backward slash in it.

Thank you for the wonderful feature - silencedetect! :)

Cheers.
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am

Re: Support for the new feature silencedetect

Postby rogerdpack » Mon May 14, 2012 4:14 pm

can you escape the colon at all? If not then I'd bring it up with the ffmpeg user lists...
rogerdpack
 
Posts: 1454
Joined: Fri Aug 05, 2011 9:56 pm

Re: Support for the new feature silencedetect

Postby MythBuster » Mon Jan 21, 2013 2:23 am

Sorry for the long delay in reply. Couldn't find time to reply all these days. Okay, here is what I have tried.

--------------

Nope. No luck. Below is what I tried. I escaped both colon and backslash(which needs to be obviously!).

Code: Select all
C:\Users\TimeTheAlmighty\Downloads>c:\lxm\ffmpeg.exe -report -f lavfi -i "amovie
=c\:\\algos\\ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:duration=60"
 -f null -
ffmpeg started on 2013-01-20 at 21:13:53
Report written to "ffmpeg-20130120-211353.log"
ffmpeg version N-48409-g43adc62 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  2 2013 18:50:18 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[amovie @ 000000000216c720] Missing key or no key/value separator found after ke
y 'algosocw-6.046-02nov2005-220k.mp4'
[lavfi @ 00000000002fc740] Error initializing filter 'amovie' with args 'c:\algo
s\ocw-6.046-02nov2005-220k.mp4'
amovie=c\:\\algos\\ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:durati
on=60: Invalid argument


And here is escaped colon with forward slash. Again, no luck.

Code: Select all
C:\Users\TimeTheAlmighty\Downloads>c:\lxm\ffmpeg.exe -report -f lavfi -i "amovie
=c\:/algos/ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:duration=60" -
f null -
ffmpeg started on 2013-01-20 at 21:14:38
Report written to "ffmpeg-20130120-211438.log"
ffmpeg version N-48409-g43adc62 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  2 2013 18:50:18 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[amovie @ 0000000002429ca0] Missing key or no key/value separator found after ke
y '/algos/ocw-6.046-02nov2005-220k.mp4'
[lavfi @ 00000000002fc740] Error initializing filter 'amovie' with args 'c:/algo
s/ocw-6.046-02nov2005-220k.mp4'
amovie=c\:/algos/ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:duration
=60: Invalid argument



Even with a relative path(regardless of whether it is of a drive-specific path or not) with escaped backslashes, no luck as under.

Code: Select all
C:\Users\TimeTheAlmighty\Downloads>c:\lxm\ffmpeg.exe -report -f lavfi -i "amovie
=..\\..\\..\\algos\\ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:durat
ion=60" -f null -
ffmpeg started on 2013-01-20 at 21:15:33
Report written to "ffmpeg-20130120-211533.log"
ffmpeg version N-48409-g43adc62 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  2 2013 18:50:18 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[Parsed_amovie_0 @ 0000000002012f40] Failed to avformat_open_input '......algoso
cw-6.046-02nov2005-220k.mp4'
[lavfi @ 0000000001ffc540] Error initializing filter 'amovie' with args '..\..\.
.\algos\ocw-6.046-02nov2005-220k.mp4'
amovie=..\\..\\..\\algos\\ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001
:duration=60: No such file or directory


Only working solution yet with the latest FFMPEG is to convert any path which is absolute to a relative path with all the backward slashes(if any) converted into forward slashes. Below is the corrected execution of the above failed executions! :)

Code: Select all
C:\Users\TimeTheAlmighty\Downloads>c:\lxm\ffmpeg.exe -report -f lavfi -i "amovie
=../../../algos/ocw-6.046-02nov2005-220k.mp4,silencedetect=noise=0.001:duration=
60" -f null -
ffmpeg started on 2013-01-20 at 21:16:29
Report written to "ffmpeg-20130120-211629.log"
ffmpeg version N-48409-g43adc62 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan  2 2013 18:50:18 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --e
nable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --e
nable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwben
c --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-
libxvid --enable-zlib
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 85.100 / 54. 85.100
  libavformat    54. 59.100 / 54. 59.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 30.102 /  3. 30.102
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000036b060] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000036b060] max_analyze_duration 5000000 reache
d at 5000000
[Parsed_amovie_0 @ 0000000002012a20] seek_point:0 format_name:(null) file_name:.
./../../algos/ocw-6.046-02nov2005-220k.mp4 stream_index:-1
[Parsed_silencedetect_1 @ 0000000002012aa0] auto-inserting filter 'auto-inserted
 resampler 0' between the filter 'Parsed_amovie_0' and the filter 'Parsed_silenc
edetect_1'
[auto-inserted resampler 0 @ 0000000003f110c0] chl:stereo fmt:fltp r:22050Hz ->
chl:stereo fmt:dbl r:22050Hz
[lavfi @ 000000000036e0e0] Estimating duration from bitrate, this may be inaccur
ate
Input #0, lavfi, from 'amovie=../../../algos/ocw-6.046-02nov2005-220k.mp4,silenc
edetect=noise=0.001:duration=60':
  Duration: N/A, start: 0.046440, bitrate: 2822 kb/s
    Stream #0:0: Audio: pcm_f64le, 22050 Hz, stereo, dbl, 2822 kb/s
[graph 0 input from stream 0:0 @ 0000000002012980] tb:1/22050 samplefmt:dbl samp
lerate:22050 chlayout:0x3
[audio format for output stream 0:0 @ 0000000003f111e0] auto-inserting filter 'a
uto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'au
dio format for output stream 0:0'
[auto-inserted resampler 0 @ 0000000003f11260] chl:stereo fmt:dbl r:22050Hz -> c
hl:stereo fmt:s16 r:22050Hz
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf54.59.100
    Stream #0:0: Audio: pcm_s16le, 22050 Hz, stereo, s16, 705 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_f64le -> pcm_s16le)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
size=N/A time=01:14:27.00 bitrate=N/A
video:0kB audio:384756kB subtitle:0 global headers:0kB muxing overhead -100.0000
06%


And I think the suggestion on handling the colon, already mentioned by me in this thread would fix the above issues.

Thanks,
Raghavan Santhanam
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am

Re: Support for the new feature silencedetect

Postby rogerdpack » Mon Jan 21, 2013 3:55 pm

ok filed http://ffmpeg.org/trac/ffmpeg/ticket/2166 thank you for your report.
rogerdpack
 
Posts: 1454
Joined: Fri Aug 05, 2011 9:56 pm

Re: Support for the new feature silencedetect

Postby MythBuster » Tue Jan 22, 2013 1:41 am

You are welcome! It's a pure pleasure to use FFMPEG. Keep up the good work! :)

Thanks!
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am

Re: Support for the new feature silencedetect

Postby rogerdpack » Fri Jan 25, 2013 6:55 pm

could you try the resolution listed at http://ffmpeg.org/trac/ffmpeg/ticket/2166 and report back?
rogerdpack
 
Posts: 1454
Joined: Fri Aug 05, 2011 9:56 pm

Re: Support for the new feature silencedetect

Postby MythBuster » Sun Jan 27, 2013 3:36 pm

Okay. Yeah, works for me too though I feel it's kind of some extra work to get things in place.

Cheers,
Raghavan
MythBuster
 
Posts: 6
Joined: Thu Mar 08, 2012 5:43 am


Return to Usage Issues

Who is online

Users browsing this forum: No registered users and 3 guests