Scientific Computing

Losslessly trim in time videos with FFmpeg

Trim from time to end of video–discard beginning of video. In this examples, starting at 58 seconds.

ffmpeg -i in.mp4 -ss 00:00:58 -c copy out.avi

Trim from start to specified end time. In this example from 00:58 to 1:10.

ffmpeg -i in.mp4 -ss 00:00:58 -t 00:00:12 -c copy out.avi

Re-encode losslessly:

ffmpeg -i in.mp4 -ss 00:00:58 -t 00:00:12 -c:v ffv1 out.avi

Build POV-Ray

Install POV-Ray by:

apt install povray

or build POV-Ray from source

Example POV-Ray tutorial

#include "colors.inc"
background { color Cyan }
camera {
    location <0, 2, -3>
    look_at  <0, 1,  2>
}
sphere {
    <0, 1, 2>, 2
    texture {
        pigment { color Yellow }
    }
}
light_source { <2, 4, -3> color White}

POV-Ray can accomplish photorealistic rendering via raycasting.

POV-Ray example

Play video from Beamer LaTeX presentation PDF

To pop up your default video player upon click in Beamer LaTeX-generated PDF, use the LaTeX syntax

\href{run:myvideo.avi}{cool video}

You must use either

  • relative path (e.g. ../data/myvid.avi gfx/myvid.avi)
  • fully resolved absolute path (e.g. /home/joe/data/myvid.avi)

These will NOT work

  • ~
  • $HOME

LaTeX Beamer multi-column table of contents

A LaTeX Beamer presentation (slide deck) with a long table of contents as generated by

\tableofcontents

may run off screen.

Fix

add to LaTeX preamble (near top of main .tex file):

\usepackage{multicol}

Then the TOC slide will go over multiple columns. In this example Beamer slide, two column table of contents is specified:

\frame{
\begin{multicols}{2}
\tableofcontents
\end{multicols}
}

Survey of 4G LTE Ethernet routers

Reliable cellular router requirements:

  • External antenna (system + router is inside rugged weatherproof metal enclosure)

  • Ethernet connection to equipment

  • Wifi not desired or needed

  • USB not allowed. Numerous companies have cheap routers with a USB input to a consumer modem. Don’t allow one computer going down to take down connectivity to the whole site.

  • Setup via web or SSH

  • 4G LTE 700/850/1700 (AWS)/1900 MHz

  • Transfer Rate: 50 Mbps Up, 100 Mbps Down

  • Antenna: 2 or more with connectors for coax cable

  • Ethernet: 10/100/1000 Mbps

Antenna: a broadband yagi, typically log periodic to give continuous frequency coverage to the numerous LTE bands. Example: Wilson LTE yagi.

Ubuntu applications shortcuts

For Linux desktop environments programs show up in menus from:

  • /usr/share/applications
  • ~/.local/share/applications ← especially for WINE

Sometimes an application might not appear in the desktop menus because it doesn’t have a .desktop file in either of these locations. Try opening one of the .desktop files for a program that works, and saving as a new file, editing for a program you’d like to work the same way.

Reference

LaTeX content in parent/sibling directories

error: epstopdf Output filename not allowed in restricted mode

may occur if you include .eps files above the directory of the .tex file. LaTeX by default cannot traverse upwards from the current “*.tex” directory. This is generally a good security choice.

When necessary, it is possible to bypass this security by including the --shell-escape option in pdflatex command:

pdflatex --shell-escape myfile.tex

In TeXmaker / TeXstudio, under: Options → Configure → Commands add --shell-escape right after pdflatex in the PdfLaTeX command box.

This example shows when --shell-escape is needed. Assuming files

~/work/report.tex
~/matlab/plot.eps

This LaTeX content triggers the error until --shell-escape is used.

\includegraphics{../matlab/plot.eps}

Unstick Windows update network connection

Windows Fast Ring builds keep sticking at 87% before updating. I got into a giant boot loop where the update would fail or I’d hard reboot (hold power button) and this was not working. This problem can be fixed by if computer is on WiFi, additionally plug it in via Ethernet. This may require a USB 3 to Ethernet adapter if your PC doesn’t have an Ethernet port.

  1. Unplug the Ethernet connector when Windows Update is stuck (for me it was at 87%)
  2. wait say 10 seconds, then plug in Ethernet again.
  3. upon plugging Ethernet in, Windows Update very rapidly finished the update and rebooted and continued installing Windows.

This happened for me on multiple Windows builds. Each time, the procedure above made Windows Update complete rapidly and successfully.