Friday, September 8, 2023

How to import a virtual machine (in OVA format) into Proxmox server

  1.  Download the .ova file in the Proxmox server shell
  2. Then do the following:

$ mkdir ova_import

$ cd ova_import

$ tar -xvf ../<filename>.ova

$ sudo qm importovf 101 ./<filename>.ovf <disk> --format qcow2

$ sudo qm importdisk 101 ./<filename>.vmdk <disk> --format qcow2

Then use the Proxmox GUI to attach the disk to the VM, configure Network and you're done!

Wednesday, June 21, 2023

Merge dashcam video file segments into a large MP4 file

As most dashcams save videos in 2-5 minute segments, sometimes you need to stich them together to create a full-length video - e.g. road trip footage. 

To do this, the best solution is to use FFmpeg's concat function.

Step 1: Create a file containing the list of segment file names (in Windows Command Prompt)

(for %i in (*.mp4) do @echo file '%i') > mylist.txt

Step 2: Run ffmpeg to create the output file

ffmpeg -f concat -i mylist.txt -c copy output.mp4


Sunday, April 9, 2023

Force remove old drivers in Windows 11 for enabling Memory Integrity

 In Command Prompt with Administrator privilege, do the following:

pnputil /delete-driver oemXX.inf /uninstall /force


Saturday, April 8, 2023

A solution for Intel ProSet Adapter Configuration Utility no longer supported in Windows 11 for managing VLANs

So I finally bit the bullet yesterday and upgraded one of my Windows 10 machine to Windows 11. I figured a lot of Win11 bugs have been ironed out by now, so I decided to get on with it before Win10 support expires in 2025.

I am pretty impressed with the overall upgrade process; all my software and documents were left intact... except for one very big issue. My Hyper-V VMs were no longer working due to the VLAN configuration being hosed.

As it turns out, Intel pulled support for the ProSet utility for Windows 11, which is what I used to configure multiple VLANs on my NIC. So, the solution is to now use Windows PowerShell commands to manually establish VLAN interfaces you need, via the Hyper-V stack. Go ahead and install the Hyper-V host components.

What you are essentially doing is to create a Hyper-V VLAN switch and attach multiple VLAN adapters to it. In the example below, we'll name your VLAN switch "VLAN-vSwitch" and I will assume your NIC is named "Ethernet" (usually by default, or find it out with "Get-NetAdapter" command). And we'll create three VLANs with ID 101, 102, and 103.

In a Windows PowerShell running as Administrator, do the following:

New-VMSwitch -name VLAN-vSwitch -NetAdapterName Ethernet -AllowManagementOS $true

Remove-VMNetworkAdapter -ManagementOS -Name VLAN-vSwitch

Add-VMNetworkAdapter -ManagementOS -Name "VLAN101" -SwitchName "VLAN-vSwitch" -Passthru | Set-VMNetworkAdapterVlan -Access -VlanId 101

Add-VMNetworkAdapter -ManagementOS -Name "VLAN102" -SwitchName "VLAN-vSwitch" -Passthru | Set-VMNetworkAdapterVlan -Access -VlanId 102

Add-VMNetworkAdapter -ManagementOS -Name "VLAN103" -SwitchName "VLAN-vSwitch" -Passthru | Set-VMNetworkAdapterVlan -Access -VlanId 103

Running the Get-NetAdapter command again will now show you the VLAN adapters you created. Let me know if you have any questions!


Tuesday, December 28, 2021

Fix pi-hole disk keep getting full

Unfortunately, the default setting of pi-hole allows small pi-hole installations to fail due to disk getting full. The FTL database file /etc/pihole/pihole-FTL.db captures logging for 365 days by default, and it can grow to multi-gigabytes within that period.

First, stop the service:

sudo service pihole-FTL stop

If your disk is already full, first delete the pihole-FTL.db file by doing:

sudo rm /etc/pihole-FTL.db

Then edit maxDBdays configuration in your /etc/pihole/pihole.toml file as follows:

  1. sudo vi /etc/pihole/pihole.toml
  2. Fine the line maxDBdays = xxx and change xxx to 30 (or something smaller from the default 91)
  3. :wq command to save and quit vi
And start the service:

sudo service pihole-FTL start

That should allow your pi-hole installation to operate for a long time. FYI I see about 300MB pihole-FTL.db size after 30 days in my home network.

Tuesday, February 11, 2020

Windows batch processing of file names in a text file

The following script loops through copy.txt file's content (1 file name per line), then copies each file to D:\tmp\:

@echo off
for /F %%a in (copy.txt) do copy "%%a" D:\tmp\


Windows FFMPEG Script to transcode video files from H.264/MPEG-4 to H.265/HEVC, using NVENC hardware acceleration on NVIDIA GPU


I  recently put some effort into converting all my H.264 video files into H.265 format, and this is the best setting I found. On a RTX 2070 Super, I get about 250+ fps, on average; a feature length film in 1080p takes about 6 minutes to convert.

@echo off
for %%a in ("*.mkv") do ffmpeg.exe -vsync 0 -hwaccel cuda -i "%%a" -c:v hevc_nvenc -preset llhq -rc vbr_hq -cq 21 -c:s copy -acodec copy "D:\tmp\H.265\%%~na.mkv"
for %%a in ("*.m4v") do ffmpeg.exe -vsync 0 -hwaccel cuda -i "%%a" -c:v hevc_nvenc -preset llhq -rc vbr_hq -cq 21 -c:s copy -acodec copy "D:\tmp\H.265\%%~na.mp4"
for %%a in ("*.mp4") do ffmpeg.exe -vsync 0 -hwaccel cuda -i "%%a" -c:v hevc_nvenc -preset llhq -rc vbr_hq -cq 21 -c:s copy -acodec copy "D:\tmp\H.265\%%~na.mp4"
for %%a in ("*.avi") do ffmpeg.exe -vsync 0 -hwaccel cuda -i "%%a" -c:v hevc_nvenc -preset llhq -rc vbr_hq -cq 21 -c:s copy -acodec copy "D:\tmp\H.265\%%~na.mp4"

The key is using the "-hwaccel cuda" option, which keeps the output of NVDEC decoder output on the GPU's framebuffer for NVENC encoder to work on. This way your CPU utilization is kept low and keep GPU's encoder at 100%.