2014-05-12 10:58:10 +12:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2015-08-13 13:07:38 +12:00
|
|
|
|
Copyright (c) 2007-2015 ShareX Team
|
2014-05-12 10:58:10 +12:00
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
|
|
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
2015-09-13 08:32:51 +12:00
|
|
|
|
using ShareX.HelpersLib;
|
2014-05-12 10:58:10 +12:00
|
|
|
|
using System;
|
|
|
|
|
|
2014-12-11 09:25:20 +13:00
|
|
|
|
namespace ShareX.ScreenCaptureLib
|
2014-05-12 10:58:10 +12:00
|
|
|
|
{
|
|
|
|
|
public class FFmpegOptions
|
|
|
|
|
{
|
2014-05-12 13:13:42 +12:00
|
|
|
|
// General
|
2015-09-13 08:32:51 +12:00
|
|
|
|
public bool OverrideCLIPath { get; set; }
|
|
|
|
|
public string CLIPath { get; set; }
|
2014-05-13 20:44:35 +12:00
|
|
|
|
public string VideoSource { get; set; }
|
|
|
|
|
public string AudioSource { get; set; }
|
2014-05-12 10:58:10 +12:00
|
|
|
|
public FFmpegVideoCodec VideoCodec { get; set; }
|
2014-05-13 20:44:35 +12:00
|
|
|
|
public FFmpegAudioCodec AudioCodec { get; set; }
|
|
|
|
|
public string UserArgs { get; set; }
|
2014-06-04 11:18:41 +12:00
|
|
|
|
public bool UseCustomCommands { get; set; }
|
|
|
|
|
public string CustomCommands { get; set; }
|
2015-06-01 22:57:37 +12:00
|
|
|
|
public bool ShowError { get; set; }
|
2014-05-12 10:58:10 +12:00
|
|
|
|
|
2015-06-01 22:57:37 +12:00
|
|
|
|
// Video
|
|
|
|
|
public FFmpegPreset x264_Preset { get; set; }
|
2014-05-13 23:50:31 +12:00
|
|
|
|
public int x264_CRF { get; set; }
|
2015-05-16 12:21:59 +12:00
|
|
|
|
public int VPx_bitrate { get; set; } // kbit/s
|
2014-05-13 23:50:31 +12:00
|
|
|
|
public int XviD_qscale { get; set; }
|
2015-06-09 06:19:30 +12:00
|
|
|
|
public FFmpegPaletteGenStatsMode GIFStatsMode { get; set; }
|
|
|
|
|
public FFmpegPaletteUseDither GIFDither { get; set; }
|
2014-05-13 23:50:31 +12:00
|
|
|
|
|
|
|
|
|
// Audio
|
2014-05-15 09:34:35 +12:00
|
|
|
|
public int AAC_bitrate { get; set; } // kbit/s
|
2014-05-13 23:50:31 +12:00
|
|
|
|
public int Vorbis_qscale { get; set; }
|
|
|
|
|
public int MP3_qscale { get; set; }
|
2014-05-12 10:58:10 +12:00
|
|
|
|
|
2015-09-13 08:32:51 +12:00
|
|
|
|
public string FFmpegPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
#if STEAM
|
|
|
|
|
if (!OverrideCLIPath)
|
|
|
|
|
{
|
|
|
|
|
if (NativeMethods.Is64Bit())
|
|
|
|
|
{
|
|
|
|
|
return Helpers.GetAbsolutePath("ffmpeg-x64.exe");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return Helpers.GetAbsolutePath("ffmpeg.exe");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return CLIPath;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-09 10:55:45 +12:00
|
|
|
|
public string Extension
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2015-07-02 05:46:14 +12:00
|
|
|
|
if (!VideoSource.Equals(FFmpegHelper.SourceNone, StringComparison.InvariantCultureIgnoreCase))
|
2015-06-09 10:55:45 +12:00
|
|
|
|
{
|
2015-07-02 05:46:14 +12:00
|
|
|
|
switch (VideoCodec)
|
|
|
|
|
{
|
|
|
|
|
case FFmpegVideoCodec.libx264:
|
|
|
|
|
case FFmpegVideoCodec.libx265:
|
|
|
|
|
case FFmpegVideoCodec.gif:
|
|
|
|
|
return "mp4";
|
|
|
|
|
case FFmpegVideoCodec.libvpx:
|
|
|
|
|
return "webm";
|
|
|
|
|
case FFmpegVideoCodec.libxvid:
|
|
|
|
|
return "avi";
|
|
|
|
|
}
|
2015-06-09 10:55:45 +12:00
|
|
|
|
}
|
2015-07-02 05:46:14 +12:00
|
|
|
|
else if (!AudioSource.Equals(FFmpegHelper.SourceNone, StringComparison.InvariantCultureIgnoreCase))
|
|
|
|
|
{
|
|
|
|
|
switch (AudioCodec)
|
|
|
|
|
{
|
|
|
|
|
case FFmpegAudioCodec.libvoaacenc:
|
|
|
|
|
return "m4a";
|
|
|
|
|
case FFmpegAudioCodec.libvorbis:
|
|
|
|
|
return "ogg";
|
|
|
|
|
case FFmpegAudioCodec.libmp3lame:
|
|
|
|
|
return "mp3";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "mp4";
|
2015-06-09 10:55:45 +12:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-29 20:34:12 +12:00
|
|
|
|
public bool IsSourceSelected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return IsVideoSourceSelected || IsAudioSourceSelected;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsVideoSourceSelected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return !string.IsNullOrEmpty(VideoSource) && !VideoSource.Equals(FFmpegHelper.SourceNone, StringComparison.InvariantCultureIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsAudioSourceSelected
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2015-07-02 05:46:14 +12:00
|
|
|
|
return !string.IsNullOrEmpty(AudioSource) && !AudioSource.Equals(FFmpegHelper.SourceNone, StringComparison.InvariantCultureIgnoreCase) &&
|
|
|
|
|
(!IsVideoSourceSelected || VideoCodec != FFmpegVideoCodec.gif);
|
2014-08-29 20:34:12 +12:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-12 10:58:10 +12:00
|
|
|
|
public FFmpegOptions()
|
|
|
|
|
{
|
2014-05-12 13:13:42 +12:00
|
|
|
|
// General
|
2015-09-13 08:32:51 +12:00
|
|
|
|
OverrideCLIPath = false;
|
2014-08-29 20:22:51 +12:00
|
|
|
|
VideoSource = FFmpegHelper.SourceGDIGrab;
|
|
|
|
|
AudioSource = FFmpegHelper.SourceNone;
|
2014-05-12 10:58:10 +12:00
|
|
|
|
VideoCodec = FFmpegVideoCodec.libx264;
|
2014-05-15 09:34:35 +12:00
|
|
|
|
AudioCodec = FFmpegAudioCodec.libvoaacenc;
|
2014-05-13 20:44:35 +12:00
|
|
|
|
UserArgs = "";
|
2014-05-21 04:12:52 +12:00
|
|
|
|
ShowError = true;
|
2014-05-12 13:13:42 +12:00
|
|
|
|
|
2015-06-01 22:57:37 +12:00
|
|
|
|
// Video
|
2014-05-27 22:36:37 +12:00
|
|
|
|
x264_CRF = 30;
|
2015-06-01 22:57:37 +12:00
|
|
|
|
x264_Preset = FFmpegPreset.veryfast;
|
|
|
|
|
VPx_bitrate = 3000;
|
|
|
|
|
XviD_qscale = 10;
|
2015-06-09 06:19:30 +12:00
|
|
|
|
GIFStatsMode = FFmpegPaletteGenStatsMode.full;
|
|
|
|
|
GIFDither = FFmpegPaletteUseDither.sierra2_4a;
|
2014-05-13 23:50:31 +12:00
|
|
|
|
|
2014-05-15 00:08:51 +12:00
|
|
|
|
// Audio
|
2014-05-27 22:36:37 +12:00
|
|
|
|
AAC_bitrate = 128;
|
2014-05-13 23:50:31 +12:00
|
|
|
|
Vorbis_qscale = 3;
|
2014-05-14 23:18:18 +12:00
|
|
|
|
MP3_qscale = 4;
|
2014-05-12 10:58:10 +12:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|