Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home

jorgenmodin.net - Blog

Align videos with audio analysis & stack them in a multi sound file

Posted by admin |

With align-videos-by-sound, which is a python script/application you can align videos by their sound tracks.

After install, you can for example do this:

./bin/simple_stack_videos_by_sound_track --mode=direct --audio_mode=multi_streams tests/testfiles/3-secs-in.mp4 tests/testfiles/7-secs-in.mp4 tests/testfiles/full.mp4


It will present the 3 videos stacked in a "merged.mkv" file (one of the videos will be duplicated for symmetry), and the sound tracks from all 3 videos will be synced, for editing and mixing in e.g. Audacity (tested by me).

aligned tracks
Click to view full-size image…
Size: 80.3 kB

This is what it looks like in Audacity when you open the "merged.mkv" file. You can then export to multiple files and they will get the appropriate length of silence in the beginning.

Align-videos-by-sound is alpha software! And I am the maintainer of it, although all the heavy coding was done by Allison Deal (where i lifted the code from) and later Hiroaki Itoh.

 

Feb 14, 2019 01:25

An interesting guide on how to get an ecosystem going in your garden

Posted by admin |

https://np.reddit.com/r/IWantToLearn/comments/apgslg/iwtl_how_to_create_a_better_environment_for/egaxmw5/

A proof to me that anything can be interesting once somebody explains it in a way that makes your brain grok the particular field.

Feb 13, 2019 01:37

How to get a stereo wav file from a Canon C300 camera with MXF format using ffmpeg

Posted by admin |

This presumes you have been recording into the Canon C300 Mark I with two sound sources, split into separate channels. And you want the channels to be panned hard left and right, suitable for editing and comparison in e.g. Audacity (Although you can of course also export to different files and import).

This does the trick:

ffmpeg -i from_canon.MXF -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le stereo.wav

Credit goes to FFMPEG: Need to mix dow multiple audio stream to single stereo - Stack Overflow

Software such as ffmpeg, Videolan Client (VLC) and audacity see Canon's MXF format as two separate sound channels inside a container, not as a left and right channel. In VLC you will only get one audio track for example, and you can switch to the other one if you want. So using ffmpeg, this won't work:

ffmpeg -i from_canon.MXF pcm_s16le stereo.wav

It will say that it will only include one audio stream in the wav file, althought there are two:

Stream mapping:
  Stream #0:1 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))

Mapping the channels into wav also won't work:

ffmpeg -i AA340601.MXF -map 0:1 -map 0:2 -c:a pcm_s16le all.wav

This will give the error:

WAVE files have exactly one stream
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Feb 12, 2019 03:45

Is bluetooth microphone audio always bad?

Posted by admin |

Update: Here it is straight from the horse's mouth, or rather Antlion's mouth: All Bluetooth mic standards are bad, max they could get out was 16KHz sampling frequency (vid forwarded to where he talks about this):
https://youtu.be/UIp3Dh6rx7w?t=315

I put the sound track down for a screen cast with my Sony bluetooth headset. The result was not good, I had to redo it later with a wired mic. I then saw a video review of a higher quality bluetooth headset, but alas again the sound is no good from the mic:

https://youtu.be/xbxyqSVc_Io?t=265

This answer on Quora seems to indicate that with current standards bluetooth microophone audio will always suck, unless you hack the mic stream into some data protocol of bluetooth.

Why is the quality of my microphone so bad when I use my Bluetooth headset with my windows desktop computer? - Quora

 

Feb 12, 2019 12:50

Ideas for using 12-48V phantom power to drive a 3v electret condenser microphone

Posted by admin |

Not many sound cards I have found have multiple inputs for 3V electret condenser microphones. Maybe that makes sense, since such small mics are often used with headsets and as lapel/lavalier microphones, and those tend to be wireless if you're handling more than one.

Still, it would be fun to make a thingy that converts 48V phantom power to work with an elecret. Actually you can buy such an adapter off the shelf from Røde for about €20. That is probably the sane thing to do:

Rode VXLR+

However many people have thought about and designed their own solutions for this.

links
audio - Phantom Power supply for Electret mic - Electrical Engineering Stack Exchange
Convert 48V Phantom Power to 9V
This one is more about powering electrets in general, good read! Especially intrigued about just using two batteries in series and that's it:
Powering microphones
One of TI's examples is downregulating from 48V for the below circuit:
LM317HV 60V Input, 1.5A Adjustable Output Linear Regulator | TI.com
Feb 11, 2019 12:15

What is the best recording setup for recording discussions and interviews?

Posted by admin |

Towards a setup with a focus on redundancy and forgiveness — so that botching a recording will hopefully be a thing of the past.

What we ideally would like to have, is a wireless system with high mic capacity, where all mics are sent digitally into a sound card and presented as separate channels to the audio workstation of your choice, for processing and mixing. Also, it would be nice to have multiple systems recording in parallel.

We can't get all the way to that on a small or medium budget. But we can get somewhat close.

Last week I rescued a conversation/interview track from a good videographer where unfortunately different sound levels and noise levels had been mixed together into a mono mix. Since people took turns in talking it wasn't too hard this time to make it really good by applying noise reduction and normalization per-region.

And I guess we've all have experienced a recording, by us or by someone else, where one participant just isn't audible or where the sound quality varies to the point that the listener must wonder if the people talking are all in the same room, or even at the same event.

If you have an experienced team that interviews you, they know how to set up things and they will have a dedicated sound technician. I was interviewed by such a team (from German 3sat)  a few months ago. Flawless.

But if you don't have access to that and I don't most of the time, it can be interesting to explore what technology can do to help to make sure you do not botch the recording. Do note that the equipment listed below is untested by me, with a couple of exceptions.

B&H Photo Video Audio has an article that touches on some of these topics, although they specifically talk about field recordings: How to Use a Portable Audio Recorder in Field Production

Many microphones are better than few microphones

If you have many microphones, errors in individual setups will have less grave consequences

Wireless is king

Many interesting conversations take place that aren't solely for the benefit of the recording. We can't have cables all over the place!

Separate digital tracks into the computer

It's better to be able to process separate channels afterwards and compensate for different levels of noise, sound characteristics and the like. Also, you can get rid of tracks that were no good. This is often referred to as multi channel recording.

The audio should be converted to digital as soon as possible.

And preferrably not converted back and forth a couple of times.

Setups that try to meet these requirements

The solution that meets all requirements (almost)

I'm adding this here: Samson — Go Mic Mobile®

With the lapel/lavalier option, this is really cool since it is all digital. It's a wireless system with a receiver that can send two independent channels, from two wireless devices, directly to USB.

I'm tempted to "drop my mic" here. However read on for systems with higher channel counts and many more options.

Wireless microphone system

AKG DMS Tetrad ~€700

A 4 channel wireless microphone system that is digital, and has 4 separate outputs. Separate outputs is kind of rare under €1000. The digital wireless part should make it more robust against interference (all wireless mic systems are turning digital nowadays). The Tetrad also has separate outputs for each microphone! But alas, it has no digital out.

Microphone arrays

As a backup, an advance conference microphone system may be good. This one has 4 microphone arrays and automatically listens in the direction of the current speaker. It has good reviews but not sure if everything is also available over USB and not just Bluetooth.

Bluetooth Speakerphone - eMeet M2 Black Wireless Conference Speakerphone ~€200

A cheaper version with no arrays is this (tested by me, ok) and it works well over USB:

Jabra Speak 510 UC USB/Bluetooth ~€100

Multi-channel sound cards

Some sound cards only allow stereo digital output, others offer 4,8 or 96 outputs for that matter. Sometimes it depends on the drivers and operating system in the computer how many channels you get. Behringer UMC1820 and Behringer UMC404HD  work well with Linux according to what I could read at LinuxMusicians— Linux support Behringer UMC404HD?.

My guess is that all cards below work well on Linux. OSX also does a good job with multi-channel while Windows struggles and needs bespoke drivers.

What is a channel

With "channel" below is meant the whole chain: An XLR/phone input with a mic preamp on the card that turns up as a separate channel in the computer's audio workstation.

Compact studio cards

Behringer UMC404HD  Four 24-bit channels. ~€100

Cheap, compact.

Focusrite Scarlett 18i8 2nd Gen ~€300 An eight channel 24-bit that is not a 19 incher for rack mount, but much more compact

19" studio cards

Behringer UMC1820~ €180 Eight 24-bit channels + ten virtual Adac ones.
Cheap, 19" for rack mount.

Behringer ADA8200 Ultragain ~€150 Eight 24-bit channels.
Cheap, 19" for rack mount.

Portable with extra built-in mics and built-in recording

These recorders function just as the above sound cards, but add the ability to store multi channel recordings directly and in parallel on the device, and are eminently portable and have a couple of replaceable microphones built-in.

Zoom H5 Handy Recorder | Zoom ~€250 Two 24-bit channels + 2 more with a separate clip-on adapter for ~€60

Zoom H6 Handy Recorder | Zoom ~€300 Four 24-bit channels + 2 more with a separate clip-on adapter for ~€60

Built-in recording and audio work stations

These work stations can function just as the above sound cards, but add the ability to store multi channel recordings directly and in parallel on the device, and are also mixing desks with a lof of hardware knobs and faders. It's really cool, but more to lug around and may look a bit intimidating to the participants.

Zoom LiveTrak L-12 Fourteeen 24-bit channels ~€500
Here is an inspiring video. Zoom LiveTrak L‑12 | Mixing pop/rock song - YouTube The multi channel source files are from a reference library, free for people to try their mixing chops on. Gorgeous song and singing voice, if you ask me! Some people report bleeding between higher track numbers for this device. Some of the channels on this one are not pre-amped.

Zoom R16 Eight 24-bit channels. ~€330
An oldie that still seems to give the best bang for the buck. Some of the channels on this one are not pre-amped.

Shoestring option

Some Linux distributions such as Ubuntu Studio with Ardour and Jack should be able to record from several sound cards at once. In fact I will try this a bit later with some old sound cards.

Here is a wireless microphone that records straight to USB: Fifine.

Not sure it's digital in the wireless part though.

Synchronization with video

One option is to record through the video mic and then use software that synchronizes your multi channel stuff with the video. One piece of software that does this is the python script align videos by sound. I maintain that software, but other people are the ones that have coded it, I just smacked a command line interface on it. I have used align videos by sound to synchronize a mobile phone voice recording with the video camera's internal mic recording, and it worked fine, reporting the correct offset.

General sound into the video cameras

In order to sync with video. the cameras should record sound even if we will not be using that sound, since it will be used for syncing. Conversely, one of the mics going into the multi channel card should be close to the camera mics to pick up the same pattern.

Redundancy

One option here is to mic up each person with two mics, and simply let the second mic record to the person's phone (or other phone). I have an Aputur A.lav lapel mic that can do that, but not happy with it. Worst case, just use the internal microphone of the phone!

 

 

 

 

Feb 09, 2019 03:40

Render times and hangs with Linux Flowblade editor

Posted by admin |

Verdict: "Mp4 lossless"on Flowblade 2.0 is the winner, neglible RAM use and 330MB output file on a scale from 47MB (h264) to 6.9GB (ffyuv).

Material: an 11 minute screencast with sound.

Render times and behavior
Lossless output Flowblade version Result RAM use Render time Render size
ffyuv 1 series fine < 1GB 2m 34s 6.9GB
h264 1 series hangs computer but finishes 16GB 8m 30s 46.6MB
ffv 1 series hangs computer, no finish 14GB 3m 58s 1.9GB
MPEG-4 2 series fine < 1GB 2m 28s 328.5MB

 

You can then use ffmpeg to make a smaller lossless video. For example:

ffmpeg -i input.mp4 -c:v libx264 -crf 0 -c:a copy output.mkv

brings down the MPEG-4 file to 144MB with neglible RAM use.

Feb 08, 2019 06:40

Testing out deepspeech for speech to text recognition

Posted by admin |

Contents: 16 minutes of heavily compressed "mushy" speech in British-ish English. Text file needed to create a script to redo the audio. I tried deepspeech 0.4.1 with its supplied model.

./bin/deepspeech --model models/output_graph.pb \
--alphabet models/alphabet.txt \
--trie models/trie --lm models/lm.binary \
--audio resampled-mono.wav > 16monoklr.txt

For comparison here's what Google transcribes from the same file:

this is the Swedish Land Registry logjam products contract blockchain system a Croma way running on s flex so I'd open a number of tabs here for each participant into the smart contract seller buyer sellers and buyers Bank the Land Registry itself and another server which in this case could be the demo…

First try on a 48KHz stereo wav file. The result is close to garbage and way too short:

his is the way should under his dream look him potomac changes and i conteanyng on spikes so i oftener of catechism in to the smart contract celeritate sang biting the understreak so i don't know server wichitas be the democrats not stage she told some pecorino is…

Second try 16KHz stereo version of the same file. Result, this is the entire contents of the file:

ohhhhhhhhh ohhhhhhhhh hhhhhhhhow hhhhhhhhow hhhhhhhhow here

Third try 16KHz mono version of the same file. The result is close to garbage and way too short:

this is these we should under destrem look him or he come look changed and a craney running on specs so i don't get a number of caterers to the smart contract selerier said or sankirtan the understreak self and an observer which he is caste democrat…


 

 

Feb 05, 2019 02:05

What's the best microphone for a screencast?

Posted by admin |

I want super sound quality that doesn't preoccupy my hands, or is a table microphone, it needs to be close to my mouth.

My best microphone for this purpose that I own, is a T-bone TWS One (~€60) wireless headset that runs on 865 MHz to a wireless receiver. It's actually really good. I do not need any better. But it is a bit of work to set up:

  • the headset itself
  • the transmitter with batteries
  • the receiver, with power adapter
  • A 6.3mm output from the receiver that needs to go somewhere

So is there more convenient stuff out there?

What is not better

I have a lavalier, an Aputure A.lav. It is emphatically worse in sound quality than the T-bone. Its thin microphone cable is prone to picking up hum, and it makes a lot of scratching noises when cables move around. Maybe my copy shouldn't have passed quality control.

Also worse is a Sony MDR-XB950B1 headset over Bluetooth. If you post process with normalization, equalization and compression you can get up to the level of the sound of a depressed airline pilot over the plane's PA.

Here is the microphones I am looking at right now

Plantronics Voyager 4220 UC bluetooth headset €200

Has good reviews. A bit expensive though, but might be a good replacement for my Sony MDR-XB950B1. About €200.

Samson Go Mic USB, USB microphone €40

USB means there is very little analog cable length to pic up hum. It is also reasonably priced, very small with built-in clip and mic mount. About €50.

ModMic 4/5, clip-on analog microphone for headphones

Good reputation but does have a long analog cable. But maybe it is well shielded. Analog means it can be plugged into an analog mixer. However if you run a Linux distribution with Jack, such as MediBuntu, you ought to be able to do simultaneous recording from multiple sound cards, including USB microphones.

ModMic Wireless, clip-on wireless microphone for headphones €100

ModMic Wireless – Antlion Audio A bit expensive.

Overviews

 

Feb 02, 2019 01:55