Wednesday, February 26, 2014

Test Encode: Vandelay

Vandelay (fictional name) is a TV sitcom that ran for nine years.  Since my USB-equipped DVD player only plays xvid + mp3 in avi videos (burned as data dvd), the files (in mkv format) will have to be converted.  The episodes are organized by season, as shown below:




Burning just 5 episodes on DVD5 is wasteful (as with Season 1) and is not an option.  It is worth noting that not all episodes are of equal duration and that some files are actually two episodes merged into one.  In this case, Vandelay has a total of 180 episodes in 171 files.

Clicking "Select folder" ('step 2' of En Masse's main form) reveals that the Vandelay folder contains 171 files with a total duration of 67h 17m 19s.  Clicking 'Duration/x' reveals that opting for 6 discs would yield a video bitrate of 765 kbits/s, an audio bitrate of 128 kbits/s, and a maximum duration of 11h 25m 25s on DVD5.



After deciding to go with 6 discs, I then set out to re-organize the Vandelay folder.  I created six folders, and in conjunction with 'GetTotalDuration.exe', placed the maximum amount of files in each folder that would yield a total duration not exceeding 11h 25m 25s.



 

As shown above, episodes 1-31 (Disc 1) yields a total duration of 11h 20m 30s.

I then created a new preset with bitrate settings as suggested by 'Duration/x' (765 + 128 kbits/s), and went through steps 1-4 (select preset, select folder, generate, convert).

After ffmpeg processed the files for 40h 30m 24s (real files were used, btw), I ended up with the following:


Download En Masse:




Thursday, February 13, 2014

Previewing ffmpeg filters

This blog has been moved. Please click here: http://vidprokenmasse.blogspot.com/2014/07/vidprokenmasse.html

VidProk (formerly named 'One To One') lets you preview ffmpeg filters (no more test encodes, yey!).  Additionally, it includes a VF cheat sheet which lets you conveniently copy/paste filters.



Some of the video filters include: add noise, color curves, deinterlace, denoise (hqdn3d), deshake, draw box, draw grid, fade in, flip horizontal, flip vertical, gamma, geq - emboss, grayscale, histogram, hue and saturation, mplayer: gamma, brightness, contrast (experimental), negate, pp - deblocking, deringing, auto brightness & contrast, sepia, smartblur, unsharp, vignette, and YUV420P.

The VF cheat sheet is by no means a substitute for ffmpeg's documentation --- so, if the default values do not satisfy you, read the ffmpeg manual.


 Here are some screen shots...

'play both (horizontal)':

filters used: gamma, curves, saturation, unsharp, denoise, deblock, yuv420p
 'play both (vertical)':

And finally, 'play both @ pos 0x0':  Both source and processed windows are placed on the top left corner (one window obscures the other).  Clicking 'toggle' alternates between the source and processed windows.  This lets you easily see the differences, especially small differences, between the processed and the source windows.


I know that ffmpeg is a no-joy in the instant gratification department (the somewhat cryptic documentation also doesn't help), but I hope you'll like using this tool.

Youtube demo: http://youtu.be/zgXiGfZlTVo

VidProk is included in 'En Masse ~ batch processor for videos', it is absolutely free, and you can download it here: En Masse ~ batch processor for videos

Friday, February 7, 2014

Batch denoising JPEG files with ffmpeg

I love PhotoScape! If your photoshop skills are not up to par, then you will like this program too. Its 'film effect' filters are amazing, but what I really like about this program is its Noise Reduction (clear skin) feature - your woman will love you for using it, especially on close-ups (less visible blemishes/pores/lines). However, this functionality is not available in batch editor mode (last time I checked). *sigh*

Fortunately, ffmpeg offers the next best thing, and it's called High Quality 3D Denoise.

Just create an empty text file, rename it to, like, "Denoise_JPEG_files_in_this_folder.bat", copy/paste the code below, set the appropriate ffmpeg path, tweak to taste, copy/paste the batch file into a folder full of jpeg files, and you're ready to go!

BTW, set the value for "AdditionalVideoFilters" to blank if you don't want the set filter.


<code starts after this line>

@echo off

: _______________________________________________

: This batch file will apply ffmpeg's High Quality 3D Denoise filter on all found image files in the current folder (subfolders included) and open the output folder. Don't forget to set ffmpeg's full path.

: _______________________________________________


: enter required/desired settings

: set ffmpeg path (required). use double quotes.
set ffmpeg="C:\~ En Masse\third party bin\ffmpeg-20131222-git-9b195dd-win32-static\bin\ffmpeg.exe"

: set LumaSpatial. practical range for a 640x480 image is 4-12. no quotes.
set LumaSpatial=12

: set image file types to search/process. note that all files will be converted to the set outputfile extension. no quotes.
set FileTypes=*.jpg, *.jpeg, *.bmp, *.png, *.tif, *.tiff

: output folder (subfolder). no quotes/spaces.
set OutputFolder=~Denoised

: output file name suffix. no quotes.
set Suffix=_Denoised

: output file extension (jpg, png, bmp, etc). no quotes.
set OutputExtension=jpg

: additional video filter (optional). this is for demonstration purposes only. precede each filter with a comma ','. you can set the value to blank if you don't want this feature. no double quotes at both ends.
set AdditionalVideoFilters=, curves=master='0.05/0.045 0.06/0.06 0.5/0.6'

: _______________________________________________

title %~n0

: create the output folder
md %OutputFolder%

: open the created output folder
start explorer.exe %OutputFolder%

: search and process
FOR /F "delims=" %%A IN ('dir /a:-d /b /o:n /s %FileTypes%') DO (
echo %%A
%ffmpeg% -threads 1 -y -f image2 -i "%%A" -f image2 -qscale:v 1 -vf "hqdn3d=luma_spatial=%LumaSpatial%: chroma_spatial=1: luma_tmp=1: chroma_tmp=1 %AdditionalVideoFilters%" "%OutputFolder%\%%~nA%Suffix%.%OutputExtension%"
)

exit




En Masse ~ batch processor for videos

This blog has been moved. Please click here: http://vidprokenmasse.blogspot.com/2014/07/vidprokenmasse.html



En Masse is an ffmpeg front-end designed specifically for processing a lot of videos (last tested on 1849 files). Operation can be summarized in four steps: Select preset, select folder, generate batch file, and convert. While it does not come with device-specific presets, the default presets serve as a sort of walk-through for what En Masse can do. The generated batch file provides several lines to facilitate resumption of an interrupted batch file (skip to file number x), some logging capability (elapsed time, render speed, rendered file size, possible failed encode, etc.), and another line which you can modify to launch another batch file. The idea behind En Masse is to provide carefree batch video processing for the total noob, and a convenient ffmpeg interface for the initiated.


The Preset Manager






While it maybe odd to see four combo boxes for output width, a quick look at the qf column (blue text beside the width combo boxes) may make some sense to some users. This, of course, can be bypassed by setting all four combo boxes to a single number (or set to blanks). The option to maintain a uniform qf (varying output widths) is available, if you want it. Do also note that the preset manager lacks a height combo box to spare you the chore of calculating output height when resizing. As far as square pixel rendering and small integers can go, you can rest assured that the source video's aspect ratio will be preserved whether it is square pixel or anamorphic. Also included is a text box for additional ffmpeg parameters (Post-vf ffmpeg args) and two text boxes created exclusively for video filters (vf args 1 & 3).

VidProk.exe (formerly named OneToOne.exe)


Sometimes, En Masse's GUI is a bit cumbersome if you just want to process several videos. VidProk will happily take on this task. While intentionally similar to En Masse's 'Preset Manager', VidProk is armed with a 'see command' button (which ultimately provides some batch processing capability), a 'play' button, and a 'vf cheat sheet' button.

Play both @ pos 0x0: A unique feature of VidProk that places both source and processed windows on the top left corner of the screen (one window obscures the other).  This play mode works in conjunction with the 'toggle' button which let's you alternate the top-most window (either source or processed). This let's you easily see the differences (particularly minute differences) between the unprocessed (source) and the processed (with filters e.g. unsharp, denoise, etc).


VF cheat sheet


























Select a filter, click 'copy', then paste to either 'vf args 1' or 'vf args 3'. 'vf args 1' should only be used if the filter needs to precede crop/scale filters (e.g. deinterlace). Separate each filter with a comma.  After copy/pasting, click 'play' to preview.


Other Tools




















Apart from their intended use, En Masse and VidProk are excellent learning tools for new ffmpeg users as both would readily reveal the ffmpeg (or ffplay) commands used.


En Masse is a home-brew solution created by a frustrated end-user for other end-users. En Masse does not write to the registry, does not automatically 'phone home' for updates, does not nag, does not coerce your browser to a new home page/search engine or to install a new toolbar, and does not require you to join a cult.  En Masse is absolutely free, though small donations are very much welcome.  Email me: chiqboy<[at]>gmail<[dot]>com


Youtube video:
Download link (last updated 2014.06.06):


New features for EnMasse_20140528:

1. En Masse can now burn-in subtitles (batch mode).
2. Dropped MediaInfo in favor of ffprobe.  En Masse is now an all-ffmpeg solution.
3. New policy for En Masse & VidProk: For anamorphic sources, maintain anamorphic dimensions if not resized (width set to blank).
4. Two-pass encoding (En Masse & VidProk).
5. VidProk encoding is now logged like En Masse (shows elapsed time, rendered file size, etc.).
6. Numerous tweaks.
7. Updated to ffmpeg-20140502-git-0f9f24c-win32-static.