Category Archives: Linux General

Notes which apply to all flavours of Linux systems

Speeding up and reducing resolution of videos

Sometimes it is necessary to speed up videos and/or reduce the resolution. This will typically result in a much small file size. ffmpeg and avconv allow video file manipulation on the command line.

These commands work on Debian 10, and will likely work on Ubuntu and other Linux distributions.

Speed up video, 2× speed:
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" output.mp4
Reduce resolution down to 1280×720:
ffmpeg -i input.mp4 -s 1280x720 output-small.mp4

Note that the metadata of the video, such as the resolution, can be read with the utility:
mediainfo

GDB – Coredump backtrace for cross-platform debugging

When developing on platforms with a different architecture and cross-compiling, it is often necessary to print the stack trace on a coredump.

TOOLCHAIN=/path/to/toolchain
DEBUGER=$TOOLCHAIN/gdb
EXECUTABLE=myprogram
CORE=coredumpfile

$DEBUGER -ex “set sysroot $TOOLCHAIN” -ex “set auto-load safe-path $TOOLCHAIN” -ex "file $EXECUTABLE" -ex "core-file CORE" -ex "thread apply all bt full" -ex "quit" > trace.log

Mounting Android phone over USB on Debian

Debian Stretch

Using the following steps an Android phone can be mounted over USB by a Debian Linux system.

  • apt-get install jmtpfs
  • connect phone and select data transfer over USB
  • jmtpfs /mnt/phone

At this point, my phone prompts me whether or not to allow this connection. I select allow, but it is too late for the computer and any attempts to browse the directory /mnt/phone result in i/o errors. Unmounting and remounting without changing anything on the phone and leaving it connected, is a work-around for this issue.

  • umount /mnt/phone
  • jmtpfs /mnt/phone

Do work.

  • umount /mnt/phone

Vim – disable mouse mode

Newer versions of vi/vim included with Debian Stretch and later have the mouse mode enabled, which prevents traditional copy and paste from being used – the ability to highlight text and then middle-click to paste.

To re-enable this behaviour so that the middle-click can be used, enter the following line into your ~/.vimrc file:

set mouse=r