Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++
3.9 KB
Raw Blame
// Headless export probe: runs the production export path (VideoExportJob) on
// one file so frame-timestamp policy can be verified without the GUI. It is a
// diagnostic harness, not a second implementation: features stay disabled so
// the run only exercises decode -> ingress -> encode -> mux -> verify.
//
//   veyra_export_probe <input> <output> [--hevc] [--max-frames N]
//                         [--trim-start seconds] [--trim-end seconds]
//                         [--audio-stream index] [--rate-control cbr|vbr|cq]
//                         [--bitrate-mbps N]
//
// Exit codes: 0 completed, 1 export refused/failed, 2 bad arguments.
#include "veyra/engine/VideoExportJob.h"

#include <atomic>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <string>
#include "veyra/sink/VideoEncoder.h"

int wmain(int argc, wchar_t** argv)
{
    if (argc < 3) {
        std::fwprintf(stderr, L"usage: veyra_export_probe <input> <output> [--hevc] [--video-hdr] [--max-frames N] [--trim-start seconds] [--trim-end seconds] [--audio-stream index] [--rate-control cbr|vbr|cq] [--bitrate-mbps N]\n");
        return 2;
    }
    const std::wstring input = argv[1];
    const std::wstring output = argv[2];
    bool hevc = false, videoHdr = false;
    unsigned maxFrames = 0;
    double trimStart = 0.0, trimEnd = 0.0;
    int audioStream = -1;
    auto rateControl = veyra::sink::ExportRateControl::Cq;
    unsigned bitrateMbps = 0;
    for (int i = 3; i < argc; ++i) {
        const std::wstring arg = argv[i];
        if (arg == L"--hevc") {
            hevc = true;
        } else if (arg == L"--video-hdr") {
            videoHdr = true;
        } else if (arg == L"--max-frames" && i + 1 < argc) {
            maxFrames = unsigned(std::wcstoul(argv[++i], nullptr, 10));
        } else if (arg == L"--trim-start" && i + 1 < argc) {
            trimStart = std::wcstod(argv[++i], nullptr);
        } else if (arg == L"--trim-end" && i + 1 < argc) {
            trimEnd = std::wcstod(argv[++i], nullptr);
        } else if (arg == L"--audio-stream" && i + 1 < argc) {
            audioStream = int(std::wcstol(argv[++i], nullptr, 10));
        } else if (arg == L"--rate-control" && i + 1 < argc) {
            const std::wstring value = argv[++i];
            if (value == L"cbr") rateControl = veyra::sink::ExportRateControl::Cbr;
            else if (value == L"vbr") rateControl = veyra::sink::ExportRateControl::Vbr;
            else if (value == L"cq") rateControl = veyra::sink::ExportRateControl::Cq;
            else {
                std::fwprintf(stderr, L"invalid rate control: %ls\n", value.c_str());
                return 2;
            }
        } else if (arg == L"--bitrate-mbps" && i + 1 < argc) {
            bitrateMbps = unsigned(std::wcstoul(argv[++i], nullptr, 10));
            if (bitrateMbps > 300) {
                std::fwprintf(stderr, L"bitrate must be 0..300 Mbps\n");
                return 2;
            }
        } else {
            std::fwprintf(stderr, L"unknown argument: %ls\n", arg.c_str());
            return 2;
        }
    }

    veyra::engine::PlayerOptions options; // nr/sr/fg all off: decode -> encode only
    options.settings.videoHdr.enabled = videoHdr;
    options.exportStartSeconds = trimStart;
    options.exportEndSeconds = trimEnd;
    options.audioStreamIndex = audioStream;
    options.exportRateControl = rateControl;
    options.settings.exportBitrateMbps = bitrateMbps;
    if (rateControl != veyra::sink::ExportRateControl::Cq && bitrateMbps == 0) {
        std::fwprintf(stderr, L"CBR/VBR require --bitrate-mbps N\n");
        return 2;
    }
    std::atomic<bool> cancel{false};
    const bool ok = veyra::engine::exportVideo(input, output, options, hevc, cancel,
        [](double progress, const std::wstring& message) {
            std::wprintf(L"[%5.1f%%] %ls\n", progress * 100.0, message.c_str());
            std::fflush(stdout);
        },
        maxFrames);
    std::wprintf(L"export result=%ls\n", ok ? L"ok" : L"failed");
    return ok ? 0 : 1;
}