ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
increases doubles playback speed, by dropping frames see
ffmpeg -i input.mp4 -f opengl "window title"
or useffplay
ffmpeg -i video.flv video.mpeg
ffmpeg -i input.mkv -filter:v "setpts=0.5*PTS" output.mkv
increases doubles playback speed, by dropping frames seeffmpeg -i input.mp4 -f opengl "window title"
or use ffplay
ffmpeg -i video.flv video.mpeg
To convert a video to 16x9 or 9x16 by adding black bars use ffmpeg as follows
ffmpeg -i film1.mp4 -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1" film1_bars.mp4
This add bars to the top and bottom, flip both of the 1920:1080
to 1080:1920
for horizontal bars (better for computer monitors, TV etc)
Note IGTV also requires h.264 and a max of 30fps.
It's actually fairly easy to control Home Assistant remotely using curl
but I couldn't find a complete solution on how to do this, so here goes...
configuration.yaml
by adding the line api:
curl -X GET -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" http://YOUR_IP:8123/api/states | prettyjson
prettyjson
is an alias for python -m json.tool
, you don't need this it's just easier to read.curl -X GET -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" http://YOUR_IP:8123/api/states/switch.mylight | prettyjson
This is running on Linux Mint 20
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(. /etc/os-release; echo "$UBUNTU_CODENAME") stable"
sudo apt-get update
sudo apt install docker-ce docker-compose
sudo usermod -aG docker $USER
docker --version
A simple example of code for testing a custom tensorflow Keras layer
def my_init(shape, dtype=None):
"""This function is a custom kernel initialiser. It loads the weights from a matlab file. Adapt as need"""
matlab = io.loadmat('../matlab/weights.mat')
wfilter = matlab['wfilter']
if shape != wfilter.shape:
raise Exception('Shaped do not match')
return tf.constant(wfilter, dtype=dtype)
sudo modprobe v4l2loopback \
devices=1 exclusive_caps=1 video_nr=5 card_label="Dummy Camera"
Speed1.avi
, this can be played streamed to /dev/video5
with
ffmpeg -re -stream_loop -1 -i Speed1.avi -vcodec rawvideo -pix_fmt yuv420p -f v4l2 /dev/video5
You can keep the leftovers in a jar.
Linux mint has a few annoyances when using dual monitors. First fixing the log in screen. By default, it uses the same resolution as the primary monitor in the secondary screen. My secondary monitor is much larger so it doesn't display correctly. It's only cosmentic but it annoys me.
Create or append the file /etc/lightdm/lightdm.conf.d/70-linuxmint.conf
so that it has the lines
[SeatDefaults]
user-session=cinnamon
display-setup-script=/usr/bin/lightdmxrandr.sh
I have simple bash script that starts lots of processes. If one fails I want to stop everything. There maybe a better way to do this but I came up with this.
First create two scripts to test our main script. good_sleep
that sleeps for 10 seconds and exits with no error.
#!/bin/bash
echo " good sleeping"
sleep 10
echo "done"