Audio/Video

How to autojoin Jitsi Meet meeting using Tapermonkey script

This code clicks the join button:

document.querySelector(".prejoin-preview-dropdown-container div[role='button']").click()

By using the correct @match, you can activate this only for a specific conference:

Complete script:

// ==UserScript==
// @name         AutojoinJitsiMeet
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  ?
// @author       You
// @match        https://meet.jit.si/TestAutoJoin
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.querySelector(".prejoin-preview-dropdown-container div[role='button']").click()
})();

 

Posted by Uli Köhler in Audio/Video, Javascript

Fullscreen camera view using libcamera-vid

libcamera-vid --width 1920 --height 1080 -f -t 10000000000

-t 10000000000 means to run for 10000000000 milliseconds (almost 4 months)

Posted by Uli Köhler in Audio/Video, Electronics, Raspberry Pi

How to fix raspistill ERROR: the system should be configured for the legacy camera stack

Problem:

While trying to capture an image using raspistill, you see the following error message

ERROR: the system should be configured for the legacy camera stack

and no image is being produced

Solution 1 (recommended): Use libcamera

Recent versions of Raspbian use libcamera instead of the broadcom legacy camera API. You can capture an image using libcamera-still similarly to raspistill:

libcamera-still -o test.jpg

Solution 2: Enable legacy camera API

If you absolutely need raspistill specifically to work, you can still enable the legacy camera API using rpi-config:

sudo raspi-config

Go to:

  • 3 Interface Config
  • I1 Legacy Camera

and choose Yes to enable the legacy camera API.

Posted by Uli Köhler in Audio/Video, Raspberry Pi

Raspberry Pi libcamera VLC livestreaming (1920×1080)

On the Pi, run

libcamera-vid -t 0 --width 1920 --height 1080 --codec h264 --inline --listen -o tcp://0.0.0.0:8888

On the client, run

vlc tcp/h264://192.168.1.185:8888/

where 192.168.1.185 is the IP address of the Raspberry Pi.

Posted by Uli Köhler in Audio/Video, Raspberry Pi

How to transcode folder of WAV files to MP3 using lame on the command line

In our previous post How I use lame to encode Music to mp3 we showed how to use lame to transcode a single WAV file to MP3, detailing

This is the bashscript I use to transcode all WAV files in the current folder to MP3:

for i in *.wav ; do lame -h -V 3 "$i" ; done

If you files are named .WAV instead of .wav, use the following version instead:

for i in *.WAV ; do lame -h -V 3 "$i" ; done

 

Posted by Uli Köhler in Audio/Video

How to use streamripper to rip & split online radios using docker-compose

I published the docker image ulikoehler/streamripper to make it trivially easy to rip & split online radios.

Use this docker-compose.yml to rip a single online radio to ./TheRadio:

version: '3.5'
services:
   theradio:
     image: ulikoehler/streamripper:latest
     volumes:
       - ./TheRadio:/app
     command: ["streamripper", "https://theradio.domain/stream.mp3", "-s", "--xs2", "-d", "."]

You can use our script from Create a systemd service for your docker-compose project in 10 seconds in order to create a script to autostart the ripper on boot:

curl -fsSL https://techoverflow.net/scripts/create-docker-compose-service.sh | sudo bash /dev/stdin

 

Posted by Uli Köhler in Audio/Video

How to encode UHD 4K video from camera for DaVinci Resolve input using ffmpeg

I use this command to convert the video from my phone (in UHD / 4K) for use as input Media in DaVinci Resolve using the DNxHR codec.

ffmpeg -i input.mp4 -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq output.mov

Note that the DNxHR files are huuuuuuge, around 10GB per minute even for some rather uncomplicated video! However, encoding is pretty fast (around 0.5x real-time on my computer) and you won’t really lose any significant amount of quality in this video type.

This shell script will batch-encode all .mp4 files in the current folder to DNxHR

for i in *.mp4 ; do ffmpeg -i $i -vcodec dnxhd -acodec pcm_s16le -pix_fmt yuv422p -r 30000/1001 -profile:v dnxhr_hq ${i}.mov ; done

 

Posted by Uli Köhler in Audio/Video

How to re-encode videos as H.265 & opus using ffmpeg for archival

When you don’t want your video archive to eat up too much space, I recommend encoding them as H.265 and OPUS as these codecs provide excellent quality with typically less than half the bitrate of older formats.

I also tried VP9 and AV1 which should result in even lower file size at the same quality. However, these are painfully slow, running at 0.0046x speed (libaom-av1) and 0.076x speed (libvpx-vp9) compared to 1.5x speed for libx265 for a test video since these encoders seem not to be highly optimized yet.

CRF means constant rate factor, higher values mean better quality but larger file size.

My recommendation is to use CRF 30 for lower-quality videos like analog grainy-ish videos, CRF 23 where you want to preserve the utmost quality, and CRF 26 for everything else.

For non-interlaced videos

ffmpeg -i input.mpg -c:v libx265 -crf 30 -c:a libopus -b:a 56k -frame_duration 60 output.mkv

For interlaced videos

Use -vf yadif=1 as interlace filter to prevent interlacing artifacts:

ffmpeg -i input.mpg -vf yadif=1 -c:v libx265 -crf 30 -c:a libopus -b:a 56k -frame_duration 60 output.mkv

Also see our shell script to encode all videos in a directory using this method

Posted by Uli Köhler in Audio/Video

How I use lame to encode Music to mp3

lame -h -V 3 mymusic.wav

This uses variable bitrate mode with -h (high quality but slightly slower) and produces the following frame bitrate histogram:

LAME 3.100 64bits (http://lame.sf.net)
Using polyphase lowpass filter, transition band: 18000 Hz - 18581 Hz
Encoding mymusic.wav
      to mymusic.mp3
Encoding as 48 kHz j-stereo MPEG-1 Layer III VBR(q=3)
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA 
 11459/11459 (100%)|    0:05/    0:05|    0:05/    0:05|   49.421x|    0:00 
 32 [  118] %*****
 40 [    0] 
 48 [    0] 
 56 [    0] 
 64 [    1] *
 80 [    0] 
 96 [   26] **
112 [  280] %************
128 [ 1412] %%%%%%%%%*******************************************************
160 [ 4372] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%***************************************************************************************************************************************************
192 [ 2319] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*************************************************************
224 [  864] %%%%%%%%%%%%***************************
256 [ 1206] %%%%%%%%%%%%%%%%%**************************************
320 [  861] %%%%%%%%%%%%%%%%***********************
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   kbps        LR    MS  %     long switch short %
  186.8       28.3  71.7        70.8  12.5  16.7
Writing LAME Tag...done
ReplayGain: -9.7dB

 

Posted by Uli Köhler in Audio/Video