public void Open() { _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart); ffmpeg.net.AVSampleFormat eAVSampleFormat; switch (Preferences.nAudioBitDepth) { case 32: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32; break; case 16: default: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16; break; } int nAudioChannelsQty = Preferences.nAudioChannelsQty; switch (Preferences.nAudioChannelsQty) { case 8: nAudioChannelsQty = 2; break; } _cFormat = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat); nFramesTotal = _cFile.nFramesQty; //_cFile.Prepare(nDuration); _cFile.Prepare(null, _cFormat); }
public void Open(MergingMethod stMergingMethod, ffmpeg.net.File.Input.PlaybackMode ePlaybackMode) { // TODO нужно выцеплять размеры кадра из видео. _bClosed = false; if (null == _cFile) { _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart); } (new Logger()).WriteDebug("[video_file open " + GetHashCode() + "][ffmpeg_file " + _cFile.GetHashCode() + "]"); //Area stDeviceArea = Baetylus.Helper.stCurrentBTLArea; _cFormatVideo = new ffmpeg.net.Format.Video(stArea.nWidth, stArea.nHeight, ffmpeg.net.PixelFormat.AV_PIX_FMT_BGRA, ffmpeg.net.AVFieldOrder.AV_FIELD_TT); short nTop = stArea.nTop; ushort nHei = stArea.nHeight; if (stArea.nTop < 0) // если верх выше границы, то не будем копировать лишние строки в пиксельсмэп { nTop = 0; } if (nTop < stContainerArea.nHeight && stArea.nHeight + stArea.nTop > stContainerArea.nHeight) // если низ ниже, то не будем копировать лишние строки в пиксельсмэп { nHei = (ushort)(stContainerArea.nHeight - (ushort)nTop); } stPixelArea = new Area(stArea.nLeft, nTop, stArea.nWidth, nHei); _cPMDuo = new PixelsMap.Triple(stMergingMethod, stPixelArea, PixelsMap.Format.BGRA32, true, Baetylus.PixelsMapDispose); ffmpeg.net.AVSampleFormat eAVSampleFormat; switch (Preferences.nAudioBitDepth) { case 32: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32; break; case 16: default: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16; break; } int nAudioChannelsQty = Preferences.nAudioChannelsQtyFfmpeg; _cFormatAudio = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat); nFramesTotal = _cFile.nFramesQty; //_cFile.Prepare(nDuration); _cFile.Prepare(_cFormatVideo, _cFormatAudio, ePlaybackMode); }
public void Open(ffmpeg.net.File.Input.PlaybackMode ePlaybackMode) { _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart); ffmpeg.net.AVSampleFormat eAVSampleFormat; switch (Preferences.nAudioBitDepth) { case 32: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32; break; case 16: default: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16; break; } int nAudioChannelsQty = Preferences.nAudioChannelsQtyFfmpeg; _cFormat = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat); nFramesTotal = _cFile.nFramesQty; //_cFile.Prepare(nDuration); _cFile.Prepare(null, _cFormat, ePlaybackMode); }
public int VideoFramesQtyGet(string sFilenameFull) { try { ffmpeg.net.File.Input cFile = new ffmpeg.net.File.Input(sFilenameFull); ulong nFQ = cFile.nFramesQty; cFile.Dispose(); return (int)nFQ; } catch (Exception ex) { (new Logger()).WriteError(ex); } return -1; }
public void Open(bool bCUDA) { // TODO нужно выцепл¤ть размеры кадра из видео. _bClosed = false; if (null == _cFile) { _cFile = new ffmpeg.net.File.Input(_sFile, nFrameStart); } (new Logger()).WriteDebug("[video_file " + GetHashCode() + "][ffmpeg_file " + _cFile.GetHashCode() + "]"); Area stDeviceArea = Baetylus.Helper.cBoard.stArea; _cFormatVideo = new ffmpeg.net.Format.Video(stArea.nWidth, stArea.nHeight, ffmpeg.net.PixelFormat.AV_PIX_FMT_BGRA); _cPixelsMap = new PixelsMap(bCUDA, stArea, PixelsMap.Format.BGRA32); _cPixelsMap.bBackgroundClear = true; _cPixelsMap.bKeepAlive = true; ffmpeg.net.AVSampleFormat eAVSampleFormat; switch (Preferences.nAudioBitDepth) { case 32: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S32; break; case 16: default: eAVSampleFormat = ffmpeg.net.AVSampleFormat.AV_SAMPLE_FMT_S16; break; } int nAudioChannelsQty = Preferences.nAudioChannelsQty; switch (Preferences.nAudioChannelsQty) { case 8: nAudioChannelsQty = 2; break; } _cFormatAudio = new ffmpeg.net.Format.Audio((int)Preferences.nAudioSamplesRate, nAudioChannelsQty, eAVSampleFormat); nFramesTotal = _cFile.nFramesQty; //_cFile.Prepare(nDuration); _cFile.Prepare(_cFormatVideo, _cFormatAudio); }