Xabe.FFmpeg
Xabe.FFmpeg copied to clipboard
Snapshot not working
I have simple use of lib but not getting snapshot in windows and ubuntu.
using System;
using System.IO;
using System.Threading.Tasks;
using Xabe.FFmpeg;
namespace ConsoleApp1
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
await Thumbnail(@"E:\tmp\Upload\Video\2256\1f77d136-7aad-49ff-9464-2b9e2be9d5d2.mp4", @"E:\tmp\Upload\Video\2256\1f77d136-7aad-49ff-9464-2b9e2be9d5d2.jpg");
}
static async Task Thumbnail(string inputpath, string output)
{
string path = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "FFmpeg");
FFmpeg.SetExecutablesPath(path);
await FFmpeg.Conversions.FromSnippet.Snapshot(inputpath, output, TimeSpan.FromSeconds(0));
}
}
}
I have tested in AWS lambda also.
Hello,
Do you get any exceptions or errors? What "not working" mean?
I am not getting any exception
So the application freeze? Did nothing happen?
NO its just complete the execution without any problem but i didn't get snapshot
It's really hard to tell what's going on. Did you try to run unit tests from this repository? Can you do that? Are you sure that .mp4 file is correct?
Conversion result has property named Arguments. Can you paste it to ffmpeg in console? You will get extended log. Please share it here.
same problem. no output file
Reviving this as i just had the same problem & could get it solved for my case.
Solution: Use separate threads when running conversions with this library.
In most parts of the code GetAwaiter().GetResult()
is used instead of async-await. This leads to deadlocks if the method is run on the main thread (like ui thread on a windows form), even if is run with async-await. See https://stackoverflow.com/questions/39007006/is-getawaiter-getresult-safe-for-general-use
@tomaszzmuda Is there a reason why this library uses GetAwaiter().GetResult()
instead of making the methods async and using await?