Small changes in unused code, for cleanup.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2363 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-07 13:37:55 +00:00
commit 69754804a0
2 changed files with 1108 additions and 881 deletions

View file

@ -12,6 +12,8 @@ using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using GreenshotPlugin.UnmanagedHelpers;
using System.Collections.Generic;
using System.IO;
namespace Greenshot.Helpers {
@ -72,7 +74,9 @@ namespace Greenshot.Helpers {
/// method.</para></remarks>
///
public int Width {
get { return width; }
get {
return width;
}
}
/// <summary>
@ -84,7 +88,9 @@ namespace Greenshot.Helpers {
/// method.</para></remarks>
///
public int Height {
get { return height; }
get {
return height;
}
}
/// <summary>
@ -94,9 +100,10 @@ namespace Greenshot.Helpers {
/// <remarks><para>The property tell current position in video stream, which actually equals
/// to the amount of frames added using <see cref="AddFrame"/> method.</para></remarks>
///
public int Position
{
get { return position; }
public int Position {
get {
return position;
}
}
/// <summary>
@ -110,10 +117,13 @@ namespace Greenshot.Helpers {
///
/// <para>Default frame rate is set to <b>25</b>.</para></remarks>
///
public int FrameRate
{
get { return rate; }
set { rate = value; }
public int FrameRate {
get {
return rate;
}
set {
rate = value;
}
}
/// <summary>
@ -127,10 +137,13 @@ namespace Greenshot.Helpers {
///
/// <para>Default video codec is set <b>"DIB "</b>, which means no compression.</para></remarks>
///
public string Codec
{
get { return codec; }
set { codec = value; }
public string Codec {
get {
return codec;
}
set {
codec = value;
}
}
/// <summary>
@ -144,10 +157,13 @@ namespace Greenshot.Helpers {
///
/// <para>Default value is set to <b>-1</b> - default compression quality of the codec.</para></remarks>
///
public int Quality
{
get { return quality; }
set { quality = value; }
public int Quality {
get {
return quality;
}
set {
quality = value;
}
}
/// <summary>
@ -168,7 +184,8 @@ namespace Greenshot.Helpers {
///
/// <remarks>Initializes Video for Windows library.</remarks>
///
public AVIWriter(string codec) : this() {
public AVIWriter(string codec)
: this() {
this.codec = codec;
}
@ -226,12 +243,8 @@ namespace Greenshot.Helpers {
lock (this) {
// calculate stride
stride = width * 4;
if ((stride % 4) != 0)
if ((stride % 4) != 0) {
stride += (4 - stride % 4);
// create new file
if (Avi32.AVIFileOpen(out file, fileName, Avi32.OpenFileMode.Create | Avi32.OpenFileMode.Write, IntPtr.Zero) != 0) {
throw new ApplicationException("Failed opening file");
}
this.width = width;
@ -240,6 +253,8 @@ namespace Greenshot.Helpers {
// describe new stream
Avi32.AVISTREAMINFO info = new Avi32.AVISTREAMINFO();
LOG.InfoFormat("Available codecs: {0}", String.Join(", ", Avi32.AvailableCodecs.ToArray()));
info.type = Avi32.mmioFOURCC("vids");
if (codec != null) {
info.handler = Avi32.mmioFOURCC(codec);
@ -250,44 +265,70 @@ namespace Greenshot.Helpers {
info.rate = rate;
info.suggestedBufferSize = stride * height;
// describe compression options
Avi32.AVICOMPRESSOPTIONS options = new Avi32.AVICOMPRESSOPTIONS();
try {
// create new file
if (Avi32.AVIFileOpen(out file, fileName, Avi32.OpenFileMode.Create | Avi32.OpenFileMode.Write, IntPtr.Zero) != 0) {
throw new ApplicationException("Failed opening file");
}
// create stream
if (Avi32.AVIFileCreateStream(file, out stream, ref info) != 0) {
throw new ApplicationException("Failed creating stream");
}
// describe compression options
Avi32.AVICOMPRESSOPTIONS options = new Avi32.AVICOMPRESSOPTIONS();
// uncomment if video settings dialog is required to show
int retCode = 0;
if (codec == null) {
retCode = Avi32.AVISaveOptions( stream, ref options );
retCode = Avi32.AVISaveOptions(stream, ref options);
if (retCode == 0) {
LOG.Debug("Cancel clicked!");
return false;
}
codec = Avi32.decode_mmioFOURCC(options.handler);
quality = options.quality;
} else {
options.handler = Avi32.mmioFOURCC(codec);
options.quality = quality;
}
LOG.DebugFormat("Codec {0} selected with quality {1}.", codec, quality);
AviError retval;
// create compressed stream
int retval = Avi32.AVIMakeCompressedStream(out streamCompressed, stream, ref options, IntPtr.Zero);
if (retval != 0) {
throw new ApplicationException("Failed creating compressed stream: " + retval);
try {
retval = Avi32.AVIMakeCompressedStream(out streamCompressed, stream, ref options, IntPtr.Zero);
} catch (Exception exCompress) {
LOG.Warn("Couldn't use compressed stream.", exCompress);
retval = AviError.AVIERR_OK;
}
if (retval != AviError.AVIERR_OK) {
throw new ApplicationException(string.Format("Failed creating compressed stream: {0}", retval));
}
// describe frame format
BitmapInfoHeader bitmapInfoHeader = new BitmapInfoHeader(width, height, 32);
// set frame format
if (streamCompressed != IntPtr.Zero) {
retval = Avi32.AVIStreamSetFormat(streamCompressed, 0, ref bitmapInfoHeader, Marshal.SizeOf(bitmapInfoHeader.GetType()));
} else {
retval = Avi32.AVIStreamSetFormat(stream, 0, ref bitmapInfoHeader, Marshal.SizeOf(bitmapInfoHeader.GetType()));
}
if (retval != 0) {
throw new ApplicationException("Failed creating compressed stream: "+ retval);
throw new ApplicationException(string.Format("Failed creating stream: {0}", retval));
}
position = 0;
return true;
} catch (Exception ex) {
Close();
Avi32.AVIFileExit();
if (File.Exists(fileName)) {
File.Delete(fileName);
}
throw ex;
}
}
}
@ -350,19 +391,19 @@ namespace Greenshot.Helpers {
/// <remarks>The class provides Video for Windows and some other Avi32 functions and structurs.</remarks>
///
internal static class Avi32 {
/// <summary>
/// Copy a block of memory.
/// </summary>
///
/// <param name="dst">Destination pointer.</param>
/// <param name="src">Source pointer.</param>
/// <param name="count">Memory block's length to copy.</param>
///
/// <returns>Return's the value of <b>dst</b> - pointer to destination.</returns>
///
[DllImport("ntdll.dll")]
public static extern int memcpy(int dst, int src, int count);
private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(Avi32));
[DllImport("MSVFW32", CharSet = CharSet.Ansi)]
static extern bool ICInfo(int fccType, int fccHandler, ref ICINFO lpicinfo);
[DllImport("MSVFW32"), PreserveSig]
static extern IntPtr ICOpen(int fccType, int fccHandler, ICMODE wMode);
[DllImport("MSVFW32")]
static extern int ICClose(IntPtr hic);
[DllImport("MSVFW32", CharSet = CharSet.Ansi)]
static extern int ICGetInfo(IntPtr hic, ref ICINFO lpicinfo, int cb);
// --- Video for Windows Functions
@ -370,13 +411,13 @@ namespace Greenshot.Helpers {
/// Initialize the AVIFile library.
/// </summary>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern void AVIFileInit();
/// <summary>
/// Exit the AVIFile library.
/// </summary>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern void AVIFileExit();
/// <summary>
@ -390,8 +431,8 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns zero on success or error code otherwise.</returns>
///
[DllImport("avifil32.dll", CharSet = CharSet.Unicode)]
public static extern int AVIFileOpen(out IntPtr aviHandler, String fileName, OpenFileMode mode, IntPtr handler);
[DllImport("avifil32", CharSet = CharSet.Unicode)]
public static extern AviError AVIFileOpen(out IntPtr aviHandler, String fileName, OpenFileMode mode, IntPtr handler);
/// <summary>
/// Release an open AVI stream.
@ -401,7 +442,7 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns the reference count of the file.</returns>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIFileRelease(IntPtr aviHandler);
/// <summary>
@ -415,7 +456,7 @@ namespace Greenshot.Helpers {
///
/// <returns></returns>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIFileGetStream(IntPtr aviHandler, out IntPtr streamHandler, int streamType, int streamNumner);
/// <summary>
@ -428,7 +469,7 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns zero if successful or an error otherwise.</returns>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIFileCreateStream(IntPtr aviHandler, out IntPtr streamHandler, ref AVISTREAMINFO streamInfo);
/// <summary>
@ -439,7 +480,7 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns the current reference count of the stream.</returns>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIStreamRelease(IntPtr streamHandler);
/// <summary>
@ -453,8 +494,8 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns zero if successful or an error otherwise.</returns>
///
[DllImport("avifil32.dll")]
public static extern int AVIStreamSetFormat(IntPtr streamHandler, int position, ref BitmapInfoHeader format, int formatSize);
[DllImport("avifil32")]
public static extern AviError AVIStreamSetFormat(IntPtr streamHandler, int position, ref BitmapInfoHeader format, int formatSize);
/// <summary>
/// Get the starting sample number for the stream.
@ -464,7 +505,7 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns the number if successful or 1 otherwise.</returns>
///
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIStreamStart(IntPtr streamHandler);
/// <summary>
@ -472,7 +513,7 @@ namespace Greenshot.Helpers {
/// </summary>
/// <param name="streamHandler">Handle to an open stream.</param>
/// <returns>Returns the stream's length, in samples, if successful or -1 otherwise. </returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIStreamLength(IntPtr streamHandler);
/// <summary>
@ -485,7 +526,7 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns zero if successful or an error otherwise.</returns>
///
[DllImport("avifil32.dll", CharSet = CharSet.Unicode)]
[DllImport("avifil32", CharSet = CharSet.Unicode)]
public static extern int AVIStreamInfo(IntPtr streamHandler, ref AVISTREAMINFO streamInfo, int infoSize);
/// <summary>
@ -494,7 +535,7 @@ namespace Greenshot.Helpers {
/// <param name="streamHandler">Pointer to the video stream used as the video source.</param>
/// <param name="wantedFormat">Pointer to a structure that defines the desired video format. Specify NULL to use a default format.</param>
/// <returns>Returns an object that can be used with the <see cref="AVIStreamGetFrame"/> function.</returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern IntPtr AVIStreamGetFrameOpen(IntPtr streamHandler, ref BitmapInfoHeader wantedFormat);
/// <summary>
@ -503,7 +544,7 @@ namespace Greenshot.Helpers {
/// <param name="streamHandler">Pointer to the video stream used as the video source.</param>
/// <param name="wantedFormat">Pointer to a structure that defines the desired video format. Specify NULL to use a default format.</param>
/// <returns>Returns a <b>GetFrame</b> object that can be used with the <see cref="AVIStreamGetFrame"/> function.</returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern IntPtr AVIStreamGetFrameOpen(IntPtr streamHandler, int wantedFormat);
/// <summary>
@ -511,7 +552,7 @@ namespace Greenshot.Helpers {
/// </summary>
/// <param name="getFrameObject">Handle returned from the <see cref="AVIStreamGetFrameOpen(IntPtr,int)"/> function.</param>
/// <returns>Returns zero if successful or an error otherwise.</returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVIStreamGetFrameClose(IntPtr getFrameObject);
/// <summary>
@ -520,7 +561,7 @@ namespace Greenshot.Helpers {
/// <param name="getFrameObject">Pointer to a GetFrame object.</param>
/// <param name="position">Position, in samples, within the stream of the desired frame.</param>
/// <returns>Returns a pointer to the frame data if successful or NULL otherwise.</returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern IntPtr AVIStreamGetFrame(IntPtr getFrameObject, int position);
/// <summary>
@ -537,8 +578,8 @@ namespace Greenshot.Helpers {
///
/// <returns>Returns zero if successful or an error otherwise.</returns>
///
[DllImport("avifil32.dll")]
public static extern int AVIStreamWrite(IntPtr streamHandler, int start, int samples, IntPtr buffer, int bufferSize, int flags, IntPtr samplesWritten, IntPtr bytesWritten);
[DllImport("avifil32")]
public static extern AviError AVIStreamWrite(IntPtr streamHandler, int start, int samples, IntPtr buffer, int bufferSize, int flags, IntPtr samplesWritten, IntPtr bytesWritten);
/// <summary>
/// Retrieve the save options for a file and returns them in a buffer.
@ -549,7 +590,7 @@ namespace Greenshot.Helpers {
/// <param name="streamInterfaces">Pointer to an array of stream interface pointers.</param>
/// <param name="options">Pointer to an array of pointers to AVICOMPRESSOPTIONS structures.</param>
/// <returns>Returns TRUE if the user pressed OK, FALSE for CANCEL, or an error otherwise.</returns>
[DllImport("avifil32.dll")]
[DllImport("avifil32")]
public static extern int AVISaveOptions(IntPtr window, int flags, int streams, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] streamInterfaces, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] options);
/// <summary>
@ -558,8 +599,8 @@ namespace Greenshot.Helpers {
/// <param name="streams">Count of the AVICOMPRESSOPTIONS structures referenced in <b>options</b>.</param>
/// <param name="options">Pointer to an array of pointers to AVICOMPRESSOPTIONS structures.</param>
/// <returns>Returns 0.</returns>
[DllImport("avifil32.dll")]
public static extern int AVISaveOptionsFree(int streams, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] options);
[DllImport("avifil32")]
public static extern AviError AVISaveOptionsFree(int streams, [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] IntPtr[] options);
/// <summary>
/// Create a compressed stream from an uncompressed stream and a
@ -571,18 +612,61 @@ namespace Greenshot.Helpers {
/// <param name="options">Pointer to a structure that identifies the type of compression to use and the options to apply.</param>
/// <param name="clsidHandler">Pointer to a class identifier used to create the stream.</param>
/// <returns>Returns 0 if successful or an error otherwise.</returns>
[DllImport("avifil32.dll")]
public static extern int AVIMakeCompressedStream(out IntPtr compressedStream, IntPtr sourceStream, ref AVICOMPRESSOPTIONS options, IntPtr clsidHandler);
[DllImport("avifil32")]
public static extern AviError AVIMakeCompressedStream(out IntPtr compressedStream, IntPtr sourceStream, ref AVICOMPRESSOPTIONS options, IntPtr clsidHandler);
/// <summary>
/// Code type
/// </summary>
public enum ICMODE {
ICMODE_COMPRESS = 1,
ICMODE_DECOMPRESS = 2,
ICMODE_FASTDECOMPRESS = 3,
ICMODE_QUERY = 4,
ICMODE_FASTCOMPRESS = 5,
ICMODE_DRAW = 8
}
// --- structures
/// <summary>
/// Structor for the codec info
/// See: http://msdn.microsoft.com/en-us/library/windows/desktop/dd743162%28v=vs.85%29.aspx
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ICINFO {
public int dwSize;
public int fccType;
public int fccHandler;
public int dwFlags;
public int dwVersion;
public int dwVersionICM;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
public string szName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string szDescription;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string szDriver;
public ICINFO(int type) {
dwSize = Marshal.SizeOf(typeof(ICINFO));
fccType = type;
fccHandler = 0;
dwFlags = 0;
dwVersion = 0;
dwVersionICM = 0;
szName = null;
szDescription = null;
szDriver = null;
}
}
/// <summary>
/// Structure, which contains information for a single stream .
/// </summary>
///
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 1)]
public struct AVISTREAMINFO
{
public struct AVISTREAMINFO {
/// <summary>
/// Four-character code indicating the stream type.
/// </summary>
@ -721,8 +805,7 @@ namespace Greenshot.Helpers {
/// </summary>
///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct AVICOMPRESSOPTIONS
{
public struct AVICOMPRESSOPTIONS {
/// <summary>
/// Four-character code indicating the stream type.
/// </summary>
@ -835,7 +918,7 @@ namespace Greenshot.Helpers {
/// <returns>Returns the code created from provided characters.</returns>
///
public static int mmioFOURCC(string str) {
return ( ((int)(byte)(str[0])) |
return (((int)(byte)(str[0])) |
((int)(byte)(str[1]) << 8) |
((int)(byte)(str[2]) << 16) |
((int)(byte)(str[3]) << 24));
@ -861,6 +944,34 @@ namespace Greenshot.Helpers {
return new string(chs);
}
/// <summary>
/// Get a list of available codecs.
/// </summary>
/// <returns>List<string></returns>
public static List<string> AvailableCodecs {
get {
List<string> returnValues = new List<string>();
int codecNr = 0;
ICINFO codecInfo = new ICINFO(mmioFOURCC("VIDC"));
bool success = true;
do {
success = ICInfo(codecInfo.fccType, codecNr++, ref codecInfo);
if (success) {
IntPtr hic = ICOpen(codecInfo.fccType, codecInfo.fccHandler, ICMODE.ICMODE_QUERY);
if (hic != IntPtr.Zero) {
ICGetInfo(hic, ref codecInfo, Marshal.SizeOf(codecInfo));
string codecName = decode_mmioFOURCC(codecInfo.fccHandler);
returnValues.Add(codecName);
LOG.DebugFormat("Found codec {0} {4}, with name {1} and description {2}, driver {3}", codecName, codecInfo.szName, codecInfo.szDescription, codecInfo.szDriver, codecInfo.dwVersion);
ICClose(hic);
}
}
} while (success);
return returnValues;
}
}
/// <summary>
/// Version of <see cref="AVISaveOptions(IntPtr, int, int, IntPtr[], IntPtr[])"/> for one stream only.
@ -905,4 +1016,106 @@ namespace Greenshot.Helpers {
return ret;
}
}
/// <summary>
/// AVI Error Codes
/// </summary>
[Flags]
public enum AviError : uint {
/// <summary>
/// Compression is not supported for this type of data.
/// This error might be returned if you try to compress
/// data that is not audio or video.
/// </summary>
AVIERR_UNSUPPORTED = 0x80044065,
/// <summary>
/// The file couldn't be read, indicating a corrupt file or an unrecognized format
/// </summary>
AVIERR_BADFORMAT = 0x80044066,
/// <summary>
/// There is not enough memory to complete the operation.
/// </summary>
AVIERR_MEMORY = 0x80044067,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_INTERNAL = 0x80044068,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_BADFLAGS = 0x80044069,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_BADPARAM = 0x8004406A,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_BADSIZE = 0x8004406B,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_BADHANDLE = 0x8004406C,
/// <summary>
/// A disk error occurred while reading the file
/// </summary>
AVIERR_FILEREAD = 0x8004406D,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_FILEWRITE = 0x8004406E,
/// <summary>
/// A disk error occurred while opening the file
/// </summary>
AVIERR_FILEOPEN = 0x8004406F,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_COMPRESSOR = 0x80044070,
/// <summary>
/// A suitable compressor cannot be found.
/// </summary>
AVIERR_NOCOMPRESSOR = 0x80044071,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_READONLY = 0x80044072,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_NODATA = 0x80044073,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_BUFFERTOOSMALL = 0x80044074,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_CANTCOMPRESS = 0x80044075,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_USERABORT = 0x800440C6,
/// <summary>
///
/// </summary>
// TODO : Put documentation
AVIERR_ERROR = 0x800440C7,
/// <summary>
/// Operation successful
/// </summary>
AVIERR_OK = 0x0
}
}

View file

@ -93,6 +93,11 @@ namespace Greenshot.Helpers {
return exceptionToThrow;
}
/// <summary>
/// Start the recording
/// </summary>
/// <param name="framesPerSecond"></param>
/// <returns></returns>
public bool Start(int framesPerSecond) {
if (recordingWindow != null) {
string windowTitle = Regex.Replace(recordingWindow.Text, @"[^\x20\d\w]", "");
@ -176,8 +181,8 @@ namespace Greenshot.Helpers {
aviWriter = new AVIWriter();
// Comment the following 2 lines to make the user select it's own codec
//aviWriter.Codec = "msvc";
//aviWriter.Quality = 99;
aviWriter.Codec = "msvc";
aviWriter.Quality = 10000;
aviWriter.FrameRate = framesPerSecond;
if (aviWriter.Open(filename, recordingSize.Width, recordingSize.Height)) {
@ -195,6 +200,9 @@ namespace Greenshot.Helpers {
return false;
}
/// <summary>
/// Do the actual frame capture
/// </summary>
private void CaptureFrame() {
int MSBETWEENCAPTURES = 1000/framesPerSecond;
int msToNextCapture = MSBETWEENCAPTURES;
@ -262,6 +270,9 @@ namespace Greenshot.Helpers {
Cleanup();
}
/// <summary>
/// Stop the recording, after the next frame
/// </summary>
public void Stop() {
stop = true;
if (backgroundTask != null) {
@ -269,6 +280,7 @@ namespace Greenshot.Helpers {
}
Cleanup();
}
/// <summary>
/// Free resources
/// </summary>
@ -297,7 +309,9 @@ namespace Greenshot.Helpers {
if (ffmpegexe != null) {
try {
string webMFile = filename.Replace(".avi", ".webm");
ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, "-i \"" + filename + "\" -vcodec libvpx \"" + webMFile + "\"");
string arguments = "-i \"" + filename + "\" -codec:v libvpx -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 42 -maxrate 1000k -bufsize 4000k -threads 4 \"" + webMFile + "\"";
LOG.DebugFormat("Starting {0} with arguments {1}", ffmpegexe, arguments);
ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, arguments);
processStartInfo.CreateNoWindow = false;
processStartInfo.RedirectStandardOutput = false;
processStartInfo.UseShellExecute = false;