You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to rebuild the video I divided into frames. Below is my code:
`using System.Resources;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xabe.FFmpeg;
using Xabe.FFmpeg.Downloader;
using System.Collections;
using static System.Net.WebRequestMethods;
using System.Runtime.InteropServices;
namespace TestingFFmpeg
{
class Program
{
static void Main(string[] args)
{
Run().GetAwaiter().GetResult();
}
private static async Task Run()
{
//First download and install FFmpeg into the folder
string outputFolder = nameof(TestingFFmpeg) + GetCurrentTime();
string convertedVideoDir, testOutputFolder, ffmpegFolder;
CreateTemporaryFolders(outputFolder, out convertedVideoDir, out testOutputFolder, out ffmpegFolder);
await FFmpegDownloader.GetLatestVersion(FFmpegVersion.Official, ffmpegFolder);
FFmpeg.SetExecutablesPath(ffmpegFolder);
Console.WriteLine("FFmpeg is downloaded");
//Read the video file
string testFilePath = Path.Combine("C:\\Work and files\\Cloud Computing Project\\TestingOfFFmpeg\\TestingFFmpeg\\TestingFiles", "circle.mp4");
string fileName = Path.GetFileName(testFilePath);
Console.WriteLine($"Found the file named {fileName}");
//Turn Video into images
Func<string, string> outputFileNameBuilder = (number) => { return convertedVideoDir + "\\fileNameNo" + number + ".png"; };
IMediaInfo info = await FFmpeg.GetMediaInfo(testFilePath).ConfigureAwait(false);
IVideoStream videoStream = info.VideoStreams.First()?.SetCodec(VideoCodec.png);
IConversionResult conversionResult = await FFmpeg.Conversions.New().AddStream(videoStream).ExtractEveryNthFrame(2, outputFileNameBuilder).SetOutput(convertedVideoDir).Start();
//Turn images into Video
List<string> files = Directory.EnumerateFiles(convertedVideoDir).ToList();
IConversion conversion = new Conversion();
//await imageToVideo.SetInputFrameRate(1).BuildVideoFromImages(files).SetInputFrameRate(1).SetFrameRate(25).SetOutput(Path.Combine(testFilePath, "outputfile.avi")).Start();
//await FFmpeg.Conversions.New().SetInputFrameRate(1).BuildVideoFromImages(files).SetFrameRate(36).SetPixelFormat(PixelFormat.yuv420p).SetOutput(Path.Combine(testFilePath, "outputfile.mp4")).Start();
//await FFmpeg.Conversions.New().SetInputFrameRate(1).SetFrameRate(15).BuildVideoFromImages(files).SetOutput(Path.Combine(testFilePath, "outputFile.mp4")).SetPixelFormat(PixelFormat.yuv420p).SetOutputFormat(Format.mp4).SetOverwriteOutput(true).Start();
await FFmpeg.Conversions.New().BuildVideoFromImages(files).SetFrameRate(15).SetOverwriteOutput(true).SetOutputFormat(Format.mp4).SetVideoBitrate(2600000).SetPixelFormat(PixelFormat.yuv420p).SetOutput(Path.Combine(testFilePath, "outputFile.mp4")).SetOutputFormat(Format.mp4).Start();
}
private static void CreateTemporaryFolders(string outputFolder, out string convertedVideoDir, out string testOutputFolder, out string ffmpegFolder)
{
MakeDirectoryIfRequired(outputFolder);
convertedVideoDir = Path.Combine(outputFolder, "Converted");
MakeDirectoryIfRequired(convertedVideoDir);
testOutputFolder = Path.Combine(outputFolder, "TEST");
MakeDirectoryIfRequired(testOutputFolder);
ffmpegFolder = Path.Combine(outputFolder, "FFmpeg");
MakeDirectoryIfRequired(ffmpegFolder);
}
private static void MakeDirectoryIfRequired(string path)
{
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
}
private static string GetCurrentTime()
{
var currentTime = DateTime.Now.ToString();
var timeWithoutSpace = currentTime.Split();
var timeWithUnderScore = string.Join("_", timeWithoutSpace);
var timeWithoutColon = timeWithUnderScore.Replace(':', '-');
var timeWithoutSlash = timeWithoutColon.Replace('/', '-');
return timeWithoutSlash;
}
}
}
`
But it is showing this error:
FFmpegNoSuitableOutputFormatFoundException: ffmpeg version 4.4.1-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.2.0 (Rev1, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[lrc @ 0000016e5d3ed0c0] Format lrc detected only with low score of 5, misdetection possible!
Input #0, lrc, from 'C:\Users\Mashnunul':
Duration: N/A, bitrate: N/A
Stream #0:0: Subtitle: text
[NULL @ 0000016e5d3f02c0] Unable to find a suitable output format for 'Huq'
Huq: Invalid argument
The text was updated successfully, but these errors were encountered:
This line looks strange:
IConversionResult conversionResult = await FFmpeg.Conversions.New().AddStream(videoStream).ExtractEveryNthFrame(2, outputFileNameBuilder).SetOutput(convertedVideoDir).Start();
The output is already defined in the ExtractEveryNthFrame method.
Try to delete 'SetOutput'. The directory name should be included in the 'outFileNameBuilder'.
I am trying to rebuild the video I divided into frames. Below is my code:
`using System.Resources;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Xabe.FFmpeg;
using Xabe.FFmpeg.Downloader;
using System.Collections;
using static System.Net.WebRequestMethods;
using System.Runtime.InteropServices;
namespace TestingFFmpeg
{
class Program
{
static void Main(string[] args)
{
}
}
`
But it is showing this error:
FFmpegNoSuitableOutputFormatFoundException: ffmpeg version 4.4.1-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11.2.0 (Rev1, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[lrc @ 0000016e5d3ed0c0] Format lrc detected only with low score of 5, misdetection possible!
Input #0, lrc, from 'C:\Users\Mashnunul':
Duration: N/A, bitrate: N/A
Stream #0:0: Subtitle: text
[NULL @ 0000016e5d3f02c0] Unable to find a suitable output format for 'Huq'
Huq: Invalid argument
The text was updated successfully, but these errors were encountered: