View Full Version : Help with printf/regular expression, please!
colinhunt
15th June 2013, 12:02
Whoo boy, it's been a while since I last felt this dumb. (Must be several hours, in fact.)
I'm trying to encode a bunch of TIFF images using x264, but can't wrap my head around how to feed the images to the encoder. I'm sure there's a regular expression or a printf thingy I should use but no matter what I try, I get error messages.
A sampling of filenames:
A004_C014_011375.0001583.tif
A004_C014_011375.0001584.tif
A004_C014_011375.0001585.tif
A004_C014_011375.0001586.tif
and so on. In other words, it's only the last 4 numbers that change.
These don't work, for example:
x264.exe -o output.mkv A004_C014_011375.%07d.tif
x264.exe -o output.mkv A004_C014_011375.000%04d.tif
I also tried to use an Avisynth script as a source, using ImageSource to read the TIFF files, but get only errors.
What's the syntax I should use?
Thank you!
LoRd_MuldeR
15th June 2013, 12:19
Does x264 really support regular expressions in file names on the command-line? Also what I see in your example, is NOT a regular expression (http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#details) :confused:
Anyway, I think for your case the correct ImageSource() call would look like:
ImageSource("A004_C014_011375.%07d.tif", start=1583, end=1586)
If you get errors with ImageSource, what errors do you get?
colinhunt
15th June 2013, 12:33
Does x264 really support regular expressions in file names on the command-line? Also what I see in your example, is NOT a regular expression (http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html#details) :confused:
Yeah but guess what? I haven't got the foggiest idea what I was talking about there. It was the result of a couple of hours of googling and experimenting. Found some pages where people had got those %d thingies to work on the x264 command-line, and others where everyone said x264 does not support them. So that's me stumbling around in the dark, bumping into things with sharp edges.
Anyway, I think for your case the correct ImageSource() call would look like:
ImageSource("A004_C014_011375.%07d.tif", start=1583, end=1586)
If you get errors with ImageSource, what errors do you get?
x264 could not load Avisynth, even though the build I use ought to have support for Avisynth. Anyhoo, thank you for that, I'll give it a shot.
LoRd_MuldeR
15th June 2013, 14:15
x264 could not load Avisynth, even though the build I use ought to have support for Avisynth. Anyhoo, thank you for that, I'll give it a shot.
Do you have Avisynth installed?
Also, be aware that 32-Bit x264 needs 32-Bit Avisynth, while 64-Bit x264 needs (the still experimental) 64-Bit Avisynth. Mixing 32-Bit and 64-Bit is not possible.
If you have 64-Bit x264 and want to use the stable 32-Bit Avisynth, you need to go the avs2yuv (http://komisar.gin.by/tools/avs2yuv/avs2yuv-0.24bm2.zip) route:
avs2yuv.exe c:\foo\bar.avs | x264.exe [options] -demuxer y4m -
colinhunt
15th June 2013, 14:29
Do you have Avisynth installed?
Certainly.
Also, be aware that 32-Bit x264 needs 32-Bit Avisynth, while 64-Bit x264 needs (the still experimental) 64-Bit Avisynth.
Indeed. For some reason the 32-bit builds I had downloaded did not support Avisynth, but then I discovered Komissar's latest 32-build which did.
After a wee bit of experimenting with different workflows, I discovered a working solution involving Apple's ProRes HQ (with a bitrate of 600Mbps in this case) and an .avs script using QTSource. I wanted to see how x264 performs in 4K when it's given only 25mbps to work with.
This was not a good source for testing as there's very little motion but at least it's not copyrighted: http://www.sendspace.com/file/epx9u8
Thanks for taking the time to educate an ignoramus, LoRd_MuldeR.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.