Tuesday, November 3, 2020

Converting Main/High 10 profile to Main/High with ffmpeg and nvenc

 Use this:

ffmpeg -hwaccel nvdec -i input.mkv -c:a copy -c:v h264_nvenc -cq:v 21 -profile:v main -pix_fmt yuv420p output.mkv

Also, adding "-loglevel verbose" option to ffmpeg helped me figuring out the problem for me, because I was trying to encode the video and nvenc kept giving me some error along the lines of "no nvenc supported device" which clearly wasn't true. With the logging option, I realized since input was in "high 10" profile, it was trying to produce a 10 bit output too, which my device did not support. 

Sunday, August 30, 2020

Switching CTRL and ALT keys in Ubuntu 20.04

UPDATE 1: In a more recent distro, items 1-3 might not be needed, since they might already exist in the default xkb config files. Search the files for what we're about to add, and do not add the suggested items if they already exist.

UPDATE 2: If you don't use gnome, like I do on my x-only-no-desktop-environment arch linux setup, item 4 has no effect. Instead you can run "setxkbmap -option ctrl:swap_lalt_lctl -option ctrl:swap_ralt_rctl" (e.g. by putting that in your ~/.xinitrc file).

 Adapted from this: https://askubuntu.com/questions/885045/how-to-swap-ctrl-and-alt-keys-in-ubuntu-16-04

1. Edit /usr/share/X11/xkb/symbols/ctrl and add this snippet at the end:

// Swap the functions of the right Alt key and the right Ctrl key.
partial modifier_keys
xkb_symbols "swap_ralt_rctl" {
    replace key <RALT> { [ Control_R, Control_R ] };
    replace key <RCTL> { [ Alt_R, Meta_R ] };
};

NOTE: The reason we only deal with swapping right alt and right ctrl in this step (and the next ones) is that the functionality for switching left alt and left ctrl is already in place and only needs to be enabled in step 4.

2. Edit /usr/share/X11/xkb/rules/evdev.lst and add the following line to the "! option" section:

ctrl:swap_ralt_rctl Swap Right Alt key with Right Ctrl key

3. Edit /usr/share/X11/xkb/rules/evdev and add the following line to the "! option = symbols" section:

ctrl:swap_ralt_rctl   =   +ctrl(swap_ralt_rctl)

4. Run this:

dconf write "/org/gnome/desktop/input-sources/xkb-options" "['ctrl:swap_lalt_lctl','ctrl:swap_ralt_rctl']"

Thursday, February 23, 2017

Running LXDE inside Xephyr in Arch Linux

Install Xephyr:
sudo pacman -S xorg-server-xephyr
Install LXDE:
sudo pacman -S lxsession-gtk3 lxpanel-gtk3 pacmanfm-gtk3 openbox lxtask-gtk3 lxde-icon-theme lxterminal-gtk3 lxrandr-gtk3
Then run Xephyr:
Xephyr -ac -noreset -query localhost -screen 1920x1080 -keybd ephyr,,,xkbmodel=evdev :3
And in another terminal:
DISPLAY=:3 startlxde

Friday, September 30, 2016

D-Bus user session

I noticed that I cannot open the user dbus in Ubuntu while I could do that in Arch Linux. It seems there is no user dbus by default in Ubuntu (or Ubuntu server at least). To have one:

$ sudo apt install dbus-user-session

Then `sudo systemctl start --user dbus` or reboot.

Monday, September 12, 2016

Mysterious crashes in DPDK application when using the pcap driver.

I was experiencing mysterious crashes in my DPDK application when using pcap virtual devices (using the --vdev option). What's more, when there was more crashes, I didn't seem to be getting all the packets I should have. So I investigated, and found out I was attempting to capture packets from multiple threads. That seems to be a no no with the pcap driver, considering it explicitly does not support multiple queues. I limited the number of cores available to my application using the -c option, and everything was solved.

Fixing "no driver found for eth_pcap0"

I was getting a "no driver found for eth_pcap0" error message whenever I wanted to use an "eth_pcap" virtual device with my DPDK application. But the DPDK sample app "test-pmd" worked just fine with those. So I took a look at its Makefile and found out adding this line to my Makefile fixes the issue:

DEPDIRS-y += lib drivers


Monday, May 30, 2016

ISO seems to be empty in Linux

So I had this ISO that I knew wasn't corrupted because I've seen it mounted and used on a Windows machine. In Linux though, mount gave me a "wrong fs type" error and both Archive Mounter and Archive Manager said the ISO is empty.

A quick search brought me to this Ubuntu Forums thread that gave me the answer. The ISO was in the UDF format. This is how I managed to mount it: sudo mount -t udf -o loop ~/path/to.iso mountdir