VideoRoom plugin - merge all the audio files into one audio conversation file [script]

292 views
Skip to first unread message

Ireneusz Słonina

unread,
May 4, 2016, 9:53:33 AM5/4/16
to meetecho-janus
Hello,
Janus Videoroom plugin produces separate audio file for all of the publishers.
Additionally when publisher reconnects or unpublish/publish his stream, it starts new audio file.

I was looking for a method of creating one audio file from whole conversation, mixing all the inputs with taking on board different starting times.
I didn't find any so I wrote a python script to do that for me and wanted to share it, maybe someone will need that.

Script works on audio.mjr files produced by Janus.
It scans directory passed in arguments and merges all the files found.

Basic pipeline is:

videoroom-participant-audio.mjr -> opus -> ogg -> ogg with preceding silence -> merge with others -> output.wav

Required software:
* ffmpeg with ffprobe binary
* sox
* janus-pp-rec

You may need to adjust binaries locations in the script.
Script assumes that one directory == one conversation.

Example output:

[x@y ~]$ create_conversation.py -d 123
found audio file:  videoroom-123-user-878704250-1462361596247050-audio.mjr
found audio file:  videoroom-123-user-2998112852-1462361608909200-audio.mjr
found audio file:  videoroom-123-user-2998112852-1462362134615890-audio.mjr
found audio file:  videoroom-123-user-2998112852-1462362316378047-audio.mjr
found audio file:  videoroom-123-user-2998112852-1462362923901642-audio.mjr
videoroom-123-user-878704250-1462361596247050-audio.mjr starting in conversation at 0.0s
videoroom-123-user-2998112852-1462361608909200-audio.mjr starting in conversation at 11.838261s
videoroom-123-user-2998112852-1462362134615890-audio.mjr starting in conversation at 537.271832s
videoroom-123-user-2998112852-1462362316378047-audio.mjr starting in conversation at 719.036756s
videoroom-123-user-2998112852-1462362923901642-audio.mjr starting in conversation at 1326.641527s
Output file: 123.wav
Cleaning intermediate files
[x@y ~]$


[x@y ~]$ create_conversation.py -h
usage: create_conversation.py [-h] -d DIRECTORY [-o OUTPUT] [-v] [--dirty]

Script will parse all audio files in given folder and it will make
DIRECTORY/DIRECTORY.wav file as an output of the conversation

optional arguments:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory DIRECTORY
                        Directory with audio mjr files
  -o OUTPUT, --output OUTPUT
                        Output audio file
  -v, --verbose         Verbose (print output of subcommands)
  --dirty               Don't clean intermediate files
You have new mail in /var/spool/mail/janus
[x@y ~]$

Script: http://pastebin.com/PaEknDmT

License: Do what you want.
Copyright: Orange Retail S.A.

Best Regards,
Irek Slonina





Lorenzo Miniero

unread,
May 4, 2016, 9:58:59 AM5/4/16
to meetecho-janus
Irek,

amazing effort, thanks for sharing!

Lorenzo
Reply all
Reply to author
Forward
0 new messages