unosquare / ffmediaelement

FFME: The Advanced WPF MediaElement (based on FFmpeg)
https://unosquare.github.io/ffmediaelement/
Other
1.15k stars 238 forks source link

help a newbie #635

Closed LauraKami closed 1 year ago

LauraKami commented 1 year ago

Issue Title (help a newbie )

try to use with vs2022 and .NET 6 I try to use this application with Nugets. I put in c:\ffmpeg all the bin from : https://github.com/BtbN/FFmpeg-Builds/releases ffmpeg-master-latest-win64-gpl-shared.zip ' I have the error "System.IO.FileNotFoundException: 'Unable to load FFmpeg binaries from folder 'c:\ffmpeg'.'" when I start the code below

' My questions : a) is it a good choice to start with vc2022 / .net 6 for your library ? b) do I have to choose a specific version of ffmpeg? (I took the last one) c) do you have a simpler example, like initializes and just plays a video file (your demo is already a bit too sophisticated for a beginner) Merci, have a good day. LauraKami

Issue Categories

Version Information

Steps to Reproduce

  1. Step 1
  2. Step 2
  3. Step 3

Expected Results

Sample Code

XAML

<Window x:Class="Wpf_FFME.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Wpf_FFME"
        xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=ffme.win"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Grid>
        <StackPanel Orientation="Vertical">
        <ffme:MediaElement x:Name="Media" Background="Gray"
            LoadedBehavior="Play"
            UnloadedBehavior="Manual"
            Loaded="Media_Loaded"
            />
            <Button x:Name="But" Click="Button_Click">
                But
            </Button>
        </StackPanel>
    </Grid>
</Window>

C

       public MainWindow()
        {
            InitializeComponent();
            Unosquare.FFME.Library.FFmpegDirectory = @"c:\ffmpeg";
            Unosquare.FFME.Library.LoadFFmpeg();
        }

Command line ffplay

C:\ffmpeg>ffplay video.mp4
ffplay version N-109185-g14c6093528-20221123 Copyright (c) 2003-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20221123
  libavutil      57. 43.100 / 57. 43.100
  libavcodec     59. 54.100 / 59. 54.100
  libavformat    59. 34.102 / 59. 34.102
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 50.101 /  8. 50.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':=    0B f=0/0
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2021-02-07T14:15:49.000000Z
  Duration: 00:04:09.24, start: 0.000000, bitrate: 1979 kb/s
  Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 1847 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      creation_time   : 2021-02-07T14:15:49.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 02/07/2021.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2021-02-07T14:15:49.000000Z
      handler_name    : ISO Media file produced by Google Inc. Created on: 02/07/2021.
      vendor_id       : [0][0][0][0]
   7.84 A-V: -0.025 fd=  54 aq=   16KB vq=  228KB sq=    0B f=0/0
C:\ffmpeg>
StrikingPopcorn commented 1 year ago

Hi,

You need to have both ffmpeg 5.x (which you already have because you downloaded the lates release) and ffmpeg 4.4. Also make sure that you are compiling for x64 and not accidentally for x86 or the x64 binaries won't work. And when you install ffmpeg 4.4 make sure to only copy the dll files so you don't overwrite the 5.x exe files. Hope that helps, took me a while to figure that out as well.

Sincerely StrikingPopcorn

LauraKami commented 1 year ago

Merci @StrikingPopcorn, Yes the problem was the library, I download a v5 library and the required is 4.4 library So, some solutions

So, yes it loads and play a video, Thank's again @StrikingPopcorn. And for UnoSquare : put the links in your doc, they are stable and official link. Have a good day, LauraKami

YkTru commented 1 month ago

@LauraKami @StrikingPopcorn Thanks a lot, I've wasted a lot of time because I didn't understood that https://github.com/GyanD/codexffmpeg/releases/tag/4.4.1 was also required; it should be made clearer IMO in the readme file