Batch convert BVR to MP4

Yffud
Posts: 2
Joined: Sat Nov 06, 2021 5:44 am

Re: Batch convert BVR to MP4

Post by Yffud »

Thixotropic wrote: Sat Jan 01, 2022 3:37 pm I've attached a converter script I wrote a while ago that uses ffmpeg. I think this will do exactly what you want.


BVRConverter.zip


1) Read the README file.

2) Modify the source and target params at the top of the script and run it. It'll convert a directory full of .BVR clips to .MP4, with selectable scaling and resolution (quality). Please let me know if you have any trouble with it.

Note that you'll need to install ffmpeg (free) for it to work.
FFMPEG can be downloaded from here: https://www.ffmpeg.org/download.html

Cheers
I guess the attached file got deleted? Anyone have it to reupload
User avatar
Thixotropic
Posts: 743
Joined: Wed Sep 04, 2019 7:20 pm
Location: Low-Earth Orbit

Re: Batch convert BVR to MP4

Post by Thixotropic »

Yffud wrote: Wed Jul 19, 2023 5:38 pm I guess the attached file got deleted? Anyone have it to reupload
(File is attached below.)

General Info
BVR Converter converts Blue Iris .BVR files to .MP4 fideo files while preserving their original timestamp. It also typically reduces their size, in some cases dramatically. Converting to the MP4 format allows the files to be provided to others to view without having to install Blue Iris. It can process an entire directory, file by file, and optionally move the files to another directory for storage (such as a NAS, an external hard drive, thumb drive, etc).

This powershell script converts .BVR files to .MP4 files, preserving the original file's timestamp. Options include keeping the original size or scaling to 1/2, 1/3, or 1/4 of the original video size/resolution.

The only external component required is the free utility "ffmpeg", which may be found here:

https://www.ffmpeg.org/

and downloaded from here:

https://www.ffmpeg.org/download.html

It's recommended that you get the pre-compiled binary instead of the source code. Versions of ffmpeg are available for Windows, Linux, and Mac OS. The powershell script is intended to be run under Windows 8 or greater.

Install ffmpeg in a location that's in your computer's PATH variable so it can be run from anywhere, or install it somewhere else and add its location to your PATH variable. If you opt not to do either of these then you'll need to modify the bvr_converter.ps1 file so the full path to ffmpeg is referenced in the script.

-------------
Configuration
-------------

The "source" directory is where the .BVR files to be converted are found. DO NOT use a trailing slash (\).
For example: "C:\BlueIris\Stored"

The "target" directory is where the converted .MP4 files will stored. DO NOT use a trailing slash (\).
For example: "C:\backup_video"
You can set this to a different directory, a NAS, attached storage, or other remote location if you want.

The "pause" time is an optional time to wait between each file conversion. This may be useful to avoid overloading the PC that's doing the converting. The "pause" time value is set in seconds, and typically 1 or 2 seconds is plenty, but adjust as needed.
For example: $pause_time = 2

Command line settings for ffmpeg
There are several sample command line parameters for conversion. Don't change these if you don't know what you're doing.
Uncomment ONE and only ONE of the parameter lines. If you uncomment more than one, the last uncommented one will be used.
For the most reduction in file size, use one of the settings that scales the image.
--------------

If you find bugs or have enhancements to this script that you'd like to have added, please feel free to contact the user "Thixotropic" on the Blue Iris forum: https://blueirissoftware.com/forum/index.php

-----------------------------------------------------------------
README.TXT
These tests were run with an sinput file (input.bvr) file size of 6703K (6.7M) and with ffmpeg using the x264 codec (included).

The factors that influence the output file size the most are the codec, the output size (scaled or unscaled), and the CRF (Constant Rate Factor) parameter. In general, a higher CRF produces a smaller file. Note that a lower CRF *may* produce a larger file under some circumstances. For x264, sane values are between 18 and 28.

CRF can be used in a constrained/capped mode to prevent bitrate spikes.

0 <---- 18 <---- 23 ----> 28 ----> 51
(Lossless, better, worse, worst)

More information on CRF can be found here: https://slhck.info/video/2017/02/24/crf-guide.html


Standard compression with CRF of 30
ffmpeg -i input.bvr -vcodec libx264 -crf 30 output.mp4
Converted size: 4626K

Standard compression with CRF of 25
ffmpeg -i input.bvr -vcodec libx264 -crf 25 output.mp4
Converted size: 8037K

Compress and reduce size to 1/2, CRF of 30
ffmpeg -i input.bvr -vcodec libx264 -crf 30 -vf "scale=iw/2:ih/2" output.mp4
Converted size: 854K

Compress and reduce size to 1/2, CRF of 25
ffmpeg -i input.bvr -vcodec libx264 -crf 20 -vf "scale=iw/2:ih/2" output.mp4
Converted size: 3524K

ffmpeg -n -loglevel error -i input.bvr -vcodec libx264 -crf 28 -preset faster -tune film output.mp4
Converted size: 5379K

ffmpeg -n -loglevel error -i input.bvr -vcodec libx264 -crf 28 -preset faster -tune film -vf "scale=iw/2:ih/2" output.mp4
Converted size: 979K
Attachments
BVR_Converter.zip
(3.75 KiB) Downloaded 1311 times
Blue Iris 5.x x64 | Windows 10 Pro x64 | 16GB RAM | i7-7700 3.6 GHz | 1TB HDD | 2TB RAID NAS | 9 Cameras | Almost Dual NIC | 2KVA UPS
tmoran000
Posts: 10
Joined: Fri Feb 07, 2020 7:50 am

Re: Batch convert BVR to MP4

Post by tmoran000 »

Does anyone know if this script to batch convert is hardware accelerated? I have an RTX 3080 I am hoping to dump this work load onto.
mlutteral
Posts: 1
Joined: Thu May 06, 2021 2:36 pm

Re: Batch convert BVR to MP4

Post by mlutteral »

I use handbrake, is an open source that can read bvr (or any format for that matter) and convert it with several options. It can batch process a folder.
https://handbrake.fr/

cheers
Post Reply