Author Topic: Problem with demo/sample video filter  (Read 447 times)

TLink2001

  • Newbie
  • *
  • Posts: 2
Problem with demo/sample video filter
« on: September 16, 2019, 01:36:59 AM »
I'll start off by saying that I'm self-aware that I'm out of my depth, but I'm hoping to create a new filter plugin to automate some video editing. Currently I've gotten to the point where I can successfully see the sample video filter project in Visual Studio 2017, and it does compile, though with the following warnings:

Quote
C:\Program Files\Avidemux 2.7 VC++ 64bits\include\avidemux\2.7\ADM_coreImage\ADM_image.h(184): warning C4251: 'ADMImageDefault::data': class 'ADM_byteBuffer' needs to have dll-interface to be used by clients of class 'ADMImageDefault'
2>C:\Program Files\Avidemux 2.7 VC++ 64bits\include\avidemux\2.7\ADM_core\ADM_byteBuffer.h(21): note: see declaration of 'ADM_byteBuffer'
2>C:\Program Files\Avidemux 2.7 VC++ 64bits\include\avidemux\2.7\ADM_coreImage\ADM_image.h(185): warning C4251: 'ADMImageDefault::alphaChannel': class 'ADM_byteBuffer' needs to have dll-interface to be used by clients of class 'ADMImageDefault'
2>C:\Program Files\Avidemux 2.7 VC++ 64bits\include\avidemux\2.7\ADM_core\ADM_byteBuffer.h(21): note: see declaration of 'ADM_byteBuffer'
2>C:\Program Files\Avidemux 2.7 VC++ 64bits\include\avidemux\2.7\ADM_coreDemuxer\avifmt2.h : warning C4819: The file contains a character that cannot be represented in the current code page (932). Save the file in Unicode format to prevent data loss

After compiling, it created libADM_vf_logo_sample.dll in a Debug subfolder which I then copied to the \plugins\videoFilters Avidemux program subfolder. When running Avidemux, Add logo (sample)  does appear in the filter list, but when I try to apply it with a JPEG image it displays a window saying "Opps! Cannot load the logo" (see attached). It also adds to active filters without actually doing anything and if I try to remove the active filter Avidemux crashes.

So before I go any farther and try to write my own plugin, I wanted to figure out why this happens. I'm running Avidemux 2.7.5 on Windows 10 and I mostly followed the instructions here:

http://www.avidemux.org/admWiki/doku.php?id=build:devel_2.6_msvc

I say mostly because I had a bit of trouble with the "start msys bash.exe shell" part, I believed I installed MinGW and msys correctly, but opening bash.exe lead to an interface that I didn't really know what to do with, so I just used cmake in the windows command prompt. Again, very much out of my depth here and trying to learn as I go, any help would be appreciated!

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3381
Re: Problem with demo/sample video filter
« Reply #1 on: September 16, 2019, 03:57:56 PM »
You should run Avidemux in debugger or just add a couple of printf to addLogopFilter::reloadImage to find out whether configuration.logo is empty or createImageFromFile() fails and start to investigate from that point.

Unfortunately, I don't have setup ATM to reiterate the steps on Windows. The sample plugin builds and works fine on Linux.
« Last Edit: September 16, 2019, 04:01:01 PM by eumagga0x2a »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3381
Re: Problem with demo/sample video filter
« Reply #2 on: September 16, 2019, 06:55:00 PM »
Well, I've setup the necessary build env on Win10 and can reproduce all the troubles. The solution is very simple: you must build Release, not Debug (i.e. "-DCMAKE_BUILD_TYPE=Release" doesn't seem to work as expected). I loaded the .sln in Visual Studio and performed the build after selecting the right type (instead of delegating it to cmake), copied the generated .dll to the correct location and everything worked.

TLink2001

  • Newbie
  • *
  • Posts: 2
Re: Problem with demo/sample video filter
« Reply #3 on: September 16, 2019, 09:06:28 PM »
Building as release fixed it for me as well. Thanks eumagga0x2a!

MeanAdmin

  • Administrator
  • Newbie
  • *****
  • Posts: 36
Re: Problem with demo/sample video filter
« Reply #4 on: September 18, 2019, 12:59:13 PM »
if you build with release+deb info you'll be able to debug it, even if the optimization will make it a bit harder
The other around is to build a full debug build of avidemux, so that the plugins can be built in debug mode

It is a visual C++ thing, it does not use the same libs depending on the mode you are using