Usage of ffmpeg complex filter


The goal: to pick two segments, 0-10sec and 20-31sec, from a 41 second long video in.mp4, to form a 20 second long video out.mp4.
The code:
ffmpeg.exe -i in.mp4 -filter_complex ^
“[0:v]trim=duration=10[V0]; [0:a]atrim=duration=10[A0]; ^
[0:v]trim=start=20:end=31,setpts=PTS-STARTPTS[V1]; [0:a]atrim=start=20:end=31,asetpts=PTS-STARTPTS[A1];[V0][A0][V1][A1]concat=n=2:v=1:a=1[V01][A01]” -map [V01] -map [A01] out.mp4
Explanation:
-i what’s following is input file.
-filter_complex complex because there are intermediate outputs.
[0:v] 0 means the input file after first -i, in.mp4 in this case. v means video stream.
[V0] the name of output of [0:v] after applying “trim=duration=10”. the first video output
[0:a] similar to [0:v] but audio.
[A0] similar to [V0] but audio. the first audio output
[V1] and [A1] are the output video and audio of second segment.
setpts and asetpts means to reset the Presentation Time Stamps.
-map tells what output to mux into the final output file.
out.mp4 is one of the output files, which is for the -maps preceding it.
what follows -map can be:
-map [V01] filter output name, like in the example above.
-map single_highest_quality_video_stream_from_all_inputs
-map 0 means the video and audio of the first input file

Advertisements

oathtool


For 2FA, Two-Factor Authentication, we install Google Authenticator on phone.
I tried oathtool, which gives the same code as Google Authenticator, as expected.
Here are the steps:
Installation:
To get oathtool, OATH one-time password tool, to my Ubuntu:
$ sudo apt install oathtool gpgv2
To get the secret key from Google:
go to myaccount.google.com, in 2-Step Verification section.
It looks like this: 5j6bpmmhulttoktetk6yidf3xwua0000
Verification, in a 30 seconds time window:
Go to Google Authenticator and record the code, 460273 in my case.
Quickly on Ubuntu, run this command:
$ oathtool –verbose –totp –base32 “5j6bpmmhulttoktetk6yidf3xwua0000”
output:
Hex secret: ea7c17b187a2e7372a649abd840cbbbd00000000
Base32 secret: 5J6BPMMHULTTOKTETK6YIDF3XWUA0000
Digits: 6
Window size: 0
Step size (seconds): 30
Start time: 1970-01-01 00:00:00 UTC (0)
Current time: 2019-05-20 00:45:15 UTC (1558313115)
Counter: 0x318995A (51943770)
460273
As seen here, 460273 matches the code from Google Authenticator.

oathtool

Debug Python with VsCode


Visual Studio Code debugs Python. Here are the steps on Windows 10.
Create a folder with a .py file in it, e.g. Rio\proj\python\caller.py
Run code.exe, open the folder Rio\proj\python
Install extension: ms-python.python, which is the Python extension for VsCode from Microsoft.
Install pathon:
https://www.python.org/downloads python-3.7.3.exe 32bit 24M
which installs to C:\Users\rio\AppData\Local\Programs\Python\Python37-32\python.exe
Add config: click Debug then Add config, which creates S:\Rio\proj\python\.vscode\launch.json
Choose interpreter:
From Command Palette, type: Python: Select Interpreter
The installed python should be listed there, and click it.
Debug: open caller.py, set break point, hit the debug icon, they hit the green arrow in the tool bar.
execution should stop and variables can be inspected by mouse over.VsCodePy

Debug JS with VsCode


VsCode can debug JavaScript so that we can set break point and inspect values, instead of console.log

Here are the steps.
I use VsCode v1.30, Chrome v61, Windows 10.
VsCode is downloaded as zip file from code.visualstudio.com/download, no setup.exe
Run Code.exe and install MS Debugger for Chrome extension 4.11.3 there..
Create a VsCode project file: js.code-workspace, which tells where the .js .htm files are.
Create a launch file by click debug icon – gear icon.
Restart code.exe to have chrome listed in extension. Click it.
.\.vscode\launch.json which tells what browser and and the URL to run
e.g. http://localhost/VsCode/test.htm
Click debug button, or F5. code.exe launches chrome.
Break points can be set.
Variables can be checked by mouse over or in watch window.

Sample code can be downloaded here: http://riowing.net/p/VsCode.zip

VsCodeJs