Posting audio detection recordings for others can be tricky.
It seems that apps like Facebook don't support audio files.
So I was looking for an easy way around this issue.
Posting videos on social media is generally easier than audio files.In a few cases, where I wanted to send audio detection files to others, I'd used Shotcut to save the audio track with the corresponding spectrogram image.
But someone on the BirdNet forum (blogdemoi) set me thinking; how about using ffmpeg directly from a BirdNetPi screen button?
Although I've dabbled with PHP in the past, I just don't keep any coding knowledge in my head these days (...or much of anything else!). So I just had to try and hack my way through it.
The ffmpeg command posted by blogdemoi adds a nice white audio scope trace to the static spectrogram image. But I decided to go for a simpler command like this:-
ffmpeg -i sound.mp3 -loop 1 -i image.mp3.png -shortest video.mp4
...which seems to compile relatively small video files, typically 300-400kB.
System mods
The only file I needed to modify was: play.php
The first step was to add a new button on both the Recordings & the Best Recordings screens;
Pressing the Tux icon starts the export process |
For Recordings;
For Best Recordings;
Javascript mods;
PHP mods;
The only other thing I did was create a new folder on BirdNet in the BirdSongs folder called Exports and set its Group Folder access to: Create & delete files
I have to point out once again that this is one of my Horrible Hacks. There is no error checking and very little feedback (e.g. it will appear to allow exporting the same detection twice, but you just get the same/original file.
Maybe when time permits I'll give it a gentle polish!
Note that I'm no longer using the McGuire BirdNet-Pi, having now switched to the maintained version by Nachtzuster.
No comments:
Post a Comment