nssm is not rotating output files - nssm

I am using the below parameters for creating windows service. However, the nssm is not rotating the output file:
AppRotateFiles 1(enables file rotation)
AppRotateOnline 0
AppRotateSeconds 86400 (time between rotation)
AppRotateBytes 1048576 (file size threshold to rotate the file)

Without online rotation turned on NSSM only rotates the files when the service starts. If you just have it running it will not do anything.

Related

MLT melt slideshow on Windows: unable to control output video length and problems with using wildcards

I am using the following command within a batch script to, hopefully, eventually programmatically create simple video slideshows with transitions:
melt 131.jpg 132.jpg 133.jpg ttl=75 -attach crop center=1 -filter luma cycle=75 duration=25 -transition mix -consumer avformat:out.mp4 frame_rate_num=30 frame_rate_den=1
Most of this command is an adaptation for Windows of this command on the MLT website blog (with the exception of the part that scales and transforms the image). For some reason when I run this, however, the output video file is 25 minutes long!
I have two main questions:
a. How do I properly control the duration of each image in the video? I have experimented quite a bit with changing the parameters and I have a semi-decent understanding of what they all mean (I am a newbie to MLT but I figured that there's no way to do something like this easily in FFMPEG alone). The only way I have found to decrease the duration with any amount of control is to increase the output framerate to absurd numbers (which, of course, is not ideal as it's a massive waste of time and energy and still doesn't really solve the issue).
b. How do I use a wildcard to input all the .jpg files in a folder on Windows? I tried adding *.jpg but that didn't work and I don't know how else to do it within a batch script (I tried using the following code to get the file names as a variable, but I wasn't able to get string concatenation working correctly because it only outputs the final file name)
set files=
for /r %%i in (*.jpg) do (
echo %%i
set files=%files% "%%i"
)
echo %files%
Thank you for any suggestions!
When you specify a .jpg file, melt automatically chooses a producer internally. Depending on your environment and version, that producer will either be the qimage or pixbuf producer.
Both producers offer a "ttl" parameter to specify the duration of the image (in frames) for image sequences
https://mltframework.org/plugins/ProducerQimage/#ttl
https://mltframework.org/plugins/ProducerPixbuf/#ttl
In the example you linked, an image sequence is created by using the special syntax: photos/.all.jpg ttl=75
In your example, you specify a specific file name. So an image sequence is not created. Instead, a new producer is created for each file. The default length for a producer is 15000 frames.
https://github.com/mltframework/mlt/blob/master/src/framework/mlt_producer.c#L102
The length can be specified in the command line.
melt 131.jpg length=100 132.jpg length=100 133.jpg length=100
Change
set files=%files% "%%i"
to
CALL set "files=%%files%% "%%i""
This uses a subsidiary process to concatenate your filenames.
I have no idea about the solution to your other question.

Automating FFmpeg/ multi-core support

I need help with FFmpeg/batch. I have a couple of large batches of images (+14000 files each batch, +5 MB each image, .TIFF all of them) and I'm stringing them together into a .mp4 video using FFmpeg.
The date in the metadata is broken because of the way they're stored upon creation, so the time and date (T/D) are on the file_name. I need each frame to have its respective T/D (so its File_Name) burnt onto them for accurate measurements (scientific purpose).
With the help of google and reddit, I've managed to semi-automate it like so:
Master.bat:
forfiles /p "D:\InputPath" /m "*.TIFF" /S /C "cmd /c C:\SlavePath\slave.bat #file #fname"
Slave.bat:
ffmpeg -i "%~1" -vf "drawtext=text=%~2: fontcolor=white: fontsize=30: fontfile='C\:\\FontPath\\OpenSans-Regular.ttf'" "D:\OutputPath\mod_%~1"
Running Master.bat will output each individual image with the text burnt onto them and change the File_Name to mod_'File_name'.TIFF
Real example: 2018-06-05--16-00-01.0034.TIFF turns into mod_2018-06-05--16-00-01.0034.TIFF
The problem is that FFmpeg doesn't like it when my files have "--" in them ("date--time.miliseconds.TIFF") and doesn't like the miliseconds either, so I have to change the name of all files "manually" using Bulk Rename Utility (BRU). So, using BRU I rename all files to 00001.TIFF, 00002.TIFF, etc. and FFmpeg likes me again. It works great, but it means I can't be AFK.
After that, I have to go back to cmd and manually start the image to video conversion.
Also, FFmpeg doesn't seem to be using all cores.
I need help finding a way to:
Change master.bat's output to 00001.TIFF etc. automatically in order of processing (i.e. first to be processed is 1.TIFF, 2nd is 2.TIFF)
Add ffmpeg's img-to-vid function to the automating system
Get my CPU to use all the cores effectively if possible. 2014/15 posts found on google make it seem as though FFmpeg doesn't support multi-core or hyperthreading.
64bit Windows, i7 7700hq, gtx 1050 4Gb, C: SSD, D: HDD
Try this:
ffmpeg -i "2018-06-05--16-00-01.%4d.TIFF" -threads 4 out.mp4
https://en.wikibooks.org/wiki/FFMPEG_An_Intermediate_Guide/image_sequence

Easy way to make a test PDF of a certain file size

want to test the upload file size limit in an application, and it's a pain finding / making various pdf's of certain sizes to test / debug this. Anybody have a better way?
You can write a simple shell script that converts set of images to pdf: How can I convert a series of images to a PDF from the command line on linux? and do it for 1,2,3, ..., all image files in certain directory.
Creating directory full of copies of single image, should be simple too, start with one image file with desired size e.g. 64KB.
# pseudocode - don't test it
END=5
for i in {1..$END}; do cp ./image ./image_$i; done
for i in {1..$END}; do convert ./image_{1..$i} mydoc_$i.pdf; done
I've found an online tool, however, it seems to not be working correctly since it can only generate 10MB files even though you tell it to make a 50MB file.
https://www.fakefilegenerator.com/generate-file.php

Increasing Windows Mobile 5 Emulator Storage

I'm using the Microsoft Sync Framework to synchronize a SQL Server database with a SQL Compact SDF file on the Windows Mobile 5 emulator. We have a 2 gig SD card in the actual device we're deploying on so we'd like to store our database file there. However, when I map a shared folder as the storage card in the Windows Mobile 5 emulator, the SQL Compact engine is not able to create or modify a database file on the mapped storage card because of a bug. So to get past this during development on the emulator, I was just going to store the database on the internal device storage, however, it's limited to 32 MB and I can't find a way to increase it. Does anyone know how to increase the storage space on the emulator. I'm talking storage space not RAM :).
Otherwise, does anyone know how to get past the bug of not being able to have a SQL Compact database file on the storage card in the emulator?
Thanks!
Under http://forum.xda-developers.com/showthread.php?t=549675 you will find a driver for the emulator that sets up a RAM Disk, that for the emulator is seen as an external storage card but doesn't suffer from the issues with mapping a folder. I've checked with SQL Compact sdf file stored in the RAMDisk and it works like a charm. I've used it as a 64MB drive but supposedly it can handle up to 256 MB.
actually you can do this.
First of all open Device Emulator and run the emulator of your choice. In my case i open Windows Mobile 5.0
Then, as it runs, from device emulator, right click the emulator you just run and select Save-As, save it somewhere and then open this file with a text editor.
In there, you will find an option that says memsize, set it the following:
<MemSize Reconfigurable="true">256</MemSize>
Unfortunatly the maximum is 256 as it says if you try to set it higher.
Now, from Device Emulator, select the emulator entry that you just saved previously(Not the original, but the custom located under My Device Emulators in Device Emulator) and will be run with the cfg file that you just modified.
Hope this helps.
If you have an actual device I would recommend testing on the device by connecting it via active sync. I do not know how to change the memory of the emulator but I know that HP has emulators that you can download for testing and I would bet that one of them would match what you are trying to target.
In the Microsoft Device Emulator V3 (note that this installs in and over-writes the previous "\Microsoft Device Emulator\1.0" folder), using Windows Mobile 5, the help you get when typing "deviceemulator" with no parameters is pasted below. The first thing it states is that message about memsize. I tried it with values > 256 MB and just throws up the help dialog box. I was messing with this when trying to get it to recognize my /sharedfolder as a storage card. Maybe this will be possible in newer device emulators. If I can get it to work I can test placing an SDF file on the card.
Device Emulator
Memory size must be a value between 64 and 256.
Command Line Option Help
binfile - Filename of the binfile to be loaded by the emulator.
#responsefile - Filename to XML response file.
/a - Keeps emulator window always on top.
/battery - Emulates running from a battery instead of AC
/batterycharge percentage - Emulated battery charge percentage
/c - Creates and displays a console window to show output from Serial Port 1.
/cpucore - ARMv4 or ARMv5. Default is ARMv4.
/cpuoptions - A combination of (T)humb,D(ebug),I(nternetworking),M (Long Multiply),E (DSP). Of these, T,D,I will always be set.
/defaultsave - Use the VMID as the saved state name and place the saved state file in the per user directory.
/flash filename - Enables flash-memory emulation and specifies flash-memory storage filename.
/h - Sets host-only routing for network packets.
/hostkey keyname - Specifies host key, where keyname can be 'None', 'Left-Alt', or 'Right-Alt'.
/language LangID - Specifies the UI language, where LangID is a decimal.
/memsize size - Sets emulated RAM size, where size is in megabytes.
/nosecurityprompt - Do not prompt when enabling potentially unsafe peripherals when restoring from saved state.
/n [macaddress] - Enables CS8900 network adapter where optional macaddress specifies which host adapter the card will bind to.
/p [macaddress] - Enables NE2000 PCMCIA network adapter, where optional macaddress specifies which host adapter the card will bind to.
/r address - Specifies ROM file base address(in hexadecimal).
/rotate angle - Rotates the display by degrees, where angle can be 0, 90, 180, or 270.
/s filename - Specifies the save-state filename.
/sharedfolder directoryname - Mounts directoryname as a storage card.
/skin filename - Loads the specified skin file.
/tooltips state - Enables or disables tooltips, where state is 'ON' or 'OFF'.
/u0 serialport /u1 serialport /u2 serialport - Maps guest serial ports 0-2 to Windows serial ports.
/vfp - Vector Floating Point coprocessor: true or false. Default is false.
/video xx - Specifies screen size and bit-depth.
/vmid {GUID} - Specifies the VMID GUID.
/vmname name - Specifies the window title.
/z - Zooms the display to 2x normal size.
/speakerphone - {[SpeakerPhone][Headset][Carkit]} - Bitmapped number between 0-7 specifying Speakerphone, Headset, Carkit mode.
OK

What can i use to automate video snapshots

What command line util can i use to create a thumbnail preview of a video i made? I do not want a single thumb that windows make, i want a large jpg file that has 30 or less shots so i can preview the movie w/o running it.
I either need an app that can do a batch at once or a command line util so i can loop through a folder or w/e i need and feed it to the util. I was thinking of hacking up ffplay to do this, i dont know what i am getting myself into so is that recommended? (i used SDL many times, never its YUV settings nor with ffmpeg)
You can use ffmpeg to perform frame extraction, here's how I've done something similar
ffmpeg -i my_input_video.flv -y -an -sameq -f image2 -r 1 my_frame_%05d.jpg
-i my_input_video.flv specifies the input file
-y overwrite output files
-an disables audio (we're transcoding a video to a series of jpegs, we don't need audio)
-sameq - use same quality as source
-f image2 sets the output format to image2 (an image sequence)
The -r parameter is the frames per second, so the above command will produce one jpeg per second.
Once you have your collection of jpegs, you can use ImageMagick montage command to build a montage image.
You could use MTN. It can scan whole directories and create thumbnails for every video found.
Use mplayer:
mplayer -vo jpeg -frames 1 your_file
Will extract the first frame.
Media Player Classic can make a collection (it's called save as thumbnail; with matrix i.e. 4x4), but only from a single file.
Potplayer can automatically generate the thumbnails for a batch of videos in folders or even in subfolders. It just takes a few clicks.
Add all the videos you want to get thumbnails from to the playlist (You can do this by go to menu "Open-Open Folder...")
Select all the videos in playlist and right click on them.
Select "Create Thumbnail Image(s)..." in pop-up menu.
Custom the output folder, number of Thumbnails, image size and other setting.
Click "OK".

Resources