Dashcam

Blackvue DR900S-2CH

The script to download video files will check if the dashcam is on the network, and if it is then it will download the files. Be careful if you want to record while doing this, because while accessing the camera, any new footage misses frames and won’t be as smooth as normal. Best to grab the files when you’re not recording anything special.

Converting to constant frame rate for editing

The original format on these dashcams uses a variable frame rate which makes editing messy and jerky. It should first be converted to constant frame rate.

The exact frame rate is slightly different between the front and rear camera.

The front one is:

Frame rate mode                          : Variable
Frame rate                               : 25.647 FPS
Minimum frame rate                       : 14.925 FPS
Maximum frame rate                       : 32.258 FPS

The rear one is:

Frame rate mode                          : Variable
Frame rate                               : 25.691 FPS
Minimum frame rate                       : 14.925 FPS
Maximum frame rate                       : 30.303 FPS

Once these have been converted to constant frame rate (without specifying any particular rate) they will have the frame rates below.

Front

Frame rate mode                          : Constant
Frame rate                               : 30.000 FPS

Rear

Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS

Sometimes the rear camera is the correct 30000/1001 but sometimes it’s slightly off. We need these to be the same frame rate for editing. Also, the rate should be 29.97 (precisely 30000/1001) as this is the common NTSC format. The script to convert to CFR includes -r 30000/1001 which sets this as the frame rate.

Script to convert VFR to CFR:

#!/bin/bash

# Convert to constant frame rate of 30000/1001 (29.97)

ffmpeg  -loglevel verbose \
-i $1 \
-map 0 \
-map_metadata 0 \
-map -0:d \
-map -0:s \
-map -0:t \
-ignore_unknown \
-c:a aac \
-vbr 5 \
-c:v libx264 \
-crf 0 \
-coder 1 \
-context 1 \
-g 1 \
-threads 8 \
-y \
-r 30000/1001 \
$2

The output of these scripts uses h.264 as the codec, but in lossless mode. This is so we can keep the quality as best we can for editing, but enables it to be loaded into most video editors without any complaints.

 

Original Format

Front Camera:

Format :MPEG-4

General

Format profile : Base Media / Version 2
Codec ID : mp42 (mp42/mp42)
File size : 188 MiB
Duration : 1 min 0 s
Overall bit rate mode : Variable
Overall bit rate : 25.9 Mb/s
Encoded date : UTC 2019-01-04 08:34:26
Tagged date : UTC 2019-01-04 08:34:26
IsTruncated : Yes

 

Video

ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L5.1
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 1 frame
Format settings, GOP : M=1, N=15
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 min 0 s
Source duration : 1 min 1 s
Bit rate : 25.2 Mb/s
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 30.000 FPS
Minimum frame rate : 27.778 FPS
Maximum frame rate : 32.258 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.101
Stream size : 183 MiB (97%)
Source stream size : 183 MiB (97%)
Language : English
Encoded date : UTC 2019-01-04 08:34:26
Tagged date : UTC 2019-01-04 08:34:26
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
mdhd_Duration : 60978
Codec configuration box : avcC

 

Audio

ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 1 min 0 s
Source duration : 1 min 0 s
Bit rate mode : Variable
Bit rate : 48.0 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 16.0 kHz
Frame rate : 15.625 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 350 KiB (0%)
Source stream size : 351 KiB (0%)
Language : English
Encoded date : UTC 2019-01-04 08:34:26
Tagged date : UTC 2019-01-04 08:34:26
mdhd_Duration : 60864

 

Rear Camera

General

Complete name : D:\original footage\20190104_183226_ER.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (mp42/mp42)
File size : 80.7 MiB
Duration : 1 min 0 s
Overall bit rate mode : Variable
Overall bit rate : 11.1 Mb/s
Encoded date : UTC 2019-01-04 08:34:27
Tagged date : UTC 2019-01-04 08:34:27
IsTruncated : Yes

 

Video

ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.2
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, RefFrames : 1 frame
Format settings, GOP : M=1, N=15
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 min 0 s
Source duration : 1 min 0 s
Bit rate : 10.5 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 29.970 (29970/1000) FPS
Minimum frame rate : 14.925 FPS
Maximum frame rate : 31.250 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.169
Stream size : 75.9 MiB (94%)
Source stream size : 76.0 MiB (94%)
Language : English
Encoded date : UTC 2019-01-04 08:34:27
Tagged date : UTC 2019-01-04 08:34:27
Color range : Full
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
mdhd_Duration : 60821
Codec configuration box : avcC

 

Audio

ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 1 min 0 s
Source duration : 1 min 0 s
Bit rate mode : Variable
Bit rate : 48.0 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 16.0 kHz
Frame rate : 15.625 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 349 KiB (0%)
Source stream size : 350 KiB (0%)
Language : English
Encoded date : UTC 2019-01-04 08:34:27
Tagged date : UTC 2019-01-04 08:34:27
mdhd_Duration : 60735

 

Remove text from front dashcam

 

 

ffmpeg -loglevel verbose -i test.mp4 -c:a aac -vbr 5 -c:v libx264 -crf 0 -coder 1 -context 1 -g 1 -threads 8 -vf 'crop=3726:2096:57:0,scale=3840:2160' -r 30000/1001 testout.mp4