FFmpeg.Autogen Error when i run on ubuntu
arunkmarhudrom opened this issue · 3 comments
I am trying to get frame from rtsp using FFmpeg.Autogen using " https://github.com/Ruslan-B/FFmpeg.AutoGen/tree/master/FFmpeg.AutoGen.Example " it works perfectly on window i want to run on linux
i got error when i run on linux " ffpath: /usr/lib/x86_64-linux-gnu
failed to load ffmpeg libs : System.NotSupportedException: Specified method is not supported.
at FFmpeg.AutoGen.DynamicallyLoadedBindings.<>c.b__2_1226()
at FFmpeg.AutoGen.DynamicallyLoadedBindings.<>c.b__2_516()
at FFmpeg.AutoGen.ffmpeg.avdevice_register_all()
at RTSP.PLAYER.ViewModels.MainWindowViewModel.Mfgfgain(String ffpath) in E:\Lane Working Project\RTSP.PLAYER\ViewModels\MainWindowViewModel.cs:line 73 "
ffmpeg version 4.2.9 Copyright (c) 2000-2023 the FFmpeg developers
FFmpeg.Autogen Version 6.0.0.2
Please help me anybody
namespace FFmpeg.AutoGen.Example
{
public class FFmpegBinariesHelper
{
internal static void RegisterFFmpegBinaries()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
var current = Environment.CurrentDirectory;
var probe = Path.Combine("FFmpeg", "bin", Environment.Is64BitProcess ? "x64" : "x86");
while (current != null)
{
var ffmpegBinaryPath = Path.Combine(current, probe);
if (Directory.Exists(ffmpegBinaryPath))
{
Console.WriteLine($"FFmpeg binaries found in: {ffmpegBinaryPath}");
ffmpeg.RootPath = ffmpegBinaryPath;
// ffmpeg.RootPath = ffmpegBinaryPath;
return;
}
current = Directory.GetParent(current)?.FullName;
}
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
ffmpeg.RootPath = "/usr/lib/x86_64-linux-gnu/";
else
throw new NotSupportedException(); // fell free add support for platform of your choose
}
}
}
I guess could close this, obviously path is wrong given proper version binaries is installed. Binaries are not a part of distributions they needed for generation and debugging interop issues. Besides they GPL.
I guess could close this, obviously path is wrong given proper version binaries is installed. Binaries are not a part of distributions they needed for generation and debugging interop issues. Besides they GPL.
I got Black and white image on ubuntu what should be the correct Pixel format
var destinationPixelFormat = AVPixelFormat.AV_PIX_FMT_BGR24;
using var vfc = new VideoFrameConverter(sourceSize, sourcePixelFormat, destinationSize, destinationPixelFormat);
var frameNumber = 0;
try
{
var current = Environment.CurrentDirectory;
var ffmpegBinaryPath = Path.Combine(current, "Frame");
if (!File.Exists(ffmpegBinaryPath))
{
Directory.CreateDirectory(ffmpegBinaryPath);
}
while (vsd.TryDecodeNextFrame(out var frame))
{
var convertedFrame = vfc.Convert(frame);
var bitmap = new Bitmap(convertedFrame.width, convertedFrame.height,
convertedFrame.linesize[0], PixelFormat.Format24bppRgb, (IntPtr)convertedFrame.data[0]);
using (var memoryStream = new MemoryStream())
{
bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
memoryStream.Position = 0;
CameraImageView = new Bitmaps(memoryStream);
// Use the Avalonia bitmap as needed
}
}}
I guess could close this, obviously path is wrong given proper version binaries is installed. Binaries are not a part of distributions they needed for generation and debugging interop issues. Besides they GPL.
I got Black and white image on ubuntu what should be the correct Pixel format
var destinationPixelFormat = AVPixelFormat.AV_PIX_FMT_BGR24; using var vfc = new VideoFrameConverter(sourceSize, sourcePixelFormat, destinationSize, destinationPixelFormat); var frameNumber = 0; try { var current = Environment.CurrentDirectory; var ffmpegBinaryPath = Path.Combine(current, "Frame"); if (!File.Exists(ffmpegBinaryPath)) { Directory.CreateDirectory(ffmpegBinaryPath); } while (vsd.TryDecodeNextFrame(out var frame)) { var convertedFrame = vfc.Convert(frame); var bitmap = new Bitmap(convertedFrame.width, convertedFrame.height, convertedFrame.linesize[0], PixelFormat.Format24bppRgb, (IntPtr)convertedFrame.data[0]); using (var memoryStream = new MemoryStream()) { bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); memoryStream.Position = 0; CameraImageView = new Bitmaps(memoryStream); // Use the Avalonia bitmap as needed }
}}
You write it in bitmap use (IntPtr)convertedFrame.data[0]
, the index 0 of data only contains one channel.