AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Playing RawData using aforge.net

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Playing RawData using aforge.net

Postby DSZ » Wed Nov 13, 2019 6:42 am

Using AForge.Video I can paly webcam live videos. My doubt is, can I play raw data or locally stored mp4 videos using same frame work. if yes, please give an example. I could not find. Instead can see samples using VideoFileSource of Accord.net .

Below code is for playing usb web cam

Code: Select all
VideoSourcePlayer Player = new VideoSourcePlayer();
           VideoCaptureDevice videoSource1 = new VideoCaptureDevice(SelectedCamDetails);
           Player.VideoSource = videoSource1;
           Player.NewFrame += new AForge.Controls.VideoSourcePlayer.NewFrameHandler(this.videoSourcePlayer1_NewFrame);
           Player.Start();


Below code is for playing local video using accord.net. But it gets slow for high HD videos

Code: Select all
using Accord.Video.FFMPEG;
              VideoFileSource VideoFileSource1= new VideoFileSource(BrowseVideoFileName1);
            // set NewFrame event handler
            VideoFileSource1.NewFrame += new Accord.Video.NewFrameEventHandler(videoFileSource1_NewFrame);
            VideoFileSource1.Start();
           private void videoFileSource1_NewFrame(object sender, Accord.Video.NewFrameEventArgs eventArgs)
          {
            Bitmap image = new Bitmap(eventArgs.Frame);
            pictureBox1.Image = image;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
         }



when trying with aforge player as below , it throw exception
System.IO.FileLoadException: 'Could not load file or assembly 'AForge.Video.FFMPEG, Version=2.2.5.0, Culture=neutral, PublicKeyToken=03563089b1be05dd' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)'


Code: Select all
using AForge.Video.FFMPEG;
VideoSourcePlayer Player = new VideoSourcePlayer();
string BrowseVideoFileName1 = MultiCamSelection.BrowseVideoFileName1;
VideoFileSource1 = new VideoFileSource(BrowseVideoFileName1);
Player.VideoSource = VideoFileSource1;
Player.NewFrame += new VideoSourcePlayer.NewFrameHandler(videoFileSourcee_NewFrame);
Player.Start()
DSZ
 
Posts: 20
Joined: Mon Feb 25, 2019 7:06 am

Re: Playing RawData using aforge.net

Postby andrew.kirillov » Wed Nov 13, 2019 9:02 am

Check AForge.Video.FFMPEG namespace. Accord.NET just took it from there.

DSZ wrote:when trying with aforge player as below , it throw exception
System.IO.FileLoadException: 'Could not load file or assembly 'AForge.Video.FFMPEG, Version=2.2.5.0, Culture=neutral, PublicKeyToken=03563089b1be05dd' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)'

You need to make sure all DLLs of FFmpeg library are there with your executable.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3451
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Playing RawData using aforge.net

Postby DSZ » Tue Nov 19, 2019 11:14 am

Yes using libraries as listed in above link.
here is the screen shots for packages i'm using.
I got same exception when loading the video.
Please help to correct
Attachments
101.PNG
Package folder
101.PNG (21.48 KiB) Viewed 127 times
100.PNG
bin/release folder
100.PNG (80.03 KiB) Viewed 127 times
DSZ
 
Posts: 20
Joined: Mon Feb 25, 2019 7:06 am

Re: Playing RawData using aforge.net

Postby andrew.kirillov » Tue Nov 19, 2019 12:07 pm

Also make sure you build your .NET application for 32-bit target - same FFmpeg DLLs are targeted for.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3451
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Playing RawData using aforge.net

Postby DSZ » Wed Nov 20, 2019 5:26 am

Facing same issue on 32 bit target
DSZ
 
Posts: 20
Joined: Mon Feb 25, 2019 7:06 am




Return to AForge.NET Framework