View Full Version : How to Batch Process in StaxRip with Target Bitrate?
funkydoobie
11th April 2007, 02:33
I'm having trouble getting StaxRip to batch encode DV video with X264 using a target bitrate. Specifically, it always ends up using a MUCH higher bitrate than I specify, which I suspect is due to the existence of a preset size for the "default" 90 minute length video before you actually add an input file.
Here are the steps I am taking (I'm being somewhat thorough, just in case I'm overlooking something):
* Open StaxRip with default template
* Change filters as follows: change Source to DirectShow (the source file is a DV AVI), add ConvertToYV12 AviSynth filter, change Resize to Sharp
* Choose CE-Highprofile profile (Profiles --> Encoder --> x264 --> More --> CE-Highprofile)
* Configure x264 to use 2 threads (Codec Configuration --> Input/Output --> Threads = 2)
* Set resize width and height to 320x240
* Set video bitrate to 384 (which changes the Size setting to 247, based on a "generic" 90 minute default duration)
At this point I actually saved a project template, but -- as I said -- I want to make sure I'm not doing something wrong.
* At this point I click the Assistant hyperlink (at the bottom) to load source files
* In the Source Files window, I click Add
* Select a few DV AVI files and click open
* Set the Mode to "file batch"; Creat Jobs is checked; click OK
At this point I actually add a subtitle file to each job (each AVI input file has an associated SRT subtitle file -- created with DVDate -- that I would like to mux into each output MP4 file), which is a bit of a manual process but I see no other way to do it. The way I do this is I load each job in turn, click Container Configuration, and then add the subtitle file (again, for each job/input file).
Once all jobs are ready, I click Start in the Batch window to start the batch process. StaxRip does its thing, calling the various external applications to prepare and ultimately encode the files. Here's what the log window shows; note how the bitrate is set at 82827! Any suggestions on how to successfully specify the bitrate will be GREATLY appreciated. Thank you!
======================
---------- Preparing ----------
Preparer: Extract audio from AVI using VirtualDubMod
Command line: "C:\PortableApps\StaxRip v0.9.9.9\Settings\Applications\VirtualDubMod\VirtualDubMod.exe" /s"D:\Video\Capture\Temporary Files\T001 C001 20010511-124533 00.00.00.18_Demux.vcf" /x
---------- AviSynth Script ----------
DirectShowSource("D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18.avi")
Crop(0,0,-0,-0)
LanczosResize(320,240)
ConvertToYV12()
---------- Audio Encoding ----------
Command Line: "C:\PortableApps\StaxRip v0.9.9.9\Settings\Applications\BeSweet\BeSweet.exe" -core( -input "D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18.wav" -output "D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18_AudioOutput.mp4" ) -azid( -c normal -L -3db ) -ota( -d 0 -g max ) -bsn( -vbr 0.3 -2ch )
---------- Audio Encoding Statistics ----------
Start time: 9:32:52 PM
End time: 9:32:54 PM
Duration: 00:00:01
Speed: 482 fps
Size: 0.1 MB
Bitrate: 49.75 kbps
Video Bitrate: 82817 -> 82827
---------- x264 Single/First Pass Encoding ----------
Command Line: "C:\PortableApps\StaxRip v0.9.9.9\Settings\Applications\x264\x264.exe" --pass 1 --bitrate 82827 --stats "D:\Video\Capture\Temporary Files\T001 C001 20010511-124533 00.00.00.18.stats" --bframes 3 --b-pyramid --progress --threads 2 --no-psnr --no-ssim --thread-input --subme 1 --analyse none --me dia --ref 1 --output NUL "D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18.avs"
---------- x264 Single/First Pass Encoding Statistics ----------
Start time: 9:32:54 PM
End time: 9:33:11 PM
Duration: 00:00:17
Speed: 43 fps
---------- Second Pass Encoding ----------
Command Line: "C:\PortableApps\StaxRip v0.9.9.9\Settings\Applications\x264\x264.exe" --pass 2 --bitrate 82827 --stats "D:\Video\Capture\Temporary Files\T001 C001 20010511-124533 00.00.00.18.stats" --ref 3 --bframes 3 --b-pyramid --weightb --b-rdo --bime --analyse all --8x8dct --subme 6 --trellis 1 --mixed-refs --progress --threads 2 --no-psnr --no-ssim --thread-input --output "D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18_EncoderOutput.264" "D:\Video\Capture\T001 C001 20010511-124533 00.00.00.18.avs"
funkydoobie
21st April 2007, 15:48
Can anyone offer a suggestion?
Thank you, in advance, for any guidance you can offer...
kikker
23rd May 2007, 16:30
I don't know if this would help, but you could add an extra "switch" using the CLI tab of the x264 settings the profile you're using to set the max bit rate. It may just throw an error at you, or it may just use the max bit rate. Just add --vbv-maxrate xxx, where xxx is your max bitrate.
Have you also looked at Options with F8? In the automation tab, you can check the auto-compressibility check, then use change file size in the drop down menu. Hopefully, then you will see a better bitrate that Staxrip chooses.
stax76
27th May 2007, 10:29
It's not supported because it's not common to do it. Even with the 'Event Commands' feature it's hardly possible. When I have some time I add some more macros, configure 'Event Commands' and make a screenshot of the 'Event Commands' configuration.
stax76
27th May 2007, 12:31
I've uploaded a silent 1.0.0.1 update since a command and a macro was missing to achieve your goal, besides that there was a bug with 'Event Commands' as well. The screenshot below shows the configuration of a 'Event Command' that does the following:
After a source file is loaded in a project that is derived from a template named 'Simple' set the video bitrate to 1000.
http://www.planetdvb.net/non_drupal/forum_images/staxrip_event_commands_example.png
kikker
27th May 2007, 18:29
Stax, this does not work for me. The video defaults to around 25,000 kbps when I add source files to the batch window. I have the exact same event command window as above, and in the batch window I have selected both batch mode and 'add jobs'.
However, if I select batch mode and deselect the 'add jobs', I encounter something I don't expect: I am brought to the main window for dialogs pertaining ONLY to the last file in the batch list. All of the other batch files WERE added to the jobs list with the exception of the last one in the batch list.
stax76
27th May 2007, 21:25
Stax, this does not work for me. The video defaults to around 25,000 kbps when I add source files to the batch window. I have the exact same event command window as above, and in the batch window I have selected both batch mode and 'add jobs'.
Works here, when you just open one file in normal combine mode instead of batch mode, gets the bitrate adjusted according to your event command?
However, if I select batch mode and deselect the 'add jobs', I encounter something I don't expect: I am brought to the main window for dialogs pertaining ONLY to the last file in the batch list. All of the other batch files WERE added to the jobs list with the exception of the last one in the batch list.
Doesn't happen here either, no jobs are added, are you sure the job list was empty? It just performs preparation for each batch item. I've improved the help for 'Add Jobs' now:
Opens files in batch mode and creates jobs. Disabling this option is useful to batch perform preparation (demuxing etc.).
kikker
28th May 2007, 06:21
Works here, when you just open one file in normal combine mode instead of batch mode, gets the bitrate adjusted according to your event command?
In combine mode, the bitrate field does change to the correct one selected in Event Commands after demuxing, but only the first file of the source files is demuxed. I have no idea what happens to the other files selected in the source box.
Doesn't happen here either, no jobs are added, are you sure the job list was empty? It just performs preparation for each batch item. I've improved the help for 'Add Jobs' now:
Opens files in batch mode and creates jobs. Disabling this option is useful to batch perform preparation (demuxing etc.).
OK, I've redone this many times to confirm.
In combine mode, only the first file in the source list is processed, and the correct bitrate is selected as specified in the Event Commands.
In batch mode (add jobs), all sources are added to the jobs list, but the bitrate of the Event Commands does NOT get applied.
In batch mode (no add jobs), all source files are immediately demuxed, and only the LAST file ends up in the jobs queue. If I try to start that job from the jobs window, the app says that the project has changed and if I would like to save it. I'm not even sure what that means....
Each time I ensured there were no previous jobs and that all temporary files were deleted. I'm hoping like the OP that I can simply take a bunch of files and batch encode them at specific resolution and a specific bitrate. :cool:
stax76
28th May 2007, 09:17
In combine mode, the bitrate field does change to the correct one selected in Event Commands after demuxing, but only the first file of the source files is demuxed. I have no idea what happens to the other files selected in the source box.
What type of file is it and what application does demux it?
kikker
28th May 2007, 14:55
I have several short MP4's and MKV's. Virtualdubmod demuxes only the first file in the list in combine mode. Next, I'm brought to the main screen, the bitrate rate is then changed according to the Event Commands, and that's all that happens. I would expect that I would next need to enter all the parameters for the encode and the resultant file would be all those in the list spliced together. But, the only job added to the list is the first file.
Anyways, combine mode isn't all that important to me at least. I'd really love to get batch mode working properly with a specific bitrate and resolution, but that's not such a problem either, as I can simply apply parameters to each file individually.
stax76
28th May 2007, 15:41
I don't recall but guess combine don't work with MP4 or MKV, it appears highly unusual to combine them. I'll try to either support it or show a warning. I should have said to to open a single file in comine mode to test if the event command applies the bitrate. If the event command changes the bitrate in combine mode, then it should also do it in batch mode, I've tested it and it worked.
MidKnight123
17th June 2007, 06:27
I just tried your example above and its not encoding to the bitrate i have set either. Dont know if imdoing something wrong or not, but i set the events the same as pictured,then load my *.vob file.
stax76
23rd June 2007, 09:55
There is a hotfix (http://www.planetdvb.net/node/318) writing event commands to the log file, maybe that can give the hint what's wrong.
Nazgulled
3rd August 2007, 17:36
I am doing exactly the same thing and using that hotfix. Here's the log file:
---------- Preparing ----------
Preparer: Extract audio from AVI using VirtualDubMod
Command line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\VirtualDubMod\VirtualDubMod.exe" /s"C:\Users\Nazgulled\Videos\Temporary Files\Fogo de Artifício do Rio_Demux.vcf" /x
---------- AviSynth Script ----------
DirectShowSource("C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.avi")
ConvertToYV12()
---------- Audio Encoding ----------
Command Line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\SoX\sox.exe" "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.wav" -r 44100 -w "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.wav_soxed.wav"
---------- Audio Encoding ----------
Command Line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\BeSweet\BeSweet.exe" -core( -input "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.wav_soxed.wav" -output "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio_AudioOutput.mp3" ) -azid( -c normal -L -3db ) -ota( -d 0 -hybridgain ) -shibatch( --rate 44100 ) -lame( --alt-preset cbr 32 -m m --resample 44.1)
---------- Audio Encoding Statistics ----------
Start time: 17:03:46
End time: 17:03:48
Duration: 00:00:02
Speed: 1156 fps
Size: 0,4 MB
Bitrate: 32,10 kbps
Video Bitrate: 161949 -> 161949
---------- x264 Single/First Pass Encoding ----------
Command Line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\x264\x264.exe" --pass 1 --bitrate 161949 --stats "C:\Users\Nazgulled\Videos\Temporary Files\Fogo de Artifício do Rio.stats" --filter -2:-2 --no-cabac --progress --threads auto --sar 34:33 --no-psnr --no-ssim --thread-input --subme 1 --analyse none --me dia --ref 1 --output NUL "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.avs"
---------- x264 Single/First Pass Encoding Statistics ----------
Start time: 17:03:48
End time: 17:06:34
Duration: 00:02:45
Speed: 18 fps
---------- Second Pass Encoding ----------
Command Line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\x264\x264.exe" --pass 2 --bitrate 161949 --stats "C:\Users\Nazgulled\Videos\Temporary Files\Fogo de Artifício do Rio.stats" --filter -2:-2 --no-cabac --analyse p8x8,b8x8,i4x4,p4x4 --subme 6 --progress --threads auto --sar 34:33 --no-psnr --no-ssim --thread-input --output "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio_EncoderOutput.264" "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.avs"
---------- Second Pass Encoding Statistics ----------
Start time: 17:06:34
End time: 17:28:56
Duration: 00:22:22
Speed: 2 fps
---------- Muxing ----------
Command Line: "C:\Users\Nazgulled\AppData\Local\StaxRip\Applications\MP4Box\MP4Box.exe" -fps 30.000 -add "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio_EncoderOutput.264:name=Video" -add "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio_AudioOutput.mp3:lang=por:name=Portuguese (MP3)" -new "C:\Users\Nazgulled\Videos\Fogo de Artifício do Rio.mp4"
---------- Muxing Statistics ----------
Start time: 17:28:57
End time: 17:30:34
Duration: 00:01:37
Speed: 31 fps
---------- Overall Statistics ----------
Start time: 17:03:34
End time: 17:30:35
Duration: 00:27:00
I don't see the event anywhere... By the way, don't look at the speed, I was playing a game at the same time :P
However, when the combine files mode is selected, the vent works just fine. The bitrate is changed according to setting specified in the event created. I also tried to set the event to "Before Job Encoding", but it didn't work also...
Please advise!
stax76
3rd August 2007, 18:00
In order to narrow the problem please try without using any criteria.
Nazgulled
3rd August 2007, 19:57
What do you mean? Remove all the criteria or try different ones? And which event do you recommend? After Source Loaded or Before Job Encoding?
Nazgulled
4th August 2007, 21:47
One thing that I noticed:
Selecting one file at a time and creating jobs individually, adding all them to the job list, works fine with the event set to "Before Job Encoding". However, it doesn't work when I load them all and select file batch...
burfadel
5th August 2007, 09:07
For batch encoding, you need to do it for each source type, so hopefully they're the same, but the best way is this:
- Open Staxrip, and work out what source filter the files to be encoded require (say directshow or avi). Directshow will work just fine if you have ffdshow installed.
- Set the filters to whatever you require. If you require a set 320x200 for example, don't use the slider bar! The best way to keep the source in ratio is clicking on view--options--automation, then set the auto resize image to the required number of pixels. For example, 320*200 is 64000, so set this value to 63000 (it rounds it up to the next size, so if you set it to 64000 it could be slightly larger than 320x200).
- Set all the codec parameters you require, for video and sound.
- Open the files as batch, and it will batch all the files with the exact settings you selected. Thats for the filters, the resize amount (you can select the resizer through filters, or enter your own preference), the audio and the video settings, every file you load in the instance will have those settings.
- If need to batch say 4 different preferences of 10 files each as an example, you need to batch the first lot, load the default profile, then batch the second lot etc etc. You can add different types of batched files to the encode list.
- Then encode! simple :) the output file will be in the same folder as the input folder.
- Haven't tried this, but it should work :D If you add to the filter list:
TextSub("%source_file%.xxx")
Where .xxx is the file type of the subtitle it could work :) If the file name is filename.mpg, you just have to make sure the subtitle name is filename.mpg.srt or whatever susbtitle format it uses.
Nazgulled
5th August 2007, 19:13
I know your trying to help but your post was irrelevant to the problem in this thread...
We have some videos to encode, doesn't matter their type, nor their length, we want them to have a fixed bitrate no matter what. Those files with fixed bitrate have a template which has every setting (filter, codec, whateveR) pre-configured, we only need to load the template select the files and "press encode". And we want all those files to have a fixed bitrate.
Like I said, the problem (bug?) must be in the loading files dialog when selecting file batch or something, cause when I load the files and create jobs one by one, it works just fine and the fixed bitrate is set for every single file. But the idea is to select a bunch of files, choose the profile and start the encoding.
Nazgulled
12th August 2007, 04:06
Any more thoughts on this?
Nazgulled
18th August 2007, 23:55
Guess not...
ExperimentalAnimations
9th May 2012, 06:35
I wanted to add that i ran into this problem too and apparently it has not been fixed in the five years since it has been brought up. If you want to control the bitrate of your batch encode then staxrip is not the program to do it.
6ari8
17th July 2012, 07:07
You can solve this problem by adding a Custom switch in the command line in config codec for x264 such as --bitrate 300 and save your template before batch processing. This way you would have to --bitrate switches in the command line. The one created by staxrip and the one you choose. For example:
--preset slow --tune animation --pass 2 --bitrate 500 --bframes 7 --subme 10 --trellis 2 --merange 24 --aq-mode 2 --bitrate 300 --stats "<stats>" --output
By doing this, x264 ignores the first switch created by staxrip. I'm using this method to batch process.
Hope this solves your problem!
Pulp Catalyst
17th July 2012, 22:32
i've always hoped that the entire batch system in Stax gets rewritten.... it always felt to me an addon after thought, stax gets very hit and miss when batching
MeGUI's one click system definitely is a better approach and does feel more rigid, although when batching in MeGUI HOWEVER remember to create a TEMP folder for each job, otherwise temp files could get overwritten which would definitely lead to MeGUI having a paddy!!!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.