vconcat
Quick and dirty node.js hack that embeds subtitles then resizes and concatenates videos generated by the AutoBoy Dash Cam Android app. Could work with .mp4
and .srt
files coming from other sources though.
Subtitles (if present) are first (sort of) converted to Advanced Substation Alpha format (which uses the aptly named .ass
extension) via a very, very, VERY stupid and dirty algorithm and mainly for presentation purposes. There is no parsing whatsoever, just bits and pieces shuffled around.
Requirements
- ffmpeg executable in path
- ffmpeg-progressbar-cli to show encoding prgress
npm -i -g ffmpeg-progressbar-cli
- chalk for terminal string styling:
npm -i -g chalk
Usage
Optionally link the script with a shorter name to a folder in your PATH:
cd /path/to/script/
ln -s ./vconcat.js /usr/local/bin/vconcat
then run it:
vconcat "/path/to/source/folder" [scale ["path/to/destination/folder"]]
Params
-
"/path/to/source/folder"
Optional<string>
. A folder containing .mp4 and .srt files; default: current directory. -
scale
Optional<number>
. Resize videos using this floating point number; default: .25 (25% of the original). -
"path/to/destination/folder"
Optional<string>
. Where to save; default: source or current directory.
Caveats
The script makes a lot of assumptions regarding, among other things, file names, date and subtitle formats, so it is probably very frail. It works for me, sorry ¯\_(ツ)_/¯
.
It also contains a half-assed stab at a progress bar 🙃.
Localization (optional)
Dates are currently localized only to Romanian. There are no plans to support other locales, sorry. For this to be done using the format()
method of the built-in Intl.DateTimeFormat
object, the full-icu
package should be installed.
npm install -g full-icu
Node will use this ICU datafile if the environment variable NODE_ICU_DATA
is set to /usr/local/lib/node_modules/full-icu
or by running it like this: node --icu-data-dir=/usr/local/lib/node_modules/full-icu vconcat.js
A bit of context (optional)
Motivation
I'm using a donated Samsung A5 (2014) with the AutoBoy app as a dash cam. I'm archiving the recordings of most of the trips when my five year old daughter was in the car because she says lots of funny things and because I'm a melancholic old fart… maybe I'll even listen to them sometime in the coming years, you never know.
Anyway, the really important part is the audio track, but I felt that also keeping the video would provide a little more context to the sound. The subtitles also contain additional metadata such as date, time, speed and GPS coordinates. Storing them "as is" seemed a waste of space, so I settled on resizing the videos to ¼ of the original resolution. The sound is not touched.