How to fix DaVinci Resolve audio issues on Ubuntu 20.10

Hello πŸ‘‹,

To fix audio issues on a fresh install of DaVinci Resolve 18 on my Ubuntu 20.10 PC I did the following things:

1. List all the available sound cards

cat /proc/asound/cards
 0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfc080000 irq 94
 1 [AI1            ]: USB-Audio - RODE AI-1
                      RODE Microphones RODE AI-1 at usb-0000:2d:00.3-1.3, full speed
 2 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfc400000 irq 96
 3 [U0x46d0x81b    ]: USB-Audio - USB Device 0x46d:0x81b
                      USB Device 0x46d:0x81b at usb-0000:2d:00.3-1.4, high speed

List all the available sound cards a chose a default. I like playing audio though my headphones when editing and the headphones are connected to my USB Audio Interface RODE AI-1, this is what I want to use as the default card.

2. Set the default card for Alsa

To set the default card I’ve created a new file /etc/asound.conf and pasted the following contents into it:

   defaults.pcm.card 1
   defaults.ctl.card 1

The number 1 represents the number of the default sound card, in my case it is:

 1 [AI1            ]: USB-Audio - RODE AI-1
                      RODE Microphones RODE AI-1 at usb-0000:2d:00.3-1.3, full speed

After it’s set, reload alsa with: sudo alsa force-reload

3. Start DaVinci Resolve 18 and restart pipewire

Each time you start DaVinci Resolve 18 you may need to run the following command in order to get audio working:

systemctl restart –user pipewire

Note: DaVinci Resolve can’t play AAC audio files on Linux.

Note: Your audio may stop working outside DaVinci resolve while editing and after closing it, to fix it run the above command again.

4. If this breaks your audio on other software

Remove /etc/asound.conf file and restart Alsa & Pipewire. We need to wait for an official fix. 😦


Thanks for reading! I hope you’ll find this useful.

Happy hacking! 🦾

Separate Audio from Video (with ffmpeg)

Hello πŸ‘‹

In this short article I will show you how to split audio from video using ffmpeg.

When I worked on my Udemy course I needed a way to process audio in Audacity and edit the video in Kdenlive.

So I wrote two bash scripts, one for spliting audio and video and another one to combine the processed audio (usually a .wav file with the same name) with the video.

The result is the following

split-video.sh

filename=`echo "$1" | awk '{gsub(/.*[/]|[.].*/, "", $0)} 1'`
ffmpeg -i "$1" -vn -c:a copy "${filename}Temp.m4a"
ffmpeg -i "$1" -an -c:v copy "${filename}Temp.mp4"

combine-video.sh

filename=`echo "$1" | awk '{gsub(/.*[/]|[.].*/, "", $0)} 1'`
ffmpeg -i "./${filename}Temp.mp4" -i "./${filename}Temp.wav" -c:v copy -c:a aac "./${filename}Final.mp4"
rm "./${filename}Temp.m4a"
rm "./${filename}Temp.mp4"

Thanks for reading and happy hacking! πŸ„

Exec as root user in Kubernetes

Hi πŸ‘‹,

In this short tutorial I will show you a way of getting a root shell in containers running inside a modern Kubernetes cluster.

Prerequisites:

  • Root access to the cluster node in which the container is running.

Problem Statement

We wan’t root access into a running container, exec gives us non-root user.

➜  Downloads k get pods
NAME                     READY   STATUS    RESTARTS   AGE
my-release-cassandra-0   1/1     Running   0          2m9s

➜  Downloads k exec -it pod/my-release-cassandra-0 -- /bin/bash
I have no name!@my-release-cassandra-0:/$ whoami
whoami: cannot find name for user ID 1001
I have no name!@my-release-cassandra-0:/$ touch test
touch: cannot touch 'test': Permission denied
I have no name!@my-release-cassandra-0:/$ 

Solution

To obtain root access. First grab the Container ID from inside the pod.

k describe pod my-release-cassandra-0
Containers:
  cassandra:
    Container ID:  containerd://8fa7af3900d556aa8a91b1ac4cbe46335e8df233f8645b0a2329b2f0e6d76177
    Image:         docker.io/bitnami/cassandra:4.0.7-debian-11-r0

Then if it the id starts with containerd:// run the following command on the node the pod is running:

sudo runc --root /run/containerd/runc/k8s.io/ exec -t -u 0 8fa7af3900d556aa8a91b1ac4cbe46335e8df233f8645b0a2329b2f0e6d76177 /bin/bash

You should get a root shell into the Cassandra container:

root@my-release-cassandra-0:/# whoami
root
root@my-release-cassandra-0:/# touch test
root@my-release-cassandra-0:/# ls
bin	 boot  docker-entrypoint-initdb.d  etc	 lib	media  opt   root  run.sh  srv	test  usr
bitnami  dev   entrypoint.sh		   home  lib64	mnt    proc  run   sbin    sys	tmp   var

Thanks for reading and happy cloud surfing! πŸ„