<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using StopWatch = System.Timers.Timer;

using GitHubUpdate;

namespace WebMConverter
{
    public partial class MainForm : Form
    {
        #region FFmpeg argument base strings

        /// <summary>
        /// {0} is output file
        /// {1} is templateArguments
        /// {2} is '-pass X -passlogfile X' if HQ mode enabled, otherwise blank
        /// </summary>
        const string template = " {1}{2} -f webm -y \"{0}\"";

        /// <summary>
        /// {0} is pass number (1 or 2)
        /// {1} is the prefix for the pass .log file
        /// </summary>
        const string passArgument = " -pass {0} -passlogfile \"{1}\"";

        /// <summary>
        /// {0} is '-an' if no audio, otherwise blank
        /// {1} is amount of threads to use
        /// {2} is amount of slices to split the frame into
        /// {3} is ' -metadata title="TITLE"' when specifying a title, otherwise blank
        /// {4} is ' -quality best -lag-in-frames 16 -auto-alt-ref 1' when using HQ mode, otherwise blank
        /// {5} is 'libvpx(-vp9)' changing depending on NGOV mode
        /// {6} is ' -ac 2 -c:a libopus/libvorbis' if audio is enabled, changing depending on NGOV mode
        /// {7} is ' -r XX' if frame rate is modified, otherwise blank
        /// {8} is encoding mode-dependent arguments
        /// </summary>
        const string templateArguments = "{0} -c:v {5} -threads {1} -slices {2}{3}{4}{6}{7}{8}";

        /// <summary>
        /// {0} is video bitrate
        /// {1} is ' -fs XM' if X MB limit enabled otherwise blank
        /// {2} is buffer size (bitrate / 2)
        /// </summary>
        const string constantVideoArguments = " -minrate {0}K -b:v {0}K -maxrate {0}K -bufsize {2}K{1}";
        /// <summary>
        /// {0} is audio bitrate
        /// </summary>
        const string constantAudioArguments = " -b:a {0}K";

        /// <summary>
        /// {0} is qmin
        /// {1} is crf
        /// {2} is qmax
        /// </summary>
        const string variableVideoArguments = " -qmin {0} -crf {1} -qmax {2}";
        /// <summary>
        /// {0} is audio quality scale
        /// </summary>
        const string variableAudioArguments = " -qscale:a {0}";
<commit_msg>Fix constant mode encoding with audio<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.XPath;
using StopWatch = System.Timers.Timer;

using GitHubUpdate;

namespace WebMConverter
{
    public partial class MainForm : Form
    {
        #region FFmpeg argument base strings

        /// <summary>
        /// {0} is output file
        /// {1} is templateArguments
        /// {2} is '-pass X -passlogfile X' if HQ mode enabled, otherwise blank
        /// </summary>
        const string template = " {1}{2} -f webm -y \"{0}\"";

        /// <summary>
        /// {0} is pass number (1 or 2)
        /// {1} is the prefix for the pass .log file
        /// </summary>
        const string passArgument = " -pass {0} -passlogfile \"{1}\"";

        /// <summary>
        /// {0} is '-an' if no audio, otherwise blank
        /// {1} is amount of threads to use
        /// {2} is amount of slices to split the frame into
        /// {3} is ' -metadata title="TITLE"' when specifying a title, otherwise blank
        /// {4} is ' -quality best -lag-in-frames 16 -auto-alt-ref 1' when using HQ mode, otherwise blank
        /// {5} is 'libvpx(-vp9)' changing depending on NGOV mode
        /// {6} is ' -ac 2 -c:a libopus/libvorbis' if audio is enabled, changing depending on NGOV mode
        /// {7} is ' -r XX' if frame rate is modified, otherwise blank
        /// {8} is encoding mode-dependent arguments
        /// </summary>
        const string templateArguments = "{0} -c:v {5} -threads {1} -slices {2}{3}{4}{6}{7}{8}";

        /// <summary>
        /// {0} is video bitrate
        /// {1} is ' -fs XM' if X MB limit enabled otherwise blank
        /// {2} is buffer size (bitrate / 2)
        /// </summary>
        const string constantVideoArguments = " -minrate:v {0}K -b:v {0}K -maxrate:v {0}K -bufsize {2}K{1}";
        /// <summary>
        /// {0} is audio bitrate
        /// </summary>
        const string constantAudioArguments = " -b:a {0}K";

        /// <summary>
        /// {0} is qmin
        /// {1} is crf
        /// {2} is qmax
        /// </summary>
        const string variableVideoArguments = " -qmin {0} -crf {1} -qmax {2}";
        /// <summary>
        /// {0} is audio quality scale
        /// </summary>
        const string variableAudioArguments = " -qscale:a {0}";

{'fraction_non_alphanumeric': 0.1511216056670602, 'fraction_numerical': 0.021251475796930343, 'mean_word_length': 1.9112256586483392, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '853567', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1537, 'n_words': 549}