Log in

View Full Version : How to autosave x264info when using bat?


stillwater
13th July 2010, 19:53
I encode using bat files.
I wonder how to autosave x264info when using bat?
I know that megui can save jobs' x264info automatically in log files.
Is there any way to save x264info in bat automatially when encoding complete?
If so, pls tell me how can I do that. Thanks a lot.

LoRd_MuldeR
13th July 2010, 20:14
x264.exe [options] 2> logfile.txt

Snowknight26
13th July 2010, 20:57
That wouldn't show the progress indicator or the other output in the command prompt though.

Lorax2161
13th July 2010, 21:52
Right click top bar of command line window... EDIT -> SELECT ALL.
Right click top bar of command line window... EDIT -> COPY.

Paste into the document of your choice.

I mention clicking the top bar of the window because if you just click anywhere, it will deselect your selection.

Edit: if your window is closing on you, put "pause" as the last line in your batch file.

LoRd_MuldeR
13th July 2010, 22:04
That wouldn't show the progress indicator or the other output in the command prompt though.

Try this:
http://forum.doom9.org/showthread.php?p=1417496#post1417496

stdout/stderr logging utility [2010-07-14]
Written by LoRd_MuldeR

Usage:
logger.exe [<logfile> [<mode>] :] program.exe [<arg_1> <arg_2> ... <arg_n>]

Parameters:
<logfile> Save application output to log file (default: "Logfile.txt")
<mode> Write 'stdout' or 'stderr' or 'both' to log file (default: 'both')
<arg_1...n> Parameters for child application (optional)

Examples:
logger.exe x264.exe --crf 22 --output outfile.mkv infile.avs
logger.exe mylogfile.txt : x264.exe --crf 22 --output outfile.mkv infile.avs
logger.exe log.txt stderr : x264.exe --output - infile.avs > outfile.264

Snowknight26
13th July 2010, 23:48
Right click top bar of command line window... EDIT -> SELECT ALL.
Right click top bar of command line window... EDIT -> COPY.

Alternately, you can right click, Select All in the main window, then hit enter to copy your selection to the clipboard.

stillwater
14th July 2010, 06:15
Thanks everybody. I'll try.

Chikuzen
14th July 2010, 08:41
x264.exe [options] -o outfile infile 2>&1 | Findstr /V "frames:" > log.txt

LoRd_MuldeR
14th July 2010, 14:07
Yet another small update:

http://img822.imageshack.us/img822/4205/cwindowssystem32cmdexe2.png

LoRd_MuldeR
18th July 2010, 21:14
Added a few more options. Download link in previous post updated...

LoRd_MuldeR
24th July 2010, 00:07
One more update. Tool should be 100% Unicode-aware now. Download link in previous post updated...

b66pak
24th July 2010, 17:55
thanks a lot...
_

laserfan
24th July 2010, 18:11
I wanna try this, but a quick question first: what kind of a processing penalty if any might result from using this w/x264?

LoRd_MuldeR
25th July 2010, 20:23
I wanna try this, but a quick question first: what kind of a processing penalty if any might result from using this w/x264?

Negligible, really...

LoRd_MuldeR
28th July 2010, 00:04
More improvements and fixes. Download link in previous post updated...

7ekno
28th July 2010, 11:08
Wow, logger rocks LoRd_MuldeR!

Thanks for such a versatile tool (and not just for encoding stuff!) ;)

Do you have a preferred method of accepting donations?

7ek

LoRd_MuldeR
28th July 2010, 11:59
Do you have a preferred method of accepting donations?

Nope. I do not accept any donations currently...

7ekno
29th July 2010, 11:22
Then *big pat on the back* and keep up the good work, this little piece of code is a true gem ;)

Thanks again,

7ek

LoRd_MuldeR
29th July 2010, 18:51
Question: Does anybody know how to redirect the stderr of an application to another application's stdin - using the Windows command prompt ???

I know that I can redirect the stderr to a file using programe.exe 2> stderr.txt, but is there something similar to program1.exe | program2.exe for the stderr? :confused:

Well, I tried program1.exe 2| program2.exe and it didn't throw an error. But still only the stdout stream was redirected, not the stederr stream...

MasterNobody
29th July 2010, 19:10
Well, I tried program1.exe 2| program2.exe and it didn't throw an error. But still only the stdout stream was redirected, not the stederr stream...
Try program1.exe 2>&1 | program2.exe

LoRd_MuldeR
29th July 2010, 19:39
Try program1.exe 2>&1 | program2.exe

That did the trick :thanks:

So with the latest update, we can use logger like this as well:
x264.exe --output output.mkv foreman_cif.352x288.avi 2>&1 | logger.exe -filter "x264 [info]" -invert : -

kypec
29th July 2010, 22:51
I suggest to make this thread sticky and perhaps change the title at that occasion...

Motenai Yoda
30th July 2010, 20:19
there isn't a x264_logger patch?

b66pak
30th July 2010, 20:25
this tool can be used with any program...
_

LoRd_MuldeR
5th August 2010, 21:35
Minor update. The input and output encoding (codepage) can be configured by user now. Default for both is UTF-8, which is the same that was used in previous versions.

asarian
6th August 2010, 22:03
Minor update. The input and output encoding (codepage) can be configured by user now. Default for both is UTF-8, which is the same that was used in previous versions.
Thanks for your continued efforts to further x264. :) This is yet another useful support program you wrote for x264. It's much appreciated.

telmoMRC
19th December 2010, 23:09
Yet another small update:
http://mulder.dummwiedeutsch.de/home/?page=projects#logger




the link is dead can someone post a new link ????

:thanks:

LoRd_MuldeR
19th December 2010, 23:50
the link is dead can someone post a new link ????

:thanks:

Problems with the server :rolleyes:

In the meantime find the download on my Google Code mirror:
http://code.google.com/p/mulder/downloads/

kypec
8th December 2011, 10:00
There was an updated version released in Sep 2011.
Download link @ Google Code: Logger 2011-09-09

Here's an example of batch command encode.bat that I use for logging a bunch of 2-pass x264 encodes running on arbitrary set of input files:@echo off
set tool="%PROGRAMFILES%\AVTools\Simple x264 Launcher\x264.exe"
set options=--preset veryslow --tune film --bitrate 1000 --sar 16:11
rem Evaluate input parameters and supply default values if missing
set filemask=%1
if "%filemask%" == "" set filemask=*.avs
set logfile=%2
if "%logfile%" == "" set logfile=x264_log.txt

for %%a in (%filemask%) do (
rem First pass needs only the minimum information to be logged
logger.exe -format raw -filter "encoded" -invert -log "%logfile%" -append : %tool% %options% --pass 1 --output NUL %%a
rem Second pass log will be complete
logger.exe -format raw -filter "%%]" -log "%logfile%" -append : %tool% %options% --pass 2 --output %%~na.264 %%a
)


Usage example - put the batch file to same directory where your input files reside and run it like this (logger executable must be placed somewhere in your PATH or change path to it accordingly if needed):encode.bat xyz???.avs mylogfile.txt

Chumbo
17th March 2013, 19:20
Yet another small update:

http://img822.imageshack.us/img822/4205/cwindowssystem32cmdexe2.png
I love this utility and am wondering if there's any chance to update it so the -filter allows the use of regular expressions? So e.g.,logger.exe -filter "^Progress:.*%$" ...
The above would filter out where the line starts with "Progress:" followed by any characters until a "%" is hit at the end ($) of the line. Thanks for considering it.

LoRd_MuldeR
18th March 2013, 15:28
Support for RegExp would certainly be desirable.

But as this tool was written in Delphi 7, I cannot use QRegExp from Qt framework, which normally would be my choice.

I will probably re-write this tool in proper C++ with some Qt stuff in a not too distant future ;)

Chumbo
18th March 2013, 19:42
That would be fantastic. Thank you.

LoRd_MuldeR
24th March 2013, 00:49
Okay, here is a new version (still very incomplete) that is implemented in C++/Qt and that can do filtering with regular expressions!

We should now be able to do something like:
LoggingUtil.exe --regexp-skip "(indexing|\d+/\d+ frames)" : x264.exe -o Output.mkv Input.avs

Note that the string will be skipped/kept if any sub-string of it matches the given regular expression. To match the complete string, you need to use "^foobar$".

For details, please check:
http://qt-project.org/doc/qt-4.8/qregexp.html#details

Chumbo
24th March 2013, 03:00
You're a freakin' machine! :) Will try it first chance I get. Thank you.

LoRd_MuldeR
24th March 2013, 21:58
Okay, here is a more feature complete version ;)
http://code.google.com/p/mulder/downloads/detail?name=Logger.2013-03-25.zip&can=2&q=

Logging Utility v2.03, built Mar 25 2013 23:25:26 (using Qt v4.8.4)
Copyright (c) 2010-2013 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.
Please visit http://www.muldersoft.com/ for news and updates!

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License <http://www.gnu.org/>.
Note that this program is distributed with ABSOLUTELY NO WARRANTY.

Usage Mode #1:
LoggingUtil.exe SomeProgram.exe [program parameters]
LoggingUtil.exe [logging options] : SomeProgram.exe [program parameters]

Usage Mode #2:
SomeProgram.exe [parameters] | LoggingUtil.exe [options] : #STDIN#
SomeProgram.exe [parameters] 2>&1 | LoggingUtil.exe [options] : #STDIN#

Logging Options:
--logfile <logfile> Specifies the output log file (appends if file exists)
--only-stdout Capture only output from STDOUT, ignores STDERR
--only-stderr Capture only output from STDERR, ignores STDOUT
--no-simplify Do NOT simplify/trimm the logged strings (default: on)
--no-append Do NOT append, i.e. any existing log content is lost
--plain-output Create less verbose logging output
--html-output Create HTML logging output, implies NO append
--regexp-keep <exp> Keep ONLY strings that match the given RegExp
--regexp-skip <exp> Skip all the strings that match the given RegExp
--codec-in <name> Setup the input text encoding (default: "UTF-8")
--codec-out <name> Setup the output text encoding (default: "UTF-8")

Examples:
LoggingUtil.exe --logfile x264_log.txt : x264.exe -o output.mkv input.avs
x264.exe -o output.mkv input.avs 2>&1 | LoggingUtil.exe : #STDIN#

RegExp example for x264:
LoggingUtil.exe --regexp-skip "(indexing|\d+/\d+ frames)" : x264.exe -o Output.mkv Input.avs

Chumbo
25th March 2013, 03:48
You've been a busy, busy, bee. ;) The earlier version worked great by the way. Thank you for the latest improvements. The new features look great.

LoRd_MuldeR
25th March 2013, 23:40
Another small update: Added HTML output option.

Also new version is now compiled with the static Qt library, so we don't need QtCore4.dll and MSVCRT libraries.

(Updated post above)

AYColumbia
19th September 2015, 17:46
Thanks for this great tool. I use it all the time with x264 and x265 now. I ran into a bit of a snag though as I need to use a regex with regex characters, i.e., I need to filter "[E]" for example but the brackets are regex characters. I tried to escape them, e.g., "(^\[E\].*%\].*$)" but that didn't work. Would appreciate your guidance here. Thank you.

[EDIT] I thought a bit more detail may help. Here's the regex for skipping what I want and some examples of the lines below it that I want skipped/not logged: --regexp-skip "(^.*%.*\sframes\s.*\sfps\s.*\seta.*$)"
[E] [2015-09-19] [11:50:33] [0.1%] 1/1443 frames, 0.74 fps, 328.81 kb/s, eta 0:32:31
[E] [2015-09-19] [11:50:33] [0.4%] 6/1443 frames, 3.74 fps, 80.47 kb/s, eta 0:06:23
[E] [2015-09-19] [11:50:33] [0.6%] 9/1443 frames, 4.78 fps, 64.01 kb/s, eta 0:04:59
[E] [2015-09-19] [11:50:33] [1.0%] 14/1443 frames, 5.91 fps, 52.28 kb/s, eta 0:04:01
[E] [2015-09-19] [11:50:34] [1.3%] 19/1443 frames, 6.56 fps, 46.77 kb/s, eta 0:03:37
[E] [2015-09-19] [11:50:34] [1.4%] 20/1443 frames, 6.20 fps, 46.00 kb/s, eta 0:03:49
[E] [2015-09-19] [11:50:35] [1.6%] 23/1443 frames, 6.56 fps, 120.50 kb/s, eta 0:03:36

I'd like to include the "[E]" at the beginning too if at all possible. Right now even what I'm using above isn't working.

BTW, your simplified example works fine, i.e., --regexp-skip "(\d+/\d+ frames)" so I'm using that for now. :)

LoRd_MuldeR
20th September 2015, 13:05
First of all I think a construct like "^.*Foo" is pretty pointless. With the ^ prefix you are saying that the expression has to match at the beginning of the string. But then the .* allows any possible character sequence (even empty one) between the beginning of the string and the Foo. In other words, you allow Foo to match anywhere in the string. So your whole Regex could be simplified to just "Foo". Or am I missing something?

Secondly, the "--regexp-skip" options skips all input lines, i.e. lines produced by the source application, where the given Regex matches. It does not have to match the entire line! If it matches anywhere in the line, then this line is skipped. Of course, if you only want lines to be skipped that completely match the given Regex, then you will need to write a Regex that starts with "^" and ends with "$". This forces the Regex to match on the entire string - or not match at all.

Finally, in the log file, the "[?] [yyyy-MM-dd] [hh:mm:ss]" prefix is added by the LoggingUtil - to all input lines that have not been skipped. If you don't like that prefix to be included, just add the "--plain-output" switch to LoggingUtil command.

AYColumbia
20th September 2015, 20:07
...Finally, in the log file, the "[?] [yyyy-MM-dd] [hh:mm:ss]" prefix is added by the LoggingUtil - to all input lines that have not been skipped. If you don't like that prefix to be included, just add the "--plain-output" switch to LoggingUtil command.
Well duh on my part. Been using the utility for so long that I forgot that info was added by it. :eek: Thank you for the reminder. ;)