Tag: tech_support

Compressing video with ffmpeg

I was looking into what was taking up space in my Dropbox account and found some older videos, each a few gigabytes in size, where I didn’t really care if there was a small loss of quality to make them much smaller. I found some options with ffmpeg that worked pretty well

ffmpeg -i input_file -vcodec libx265 -crf 34 output_file

This will re-encode the file using x265. The “-crf” option specifies the amount of compression, with a range from 0-51: “0” being lossless and “23” the default. With the default I was able to halve the storage space required with negligible video loss. I upped it to “34”, as above, and while there was a bit of loss in video clarity, it didn’t matter for the video content. The result? A file originally ~ 2.4 GB in size was reduced to ~ 300 MB.

I had a folder of such videos, so used this Bash one-liner to process each file and output a new processed file.

for file in ./*.mp4; do ffmpeg -i ${file} -vcodec libx265 -crf 34 ${file%.*}_processed.mp4; done

${file%.*}_processed.mp4 means from the original file, keep the filename (removing the extension) and replaced it with “_processed.mp4”.

Errors while running Rust on Virtualbox

I got the following error when running “cargo run” on my “Roguelike” follo-along project (https://bfnightly.bracketproductions.com/rustbook)

Err` value: CreationErrors([NoAvailablePixelFormat, NoAvailablePixelFormat])'

I found the error was due to 3D acceleration being enabled on my Linux Mint 19-based development environment, running on Virtualbox 6.1.10. That is, make sure you have this in your vboxmanage line in your Vagrantfile:

vb.customize ["modifyvm", :id, "--accelerate3d", "off"] # Disable 3d acceleration until Virtualbox team fixes it

Remembering back as to why I had that line set to “on”, I think I was playing around with getting the Android emulator to work in Virtualbox, which as of 6.1 supports nested virtualization. I came close to getting that working, ultimately I don’t think it’s possible right now.

Configuring OSMC for high quality audio

And what I mean by that is, “default all audio output to a USB device, not unlike an O2+ODAC kit from JDS labs”.

Step 1: Install OSMC, which is a Kodi-based media entertainment distribution that can run on Raspberry Pi (https://osmc.tv/download/)

Step 2: Configure ALSA audio to use the USB audio device as the default (this way, I don’t always have to keep the USB device powered).

dmesg output when connecting the USB soundcard

Check which cards are identified by asound

“cat /proc/asound/cards” output

I have to make the USB audio device the default, in slot 0. Edit the file /usr/share/alsa/alsa.conf and change the default device to be “1”, thus, USB audio will become “0”

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

Reboot the device, run “cat /proc/asound/cards” again and check the order has changed. Regardless of whether the USB audio amp is actually plugged in on power up, whenever you do plug it in, it will come up as the default device and audio will be routed to it.

Pushing to Bitbucket vs Gerrit

This is totally for me in the future because I always bloody forget when switching to a Bitbucket project:

Bitbucket (creates the branch remotely, ready for you to make a pull request and add reviewers):

git push -u $(git remote) cool_branch_name

Gerrit (creates a review against the project_ci branch, whatever that is, ready for you to add reviewers):

git push $(git remote) HEAD:refs/for/project_ci