qutecoacoustics / baw-audio-tools Goto Github PK
View Code? Open in Web Editor NEWContains the audio, spectrogram, and caching tools for the Bioacoustics Workbench project.
License: MIT License
Contains the audio, spectrogram, and caching tools for the Bioacoustics Workbench project.
License: MIT License
BawAudioTools::Exceptions::NotAnAudioFileError
Not an audio file /mnt/workers/production/01/temp/fa2958e1384b46.wav ('video' is not 'audio'): {"STREAM index":"0","STREAM codec_name":"mpeg4","STREAM codec_long_name":"MPEG-4 part 2","STREAM profile":"unknown","STREAM codec_type":"video","STREAM codec_time_base":"768/16640","STREAM codec_tag_string":"[1][0][0][0]","STREAM codec_tag":"0x0001","STREAM width":"4032","STREAM height":"2984","STREAM has_b_frames":"1","STREAM sample_aspect_ratio":"0:1","STREAM display_aspect_ratio":"0:1","STREAM pix_fmt":"yuv420p","STREAM level":"-99","STREAM timecode":"N/A","STREAM quarter_sample":"0","STREAM divx_packed":"0","STREAM id":"N/A","STREAM r_frame_rate":"16640/768","STREAM avg_frame_rate":"0/0","STREAM time_base":"1/22050","STREAM start_pts":"77930","STREAM start_time":"0:00:03.534240","STREAM duration_ts":"662029","STREAM duration":"0:00:30.023991","STREAM bit_rate":"352800","STREAM max_bit_rate":"N/A","STREAM nb_frames":"N/A","STREAM nb_read_frames":"N/A","STREAM nb_read_packets":"N/A","STREAM DISPOSITION:default":"0","STREAM DISPOSITION:dub":"0","STREAM DISPOSITION:original":"0","STREAM DISPOSITION:comment":"0","STREAM DISPOSITION:lyrics":"0","STREAM DISPOSITION:karaoke":"0","STREAM DISPOSITION:forced":"0","STREAM DISPOSITION:hearing_impaired":"0","STREAM DISPOSITION:visual_impaired":"0","STREAM DISPOSITION:clean_effects":"0","STREAM DISPOSITION:attached_pic":"0","FORMAT filename":"/mnt/workers/production/01/temp/fa2958e1384b46.wav","FORMAT nb_streams":"1","FORMAT nb_programs":"0","FORMAT format_name":"wav","FORMAT format_long_name":"WAV / WAVE (Waveform Audio)","FORMAT start_time":"0:00:03.534240","FORMAT duration":"0:00:30.023991","FORMAT size":"1324102","FORMAT bit_rate":"352811","FORMAT probe_score":"99"} External Program: status=0;killed=false;time_out_sec=20;time_taken_sec=0.141020957;timed_out=false;exceptions=[];command=ffprobe -sexagesimal -print_format default -show_error -show_streams -show_format "/mnt/workers/production/01/temp/fa2958e1384b46.wav" Standard output: [STREAM] index=0 codec_name=mpeg4 codec_long_name=MPEG-4 part 2 profile=unknown codec_type=video codec_time_base=768/16640 codec_tag_string=[1][0][0][0] codec_tag=0x0001 width=4032 height=2984 has_b_frames=1 sample_aspect_ratio=0:1 display_aspect_ratio=0:1 pix_fmt=yuv420p level=-99 timecode=N/A quarter_sample=0 divx_packed=0 id=N/A r_frame_rate=16640/768 avg_frame_rate=0/0 time_base=1/22050 start_pts=77930 start_time=0:00:03.534240 duration_ts=662029 duration=0:00:30.023991 bit_rate=352800 max_bit_rate=N/A nb_frames=N/A nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=0 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 [/STREAM] [FORMAT] filename=/mnt/workers/production/01/temp/fa2958e1384b46.wav nb_streams=1 nb_programs=0 format_name=wav format_long_name=WAV / WAVE (Waveform Audio) start_time=0:00:03.534240 duration=0:00:30.023991 size=1324102 bit_rate=352811 probe_score=99 [/FORMAT] Standard Error: ffprobe version N-63893-gc69defd Copyright (c) 2007-2014 the FFmpeg developers built on Jul 16 2014 05:38:01 with gcc 4.6 (Debian 4.6.3-1) configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx libavutil 52. 89.100 / 52. 89.100 libavcodec 55. 66.101 / 55. 66.101 libavformat 55. 43.100 / 55. 43.100 libavdevice 55. 13.101 / 55. 13.101 libavfilter 4. 8.100 / 4. 8.100 libswscale 2. 6.100 / 2. 6.100 libswresample 0. 19.100 / 0. 19.100 libpostproc 52. 3.100 / 52. 3.100 Marker bit missing before time_increment [NULL @ 0x317b5e0] hmm, seems the headers are not complete, trying to guess time_increment_bits [NULL @ 0x317b5e0] my guess is 16 bits ;) Marker bit missing before vop_coded Marker bit missing before time_increment [mpeg4 @ 0x317b5e0] hmm, seems the headers are not complete, trying to guess time_increment_bits [mpeg4 @ 0x317b5e0] my guess is 16 bits ;) Marker bit missing before vop_coded [mpeg4 @ 0x317b5e0] header damaged Marker bit missing before width Marker bit missing before height [mpeg4 @ 0x317b5e0] new pred not supported Marker bit missing before time_increment_resolution Marker bit missing before fixed_vop_rate Marker bit missing before height Marker bit missing after height [mpeg4 @ 0x317b5e0] Static Sprites not supported [mpeg4 @ 0x317b5e0] N-bit not supported [mpeg4 @ 0x317b5e0] quant precision 0 [mpeg4 @ 0x317b5e0] reduced resolution VOP not supported [mpeg4 @ 0x317b5e0] illegal chroma format Marker bit missing before time_increment_resolution Marker bit missing before fixed_vop_rate Marker bit missing before height Marker bit missing after height [mpeg4 @ 0x317b5e0] N-bit not supported [mpeg4 @ 0x317b5e0] quant precision 2 Marker bit missing in complexity estimation part 1 Marker bit missing before time_increment Input #0, wav, from '/mnt/workers/production/01/temp/fa2958e1384b46.wav': Duration: 00:00:30.02, start: 3.534240, bitrate: 352 kb/s Stream #0:0: Video: mpeg4 ([1][0][0][0] / 0x0001), yuv420p, 4032x2984, 352 kb/s, 21.67 tbr, 22050 tbn, 21.67 tbc
[wav @ 0x3fe0b60] Could not find codec parameters for stream 0 (Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 2 channels, 705 kb/s): unspecified sample format Consider increasing the value for the 'analyzeduration' and 'probesize' options
The line here https://github.com/QutBioacoustics/baw-audio-tools/blob/master/lib/baw-audio-tools/audio_ffmpeg.rb#L182 fails to parse output from ffprobe like:
ffprobe -sexagesimal -print_format default -show_error -show_streams -show_format "D:\TEMP\20110412_150000.wav"
ffprobe version 3.4.1 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 7.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, wav, from 'D:\TEMP\20110412_150000.wav':
Metadata:
date : 2007-01-01
creation_time : 00:50:48
time_reference : 0
coding_history : Format=PCM,Mode=STEREO,Sample frequency=44100Hz,Size of the sample=16bit ZOOM Handy Recorder H2
:
Duration: 00:15:15.03, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
[STREAM]
index=0
codec_name=pcm_s16le
codec_long_name=PCM signed 16-bit little-endian
profile=unknown
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[1][0][0][0]
codec_tag=0x0001
sample_fmt=s16
sample_rate=44100
channels=2
channel_layout=unknown
bits_per_sample=16
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=N/A
start_time=N/A
duration_ts=40353020
duration=0:15:15.034467
bit_rate=1411200
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[FORMAT]
filename=D:\TEMP\20110412_150000.wav
nb_streams=1
nb_programs=0
format_name=wav
format_long_name=WAV / WAVE (Waveform Audio)
start_time=N/A
duration=0:15:15.034467
size=161412914
bit_rate=1411207
probe_score=99
TAG:date=2007-01-01
TAG:creation_time=00:50:48
TAG:time_reference=0
TAG:coding_history=Format=PCM,Mode=STEREO,Sample frequency=44100Hz,Size of the sample=16bit ZOOM Handy Recorder H2
[/FORMAT]
Parsing this sort of output results in the following exception:
The error was:
Error: no implicit conversion from nil to integer
Backtrace: /home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_ffmpeg.rb:182:in `[]'
/home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_ffmpeg.rb:182:in `block in parse_ffprobe_output'
/home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_ffmpeg.rb:176:in `each'
/home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_ffmpeg.rb:176:in `parse_ffprobe_output'
/home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_base.rb:121:in `info_ffmpeg'
/home/ubuntu/bioacoustics/workers/baw-workers_production/vendor/bundle/ruby/2.3.0/bundler/gems/baw-audio-tools-d8b0f4e2796c/lib/baw-audio-tools/audio_base.rb:94:in `info'
/home/ubuntu/bioacoustics/workers/baw-workers_production/lib/baw-workers/file_info.rb:21:in `audio_info'
Sometimes, for unknown reasons, ffmpeg will going into an endless loop when converting audio. The process will end up being killed at the timeout.
This is what happens. Perhaps something like disabling interactive input might help ('Press [q] to stop')?
Press [q] to stop, [?] for help
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
size= 0kB time=00:00:00.00 bitrate=N/A
Have a look at these errors. Provide more info in error and see if these should even be errors at all.
Parameters: {"end_offset"=>"25380", "start_offset"=>"25350", "format"=>"wav", "controller"=>"media", "action"=>"show", "audio_recording_id"=>"188295"}
BawAudioTools::Exceptions::FileCorruptError
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_ffmpeg.rb:62:in `check_for_errors'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:51:in `info'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:355:in `audio_tool_segment'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:280:in `modify_worker'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:157:in `modify'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:60:in `block in create_audio_segment'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:53:in `each'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:53:in `create_audio_segment'
app/controllers/media_controller.rb:152:in `audio_response'
app/controllers/media_controller.rb:118:in `parse_media_request'
app/controllers/media_controller.rb:56:in `show'
Parameters: {"end_offset"=>"6450", "start_offset"=>"6420", "format"=>"png", "controller"=>"media", "action"=>"show", "audio_recording_id"=>"240411"}
BawAudioTools::Exceptions::NotAnAudioFileError
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_ffmpeg.rb:93:in `parse_ffprobe_output'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:49:in `info'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:301:in `modify_worker'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/audio_base.rb:157:in `modify'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:60:in `block in create_audio_segment'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:53:in `each'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:53:in `create_audio_segment'
/home/ubuntu/.rvm/gems/ruby-1.9.3-p545/bundler/gems/baw-audio-tools-e40dccedb6fb/lib/baw-audio-tools/media_cacher.rb:93:in `generate_spectrogram'
app/controllers/media_controller.rb:199:in `spectrogram_response'
app/controllers/media_controller.rb:120:in `parse_media_request'
app/controllers/media_controller.rb:56:in `show'
the -q
option sets quantization of the z-axis.
Its currently set to 249 here https://github.com/QutBioacoustics/baw-audio-tools/blob/master/lib/baw-audio-tools/audio_sox.rb#L237
There's really no point to setting this when the maximum quantization we can show is 256.
Investigate removing or chaning this option.
Today, Michael and I tried to use a CSV document of annotations to find where EEB calls were annotated by myself last week, as there is no easy way to search for them in the website without manually re-reviewing spectrograms, or to know what data has been reviewed already on the website. I found that it was quite difficult to use the CSV files to do this, with CVS headings being quite confusing (e.g. event_start_time_utc and event_start_datetime_utc appear to be identical), and wondered if there is a headings glossary that users can also download. One thing that might also help marry up the web and CSV times would be to include the hours in the annotation times (hh:mm:ss format rather than mm:ss). @atruskie @cofiem @jwim1
The template is
[mp3 @ 0x39d35c0] Channel layout 'mono' with 1 channels does not match specified number of channels 2: ignoring specified channel layout
Channel layout '%s' with %d channels does not match specified number of channels %d: ignoring specified channel layout
This issue is hard to track down, but recently we've seen our average cut time for media jump from 4 seconds to 10.
Our new relic histogram also indicates that a good percentage of users are seeing 15 seconds load times or worse.
There a number of factors that could be causing this, including the fact that we were moved to slower storage recently. However, users consistently report slower load times near the end of their files.
We need to make sure fast seeking is always occurring for cutting out a segment of a wav file
Currently when harvesting a directory that is read-only (due to permissions, nfs troubles, or some other reason), cryptic errors like those below will be logged by the Resque workers. It would be good to check for status of dir first, and give a more useful error.
Errno::EROFS
: Read-only file system - <path to file>
Errno::EACCES
: Permission denied - <path to file>
It would be preferable to use newer ffmpeg versions. They could help resolve some of the other ffmpeg bugs.
In particular we'd like to deploy from this ppa: https://launchpad.net/~mc3man/+archive/ubuntu/trusty-media/+sourcepub/5523515/+listing-archive-extra (equivalent to ffmpeg version N-76045-g97be5d4 today)
The current version audio-tools is tested against is a year old.
However unit tests fail when we try and use a newer version.
708.00.00 708.30.00
Standard output: warning: output format ambiguous (@t or @n missing) Processing file <file path> ...
info: file matches the plugin 'mp3 (libmad)' info: MPEG 1 Layer 3 - 32000 Hz - Mono - 64 Kb/s - Total time: 725m.46s
info: starting normal split
Standard Error: error: begin point out of file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.