Monday, July 14, 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 file.  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 VidProkEnMasse:

VidProk: Preview ffmpeg filters

VidProk 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, but I hope you'll like using this tool.

Youtube demo:

VidProk is included in 'VidProkEnMasse', it is absolutely free, and you can download it here:


VstatsReader is a simple CLI app which reads ffmpeg-generated video statistics logs (vstats_*.log) and retrieves information like peak q, peak bitrate, etc.  It generates an ini file which will be located in the same folder as the vstats log file (same file name with an 'ini' extension).

Here's a sample of a generated ini file:


VstatsLogFile=D:\SEKI APPS\Work-In-Progress\VstatsReader\sample.log





start=2014/07/10 19:50:59
end=2014/07/10 19:51:13
elapsed=0h 0m 14s

; bitrates are in 'kbits/s'.

Q stands for quantizer.  "ApproximatePositionOfPeakBitrateAlongTimeline" (yeah, I know it's a mouthful) shows a number which you can use to compute when or where along the timeline of the video the peak bitrate occurred.  If this value is 0.5 and video duration is 2 hours, then the peak occurred at 3600 seconds or at 1 hour, 0 minutes and 0 seconds.  This is, of course, just an approximate.  The reason why I elected to use a number (instead of time/PTS) is that vstats logs seem to show erroneous data when "-f rawvideo NUL" was used (even average bitrate seems to be off).

1.  In Windows Explorer, you can drag & drop a vstats log file onto the file "VstatsReader.exe".
2.  In a batch file:

@echo off

set vstatsreader="C:\VstatsReader\VstatsReader.exe"
set vstatslogfile="E:\Video Processing\Output\Logs\Debbie went to Dallas (2014).log"

%vstatsreader% %vstatslogfile%

Here's an example of an ffmpeg command that will generate a vstats log file:

%ffmpeg% -i "E:\MOVIES\Tiktik - The Aswang Chronicles (2012) [Tagalog].mp4" -vf "scale=640:360, setsar=1, format=pix_fmts=yuv420p" -vtag xvid -g 300 -qscale:v 4 -vstats -vstats_file "E:\~ VidProkEnMasse\OUTPUT\Logs\Tiktik - The Aswang Chronicles (2012) [Tagalog]_FMP4_vstats.log" -c:v mpeg4 -r 29.97 -c:a libmp3lame -b:a 96k -ar 48000 -ac 2 "E:\~ VidProkEnMasse\OUTPUT\Tiktik - The Aswang Chronicles (2012) [Tagalog]_FMP4.avi"

Other files included:
'sample.log' - you can drop this file onto the file 'VstatsReader.exe' to test.
'VstatsReader.au3' - source code (AutoIt).


HIMYM total duration

An acquaintance's hard drive reveals that...

Files: 204.  Total duration: 74h 28m 15s.  Average file duration: 0h 21m 55s.

0001-001-001-HIMYM-Pilot.mp4  (0h 22m 4s)
0002-001-002-HIMYM-PurpleGiraffe.mp4  (0h 22m 1s)
0003-001-003-HIMYM-SweetTasteOfLiberty.mp4  (0h 21m 21s)
0004-001-004-HIMYM-ReturnOfTheShirt.mp4  (0h 22m 2s)
0005-001-005-HIMYM-OkayAwsome.mp4  (0h 22m 1s)
0006-001-006-HIMYM-SluttyPumpkin.mp4  (0h 22m 6s)
0007-001-007-HIMYM-Matchmaker.mp4  (0h 21m 56s)
0008-001-008-HIMYM-TheDuel.mp4  (0h 22m 2s)
0009-001-009-HIMYM-BettyFullOfTurkey.mp4  (0h 22m 4s)
0010-001-010-HIMYM-ThePineappleIncident.mp4  (0h 22m 6s)
0011-001-011-HIMYM-TheLimo.mp4  (0h 22m 6s)
0012-001-012-HIMYM-TheWedding.mp4  (0h 21m 47s)
0013-001-013-HIMYM-DrumrollPlease.mp4  (0h 22m 4s)
0014-001-014-HIMYM-ZipZipZip.mp4  (0h 22m 2s)
0015-001-015-HIMYM-GameNight.mp4  (0h 21m 56s)
0016-001-016-HIMYM-Cupcake.mp4  (0h 21m 57s)
0017-001-017-HIMYM-LifeAmongTheGorillas.mp4  (0h 22m 4s)
0018-001-018-HIMYM-NothingGoodHappensAfter2am.mp4  (0h 21m 42s)
0019-001-019-HIMYM-MaryTheParalegal.mp4  (0h 22m 4s)
0020-001-020-HIMYM-BestPornEver.mp4  (0h 21m 29s)
0021-001-021-HIMYM-Milk.mp4  (0h 21m 50s)
0022-001-022-HIMYM-ComeOn.mp4  (0h 21m 59s)
0023-002-001-HIMYM-WhereWereWe.mp4  (0h 21m 21s)
0024-002-002-HIMYM-TheScorpionAndTheToad.mp4  (0h 22m 6s)
0025-002-003-HIMYM-Brunch.mp4  (0h 21m 43s)
0026-002-004-HIMYM-TedMosby-Architect.mp4  (0h 22m 5s)
0027-002-005-HIMYM-WorldsGreatestCouple.mp4  (0h 22m 4s)
0028-002-006-HIMYM-AldrinJustice.mp4  (0h 22m 4s)
0029-002-007-HIMYM-Swarley.mp4  (0h 22m 1s)
0030-002-008-HIMYM-AtlanticCity.mp4  (0h 22m 4s)
0031-002-009-HIMYM-SlapBet.mp4  (0h 22m 4s)
0032-002-010-HIMYM-SingleStamina.mp4  (0h 22m 5s)
0033-002-011-HIMYM-HowLilyStoleChristmas.mp4  (0h 21m 56s)
0034-002-012-HIMYM-FirstTimeInNewYork.mp4  (0h 21m 46s)
0035-002-013-HIMYM-Columns.mp4  (0h 22m 3s)
0036-002-014-HIMYM-MondayNightFootball.mp4  (0h 21m 31s)
0037-002-015-HIMYM-LuckyPenny.mp4  (0h 21m 34s)
0038-002-016-HIMYM-Stuff.mp4  (0h 22m 0s)
0039-002-017-HIMYM-ArriverderciFiero.mp4  (0h 21m 50s)
0040-002-018-HIMYM-MovingDay.mp4  (0h 22m 3s)
0041-002-019-HIMYM-BachelorParty.mp4  (0h 22m 2s)
0042-002-020-HIMYM-Showdown.mp4  (0h 22m 4s)
0043-002-021-HIMYM-SomethingBorrowed.mp4  (0h 21m 59s)
0044-002-022-HIMYM-SomethingBlue.mp4  (0h 22m 4s)
0045-003-001-HIMYM-WaitForIt.mp4  (0h 20m 53s)
0046-003-002-HIMYM-WereNotFromHere.mp4  (0h 21m 10s)
0047-003-003-HIMYM-ThirdWheel.mp4  (0h 21m 44s)
0048-003-004-HIMYM-LittleBoys.mp4  (0h 21m 37s)
0049-003-005-HIMYM-HowIMetEveryoneElse.mp4  (0h 21m 47s)
0050-003-006-HIMYM-ImNotThatGuy.mp4  (0h 21m 45s)
0051-003-007-HIMYM-Dowisetrepla.mp4  (0h 21m 5s)
0052-003-008-HIMYM-SpoilerAlert.mp4  (0h 21m 5s)
0053-003-009-HIMYM-Slapsgiving.mp4  (0h 21m 38s)
0054-003-010-HIMYM-TheYips.mp4  (0h 21m 46s)
0055-003-011-HIMYM-ThePlatinumRule.mp4  (0h 21m 26s)
0056-003-012-HIMYM-NoTomorrow.mp4  (0h 21m 19s)
0057-003-013-HIMYM-TenSessions.mp4  (0h 21m 48s)
0058-003-014-HIMYM-TheBracket.mp4  (0h 20m 39s)
0059-003-015-HIMYM-TheChangeOfScreaming.mp4  (0h 21m 39s)
0060-003-016-HIMYM-SandcastlesInTheSand.mp4  (0h 21m 44s)
0061-003-017-HIMYM-TheGoat.mp4  (0h 21m 46s)
0062-003-018-HIMYM-ReboundBro.mp4  (0h 21m 31s)
0063-003-019-HIMYM-EverythingMustGo.mp4  (0h 20m 59s)
0064-003-020-HIMYM-Miracles.mp4  (0h 21m 46s)
0065-004-001-HIMYM-DoIKnowYou.mp4  (0h 21m 54s)
0066-004-002-HIMYM-TheBestBurgerInNewYork.mp4  (0h 21m 36s)
0067-004-003-HIMYM-IHeartNJ.mp4  (0h 21m 37s)
0068-004-004-HIMYM-Intervention.mp4  (0h 21m 37s)
0069-004-005-HIMYM-ShelterIsland.mp4  (0h 21m 38s)
0070-004-006-HIMYM-HappilyEverAfter.mp4  (0h 20m 34s)
0071-004-007-HIMYM-NotAFathersDay.mp4  (0h 21m 37s)
0072-004-008-HIMYM-Woooo.mp4  (0h 21m 39s)
0073-004-009-HIMYM-TheNakedMan.mp4  (0h 21m 27s)
0074-004-010-HIMYM-TheFight.mp4  (0h 21m 7s)
0075-004-011-HIMYM-LittleMinnesota.mp4  (0h 21m 26s)
0076-004-012-HIMYM-Benefits.mp4  (0h 21m 28s)
0077-004-013-HIMYM-ThreeDaysOfSnow.mp4  (0h 21m 37s)
0078-004-014-HIMYM-ThePossimple.mp4  (0h 21m 13s)
0079-004-015-HIMYM-TheStinsons.mp4  (0h 21m 36s)
0080-004-016-HIMYM-SorryBro.mp4  (0h 21m 32s)
0081-004-017-HIMYM-TheFrontPorch.mp4  (0h 21m 32s)
0082-004-018-HIMYM-OldKingClancy.mp4  (0h 21m 20s)
0083-004-019-HIMYM-Murtaugh.mp4  (0h 21m 30s)
0084-004-020-HIMYM-MosbiusDesigns.mp4  (0h 21m 40s)
0085-004-021-HIMYM-TheThreeDaysRule.mp4  (0h 21m 37s)
0086-004-022-HIMYM-RightPlaceRightTime.mp4  (0h 21m 15s)
0087-004-023-HIMYM-AsFastAsSheCan.mp4  (0h 21m 39s)
0088-004-024-HIMYM-TheLeap.mp4  (0h 21m 38s)
0089-005-001-HIMYM-Definitions.mp4  (0h 21m 33s)
0090-005-002-HIMYM-DoubleDate.mp4  (0h 21m 39s)
0091-005-003-HIMYM-Robin101.mp4  (0h 21m 38s)
0092-005-004-HIMYM-TheSexlessInnkeeper.mp4  (0h 21m 24s)
0093-005-005-HIMYM-DuelCitizenship.mp4  (0h 21m 37s)
0094-005-006-HIMYM-Bagpipes.mp4  (0h 21m 23s)
0095-005-007-HIMYM-TheRoughPatch.mp4  (0h 21m 38s)
0096-005-008-HIMYM-ThePlaybook.mp4  (0h 21m 24s)
0097-005-009-HIMYM-Slapsgiving2-RevengeOfTheSlap.mp4  (0h 21m 35s)
0098-005-010-HIMYM-TheWindow.mp4  (0h 21m 38s)
0099-005-011-HIMYM-LastCigaretteEver.mp4  (0h 21m 28s)
0100-005-012-HIMYM-GirlsVersusSuits.mp4  (0h 21m 38s)
0101-005-013-HIMYM-Jenkins.mp4  (0h 21m 36s)
0102-005-014-HIMYM-PerfectWeek.mp4  (0h 21m 38s)
0103-005-015-HIMYM-RabbitOrDuck.mp4  (0h 21m 25s)
0104-005-016-HIMYM-Hooked.mp4  (0h 21m 37s)
0105-005-017-HIMYM-OfCourse.mp4  (0h 21m 33s)
0106-005-018-HIMYM-SayCheese.mp4  (0h 21m 38s)
0107-005-019-HIMYM-ZooOrFalse.mp4  (0h 21m 36s)
0108-005-020-HIMYM-HomeWreckers.mp4  (0h 21m 35s)
0109-005-021-HIMYM-TwinBeds.mp4  (0h 21m 38s)
0110-005-022-HIMYM-RobotsVersusWrestlers.mp4  (0h 21m 38s)
0111-005-023-HIMYM-TheWeddingBride.mp4  (0h 21m 1s)
0112-005-024-HIMYM-Doppelgangers.mp4  (0h 21m 37s)
0113-006-001-HIMYM-BigDays.mp4  (0h 21m 6s)
0114-006-002-HIMYM-CleaningHouse.mp4  (0h 21m 8s)
0115-006-003-HIMYM-Unfinished.mp4  (0h 21m 7s)
0116-006-004-HIMYM-SubwayWars.mp4  (0h 21m 7s)
0117-006-005-HIMYM-ArchitectOfDestruction.mp4  (0h 21m 6s)
0118-006-006-HIMYM-BabyTalk.mp4  (0h 20m 59s)
0119-006-007-HIMYM-CanningRandy.mp4  (0h 21m 7s)
0120-006-008-HIMYM-NaturalHistory.mp4  (0h 21m 6s)
0121-006-009-HIMYM-Glitter.mp4  (0h 20m 56s)
0122-006-010-HIMYM-Blitzgiving.mp4  (0h 21m 4s)
0123-006-011-HIMYM-TheMermaidTheory.mp4  (0h 21m 4s)
0124-006-012-HIMYM-FalsePositive.mp4  (0h 20m 39s)
0125-006-013-HIMYM-BadNews.mp4  (0h 21m 9s)
0126-006-014-HIMYM-LastWords.mp4  (0h 21m 6s)
0127-006-015-HIMYM-OhHoney.mp4  (0h 21m 1s)
0128-006-016-HIMYM-DesperateDay.mp4  (0h 21m 8s)
0129-006-017-HIMYM-GarbageIsland.mp4  (0h 21m 9s)
0130-006-018-HIMYM-AChangeOfHeart.mp4  (0h 20m 43s)
0131-006-019-HIMYM-Legendaddy.mp4  (0h 21m 11s)
0132-006-020-HIMYM-TheExplodingMeatballSub.mp4  (0h 21m 27s)
0133-006-021-HIMYM-Hopeless.mp4  (0h 21m 29s)
0134-006-022-HIMYM-ThePerfectCocktail.mp4  (0h 21m 27s)
0135-006-023-HIMYM-Landmarks.mp4  (0h 21m 8s)
0136-006-024-HIMYM-ChallangeAccepted.mp4  (0h 21m 23s)
0137-007-001-HIMYM-TheBestMan.mp4  (0h 21m 31s)
0138-007-002-HIMYM-TheNakedTruth.mp4  (0h 21m 31s)
0139-007-003-HIMYM-DuckyTie.mp4  (0h 21m 15s)
0140-007-004-HIMYM-TheStinsonMissileCrisis.mp4  (0h 21m 9s)
0141-007-005-HIMYM-ImWatchingIt.mp4  (0h 20m 59s)
0142-007-006-HIMYM-MysteryVsHistory.mp4  (0h 21m 8s)
0143-007-007-HIMYM-Noretta.mp4  (0h 21m 5s)
0144-007-008-HIMYM-TheSluttyPumpkinReturns.mp4  (0h 21m 9s)
0145-007-009-HIMYM-DisasterAverted.mp4  (0h 21m 1s)
0146-007-010-HIMYM-TickTickTick.mp4  (0h 21m 36s)
0147-007-011-HIMYM-TheReboundGirl.mp4  (0h 21m 15s)
0148-007-012-HIMYM-SymphonyOfIllumination.mp4  (0h 21m 36s)
0149-007-013-HIMYM-Tailgate.mp4  (0h 21m 9s)
0150-007-014-HIMYM-46Minutes.mp4  (0h 21m 0s)
0151-007-015-HIMYM-TheBurningBeekeeper.mp4  (0h 20m 2s)
0152-007-016-HIMYM-TheDrunkTrain.mp4  (0h 21m 38s)
0153-007-017-HIMYM-NoPressure.mp4  (0h 21m 36s)
0154-007-018-HIMYM-Karma.mp4  (0h 21m 9s)
0155-007-019-HIMYM-TheBroath.mp4  (0h 21m 37s)
0156-007-020-HIMYM-TrilogyTime.mp4  (0h 21m 28s)
0157-007-021-HIMYM-NowWereEven.mp4  (0h 21m 35s)
0158-007-022-HIMYM-GoodCrazy.mp4  (0h 21m 8s)
0159-007-023-HIMYM-TheMagiciansCode[x2].mp4  (0h 43m 26s)
0161-008-001-HIMYM-Farhampton.mp4  (0h 21m 39s)
0162-008-002-HIMYM-ThePre-Nup.mp4  (0h 21m 39s)
0163-008-003-HIMYM-Nannies.mp4  (0h 21m 41s)
0164-008-004-HIMYM-WhoWantsToBeAGodparent.mp4  (0h 21m 37s)
0165-008-005-HIMYM-TheAutumnOfBreak-Ups.mp4  (0h 21m 14s)
0166-008-006-HIMYM-Splitsville.mp4  (0h 21m 8s)
0167-008-007-HIMYM-TheStampTramp.mp4  (0h 21m 7s)
0168-008-008-HIMYM-TwelveHornyWomen.mp4  (0h 21m 36s)
0169-008-009-HIMYM-LobsterCrawl.mp4  (0h 21m 39s)
0170-008-010-HIMYM-TheOver-Correction.mp4  (0h 21m 9s)
0171-008-011-HIMYM-TheFinalPage[x2].mp4  (0h 42m 39s)
0173-008-013-HIMYM-BandOrDJ.mp4  (0h 20m 25s)
0174-008-014-HIMYM-RingUp.mp4  (0h 21m 43s)
0175-008-015-HIMYM-PS-ILoveYou.mp4  (0h 21m 40s)
0176-008-016-HIMYM-BadCrazy.mp4  (0h 21m 41s)
0177-008-017-HIMYM-TheAshtray.mp4  (0h 21m 41s)
0178-008-018-HIMYM-WeekendAtBarneys.mp4  (0h 21m 35s)
0179-008-019-HIMYM-TheFortress.mp4  (0h 21m 40s)
0180-008-020-HIMYM-TheTimeTravelers.mp4  (0h 21m 35s)
0181-008-021-HIMYM-RomewardBound.mp4  (0h 20m 57s)
0182-008-022-HIMYM-TheBroMitzvah.mp4  (0h 21m 39s)
0183-008-023-HIMYM-SomethingOld.mp4  (0h 21m 7s)
0184-008-024-HIMYM-SomethingNew.mp4  (0h 21m 39s)
0185-009-001-HIMYM-TheLocket-ComingBack[x2].mp4  (0h 41m 33s)
0187-009-003-HIMYM-LastTimeInNewYork.mp4  (0h 21m 4s)
0188-009-004-HIMYM-TheBrokenCode.mp4  (0h 21m 2s)
0189-009-005-HIMYM-ThePokerGame.mp4  (0h 21m 32s)
0190-009-006-HIMYM-KnightVision.mp4  (0h 21m 30s)
0191-009-007-HIMYM-NoQuestionsAsked.mp4  (0h 21m 8s)
0192-009-008-HIMYM-TheLightHouse.mp4  (0h 21m 2s)
0193-009-009-HIMYM-Platonish.mp4  (0h 21m 2s)
0194-009-010-HIMYM-MomAndDad.mp4  (0h 21m 38s)
0195-009-011-HIMYM-BedtimeStories.mp4  (0h 21m 25s)
0196-009-012-HIMYM-TheRehearsalDinner.mp4  (0h 20m 16s)
0197-009-013-HIMYM-BassPlayerWanted.mp4  (0h 20m 54s)
0198-009-014-HIMYM-Slapsgiving3-SlappointmentInSlapmarra.mp4  (0h 21m 29s)
0199-009-015-HIMYM-Unpause.mp4  (0h 20m 59s)
0200-009-016-HIMYM-HowYourMotherMetMe.mp4  (0h 22m 4s)
0201-009-017-HIMYM-Sunrise.mp4  (0h 21m 30s)
0202-009-018-HIMYM-Rally.mp4  (0h 20m 52s)
0203-009-019-HIMYM-Vesuvius.mp4  (0h 21m 28s)
0204-009-020-HIMYM-Daisy.mp4  (0h 21m 26s)
0205-009-021-HIMYM-GaryBlauman.mp4  (0h 21m 28s)
0206-009-022-HIMYM-TheEndOfTheAisle.mp4  (0h 21m 37s)
0208-009-024-HIMYM-LastForeverPart1-2[x2].mp4  (0h 43m 37s)

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


A desperate method to burn-in subtitles

While the method may seem 'desperate', this may also prove to be the easiest way to burn-in subtitles (*.srt).  It seems to me that any thread on any forum about burning in subs with ffmpeg appears to be silent.  The lack of eureka's and heartfelt thank-you's only confirms one's suspicion that the thread topic is unresolved.  In weary resignation, I have concluded that: "It's just me... and everyone else can do it."

Reading up on the somewhat cryptic ffmpeg documentation, I learned that the drawtext filter may probably be only good for PTS, timecode, and single-line text.  The proverbial lightbulb somehow flickered when I came upon the sendcmd filter.  Hmmm...  I imagined hearing the sound of rusty gears slowly turning in my head.  The quietest most hesitant 'eureka' in the history of mankind may have escaped my lips.  Uhh no, I didn't actually say 'eureka', because I'm Filipino, and we don't talk like that, but you get my drift.

After some quick tests, the verdict was out:  All one has to do is create a sendcmd file (*.txt) containing all the drawtext commands telling ffmpeg what text to draw and when to draw it.  It's quite simple really!

The idea is to change this:
00:00:19,420 --> 00:00:23,090

into this:
00:00:19.420-00:00:23.090 [enter] drawtext reinit text='A SERBIAN FILM', [leave] drawtext reinit text='';

With less than 300 lines of code (AutoIt), I have managed to convert an *.srt file into a text file that could boss around ffmpeg.

This is my eureka moment I want to share with anyone who has lost a good amount of hair trying to figure out how to burn-in those d*mn subtitles.

This tiny app (absolutely free) for Windows is about 641 kb (includes the CLI executable, a GUI, and source code) and you can download it here:

updated: 2014.05.26

An easier-to-use version that works in conjunction with VidProk (included in 'VidProkEnMasse' which is also absolutely free) can be downloaded here:

Update 2014.05.26:
Yeah, I made a boo-boo... I didn't bother googling SubRip specifications prior to coding with a handful of SubRip files as samples (hehehe oops!).


VidProkEnMasse is an all-ffmpeg solution for your daily video encoding needs.  The name is derived from its two major apps in the collection.  "VidProk" processes videos 'piece-meal' while "En Masse" batch processes videos (last tested on 1849 files).

Apart from their intended use, VidProk and En Masse are also excellent learning tools for new ffmpeg users as both apps readily reveal their ffmpeg 'recipes'.  While the GUI provides convenience for experienced ffmpeg users, you don't have to be an ffmpeg guru to use VidProkEnMasse.  It does not include a large collection of device-specific presets, but it fairly outlines some of ffmpeg's vast capabilities.  You can consider the example presets as a sort of walk-through.

VidProkEnMasse is a home-brew solution created by a frustrated end-user for other end-users.  It 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.  VidProkEnMasse is absolutely free, though small donations are very much welcome.  Email me: chiqboy<[at]>gmail<[dot]>com

En Masse features:
1.  Easy operation:  Select preset, select folder, generate batch file, convert.
2.  The usual features:  Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, generate video statistics logs, shutdown after encoding, etc.
3.  Logged encodes:  Elapsed time, render speed, rendered file size, possible failed encode, etc.
4.  Preset Manager - Bitrate-based encodes: Integrated qf calculator.  Max duration on DVD-5/-9.  Resize all videos to one width or depending on aspect ratio, or no resize at all (square pixel/anamorphic).
5.  Queue Stats readily displays total number of files/size, total duration, and estimated total output size (if available).
6.  Integrated bitrate calculator (Duration/x).  Suggests video bitrate based on total video duration (as on Queue Stats) and the number of discs you specify.
7.  Text expansion support (%variables%).

VidProk features:
1.  Easy operation:  Drag/drop video, select preset, add video filters, tweak, preview, encode.
2.  The usual features:  Burn-in *.srt (SubRip) subtitle files, single-/two-pass encoding, crf-/quantizer-/bitrate-based encoding, extract frames to jpg files, extract screen shots, extract embedded subtitles to srt, extract audio to wav, change container or discard/copy stream, generate video statistics logs, crop/scale/distort frames, select/tweak/preview video filters, etc.
3.  Logged encodes:  Elapsed time, render speed, rendered file size, possible failed encode, etc.
4.  Text expansion support (%variables%).
5.  Unique feature:  LAP (low, average, peak).  Answers the question: 'What's the peak video birate like if I were to encode with XYZ settings?'.

Some of the other tools included:

GetTotalDuration.exe:  Computes total and average duration of dragged/dropped video files.

JoinAVstreams.exe:  Stream copy/mux.  May fix generally faulty videos or some rogue mkv files (variable frame rate with missing frame count).

AnalyzeVstatsLogFile.exe:  Similar to "LAP".  Reads ffmpeg-generated video statistics logs and retrieves low/average/peak q, low/average/peak bitrate, etc.  Ever wondered what the bitrate is like for T.V. noise?

En Masse demo:

Download VidProkEnMasse:

Click Here

Update: VidProkEnMasse_20170116
1. Modified scale routine: If Width combo boxes are left blank, no scale filter will be applied. I was compelled to implement this when I processed videos from a smart phone (annoying "portrait" videos).

2. Added "SRTFix.exe" (GUI) and "SRTFixCLI.exe" (command line). Both attempt to fix subtitles (*.srt) with long lines that go right off the screen. Limits subtitles to two rows when max characters is exceeded.

3. Added "GaugeVideoGenerator.exe". Default settings attempt to replicate the visual content (bitrate-wise) of "Transformers - Age of Extinction (2014)"... shortened to 100 seconds. Lets the user guesstimate output file size of crf-/quantizer-based encodes. Said movie, AFAIK, has the highest bitrate for a feature film. May answer the silly question: "What is the equivalent bitrate of crf 23?"

4. Added %presetdetails% to text expansion. Useful when used on metadata comment.

%presetdetails% expands to:
PresetName: V/A codec: vc+ac. V/A bitrate: vb+ab. fps: x. Widths: a, b, c, d. PIFA: xyz. VFA1: xyz. VFA2: xyz. PvfFFA: xyz.

5. Added %loud% to text expansion which makes audio output significantly louder

%loud% expands to:
-af "aformat=channel_layouts=stereo, compand=0 0:1 1:-72/-72 -48/-6 -3/-3 24/-3:0.01:0:-96:0"

6. Updated to "ffmpeg-20160116-git-d7c75a5-win32-static" which works on my OS (Windows XP 32-bit). Please feel free to replace with the latest ffmpeg Zeranoe static build if desired/required.

7. Unfortunately, VidProkEnMasse, being written in AutoIt, still suffers false positives from lazy AV software companies :\

Update:  VidProkEnMasse_20140714
1. Renamed app to 'VidProkEnMasse'.
2. Added text expansion feature (%variables%).
3. Added 'AnalyzeVstatsLogFile.exe' which retrieves info (like peak q, peak bitrate, etc) from vstats log files.
4. VidProk: Added 'LAP' (Low, Average, Peak) which performs video statistics gathering and retrieves info similar to 'AnalyzeVstatsLogFile.exe'.
5. Added 'Longest.Line.In.Srt_[DROP.SRT.FILE.HERE].exe'.
6. Numerous tweaks.
7. Updated to ffmpeg-20140712-git-ca671be-win32-static.
8. Moved site to

Update:  EnMasse_20140528
1. Dropped MediaInfo in favor of ffprobe (En Masse is now an ALL-ffmpeg solution).
2. En Masse: Burn-in subtitles (batch mode).
3. New policy: Maintain anamorphic dimensions if not resized.
4. Two-pass encoding.
5. VidProk encoding is now logged.
6. Numerous tweaks.
7. Updated to ffmpeg-20140502-git-0f9f24c-win32-static.