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%.

Sunday, April 8, 2018

Plex playback error

Recently I started experiencing Plex playback issues on my XBox One. As it turned out, I inadvertently (ignorantly) changed the Plex App’s Video => Maximum H.264 Level setting to 5.1.

FYI, the Plex app on XBox One only supports H.264 Level 4.0 and below, as documented here:

https://support.plex.tv/articles/203810286-what-media-formats-are-supported/

After I changed the setting to 4.0, all my videos encoded at >4.0 started playing again, my Plex server transcoding them in real time!

Monday, June 12, 2017

Random thought of the day

It occurred to me today, that being (financially) rich means having assets that generate income to sustain your livelihood. Being poor is having to perform other activities in lieu of having those assets. So, one’s financial goal in life shouldn’t be simply making more money every year, but rather acquiring income generating assets over time to become self-sustaining. In other words, don’t buy things unless they are going to generate income!

Monday, March 30, 2015

How to Cut and Paste files in OS X Finder


  1. Command-C to place files/folders in Clipboard for copying
  2. Command-Option-V to move those files/folders in Clipboard


Sunday, October 12, 2014

Getting plot to work in Octave OS X installation

I am new to Octave, and when I attempted to plot something using the plot() function, I was getting this error:

gnuplot> set terminal aqua enhanced title "Figure 1"  font "*,6" dashlength 1
                      ^

         line 0: unknown or ambiguous terminal type; type just 'set terminal' for a list

After some Google search and experimentation, here's the solution I found to work. You need to edit "octaverc" file in the following path:


sudo vi /usr/local/octave/3.8.0/share/octave/site/m/startup/octaverc 

(FYI, I have the version 3.8.0 above, so yours may be installed in a different folder.)

In that file, add this line at the end:


setenv("GNUTERM","qt")

Save the file, and that GNUTERM environment variable will be set every time you run octave. This works for OS X Maverick.

Others have also reported the following to work (instead):

setenv("GNUTERM","X11")

I suspect that works for folks who installed XQuartz, which is an X11 implementation for OS X that is no longer included in more recent versions of OS X.

Roy