theultramage
19th September 2015, 08:54
For some reason, VirtualDub's external encoder engine hardcodes the output colorspace to nsVDPixmap::kPixFormat_YUV420_Planar and there is no way to change that. This means that lossless processing is not possible.
I have fiddled with the source code a bit and located the two offending places:
@@src\VirtualDub\source\DubOutput.cpp:
int VDAVIOutputCLISystem::GetVideoOutputFormatOverride() {
return nsVDPixmap::kPixFormat_YUV420_Planar;
}
@@src\VirtualDub\source\AVIOutputCLI.cpp:
IVDMediaOutputStream *AVIOutputCLI::createVideoStream() {
if (mpVideoOutput)
throw MyError("CLI: Only one video output is supported.");
VDAVIOutputRawVideoFormat rawFormat = {};
rawFormat.mOutputFormat = nsVDPixmap::kPixFormat_YUV420_Planar;
rawFormat.mScanlineAlignment = 1;
It is possible to change these to use "nsVDPixmap::kPixFormat_RGB888", or even make it configurable using "g_dubOpts.video.mOutputFormat". This will allow using full rgb lossless x264
--qp 0 --preset veryslow --output-csp rgb --demuxer raw --input-csp bgr --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) -o "%(tempvideofile)" -
Since getting virtualdub to compile takes a bit of work, I also looked up the file offsets that need to be changed, so that you can just hexedit the official exe. 15 (0F) is yuv420, 7 (07) is rgb888.
VirtualDub-1.10.4.35491-Win32:
0001EE11 0F -> 07
000D0F98 0F -> 07
VirtualDub-1.10.4.35491-AMD64:
0002A4E1 0F -> 07
0011CE48 0F -> 07
I have fiddled with the source code a bit and located the two offending places:
@@src\VirtualDub\source\DubOutput.cpp:
int VDAVIOutputCLISystem::GetVideoOutputFormatOverride() {
return nsVDPixmap::kPixFormat_YUV420_Planar;
}
@@src\VirtualDub\source\AVIOutputCLI.cpp:
IVDMediaOutputStream *AVIOutputCLI::createVideoStream() {
if (mpVideoOutput)
throw MyError("CLI: Only one video output is supported.");
VDAVIOutputRawVideoFormat rawFormat = {};
rawFormat.mOutputFormat = nsVDPixmap::kPixFormat_YUV420_Planar;
rawFormat.mScanlineAlignment = 1;
It is possible to change these to use "nsVDPixmap::kPixFormat_RGB888", or even make it configurable using "g_dubOpts.video.mOutputFormat". This will allow using full rgb lossless x264
--qp 0 --preset veryslow --output-csp rgb --demuxer raw --input-csp bgr --input-res %(width)x%(height) --fps %(fpsnum)/%(fpsden) -o "%(tempvideofile)" -
Since getting virtualdub to compile takes a bit of work, I also looked up the file offsets that need to be changed, so that you can just hexedit the official exe. 15 (0F) is yuv420, 7 (07) is rgb888.
VirtualDub-1.10.4.35491-Win32:
0001EE11 0F -> 07
000D0F98 0F -> 07
VirtualDub-1.10.4.35491-AMD64:
0002A4E1 0F -> 07
0011CE48 0F -> 07