Author Topic: Quick guide to Avidemux development  (Read 7781 times)

KoolAidMan

  • Jr. Member
  • **
  • Posts: 68
Quick guide to Avidemux development
« on: November 25, 2014, 07:36:45 AM »
Quote
Hi, KoolAidMan

Your recent spurt of development work to include the x265 encoder in avidemux is facinating.
I look forward to a release from mean that includes all your efforts.

I noticed from one of your reactions in another thread, that you have tried to compile avidemux under windows.
I am currently trying to do that, using MinGW, and running the bootstrap.bash script in a MSYS CLI shell.
Obviously the avidemux build environment works under linux but porting it to a quasi windows build environment throws inconsistencies.

Unfortunately, I know nothing about linux, unix shells, C, C++, Cmake etc and so this whole thing is like a foreign language to me.
Each issue is therefore quite an effort to unravel.

After you complete this H265 intergration exercise would you be willing to set up a buildroot under windows, and see the issues that I am getting. They are probably much much easier for you to resolve.

You may ask why I am even trying to do this without the appropriate programming credentials.
Well - its a good way to learn new programming skills (I do have some old school skills!).
And - A windows native debugger for Avidemux might shed some light on avidemux-windows only issues (eg unhandled segmentation fault caused by fast forward/reverse on HD streams).
 
Anyway I am just asking.

Aquar

In order to develop avidemux, you will need a decent computer. My most precious resource is RAM, which I can use a lot of when I am debugging. I have windows installed; however, I do not develop avidemux in Windows. The reason being, one of the most useful tools in my debugging arsenal is valgrind (http://valgrind.org/), which is available only in Linux. In order to develop avidemux, I do the following:

Installing the virtual machine:
  • https://www.virtualbox.org/wiki/Downloads
    Install Oracle VM Virtualbox.
    Also get the extension pack. Give your VM as much RAM as Virtualbox will allow you to without complaining; for me, 11427MB, and at least a 32GB virtual HDD.
  • http://fedoraproject.org/
    Get Fedora. Boot to a fedora Workstation ISO and install it to your VM.
    You could use any compatible linux distribution; however, I work on CentOS servers for my day job, so Fedora is most familiar to me. This guide will use yum.

Eject the virtual DVD and reboot your VM.

Updates and Guest Additions
  • http://rpmfusion.org/Configuration
    Install both the free and nonfree repositories for RPMFusion.
  • sudo yum update
    It is strongly recommended you update before you continue.
    These commands and all future commands are run in the terminal. It might be hidden under a "Utilities" directory in your applications, but I would strongly recommend you pin it to your activities.

    Note: If you updated your kernel during this step, you will have to reboot before attempting to install the guest additions.
  • sudo yum install gcc kernel-devel
    These are required to install the guest utilities which allows for higher screen resolution and mouse pointer integration.
  • In VirtualBox's top menu, Devices > Install Guest Additions CD Image
    Then follow through with the installation (it should pop-up automatically)

You will have to reboot your VM now. It is recommended that you actually shut down the VM and cold boot to ensure the hypervisor is working properly with the guest additions.

Preparing your development environment:
  • git clone https://github.com/mean00/avidemux2.git
  • sudo yum install cmake gcc-c++ qt4-devel zlib-devel SDL-devel libva-devel sqlite-devel gettext-common-devel intltool libvdpau-devel patch yasm x264-devel x265-devel libXv-devel faad2-devel libvorbis-devel opencore-amr-devel arts-devel jack-audio-connection-kit-devel pulseaudio-libs-devel libvpx-devel twolame-devel lame-devel libdca-devel faac-devel enca fribidi-devel libsamplerate-devel esound-devel gdb valgrind ccache
    dependencies...

Now that you have all of the dependencies, you need an IDE to develop (or, you could just use gedit). You can use whichever IDE you want, but I would recommend netbeans.

Preparing your IDE:

To open a project in netbeans, go to File > New Project and select C/C++ Project with Existing Sources. Browse to any directory with a CMakeLists.txt file AND BE SURE TO SELECT CUSTOM CONFIGURATION MODE BEFORE PRESSING NEXT. Also uncheck the box "Run the 'configure' Script after Finish". If you do not select custom configuration mode, netbeans will not do the right thing and will cause you a world of pain. On the next screen, clear the "Configure Arguments" textbox. You can then continue to press next until it is configured. I would not recommend you compile avidemux from the IDE (although you could configure it to do so), instead, compile from the shell.

Compiling avidemux:
Go to the cloned directory in the terminal and simply run bash bootStrap.bash. You can also run bash bootStrap.bash --help for additional commands, including compiling specific components and compiling a debug build.
Once it has compiled, you can install avidemux by executing sudo cp -R install/usr/* /usr/. You can repeat that command as many times as you would like. The application will be available in your PATH as avidemux3_qt4.

If you are unable to compile, it is probably because you did not select custom configuration mode when configuring netbeans, and netbeans has created a lot of garbage CMake-related files. You should be able to revert this by typing git reset --hard in your workspace. Note this will undo any pending changes you may have.

Debugging avidemux:
In order to debug avidemux, you must run bash bootStrap.bash --debug. Then deploy the debug dlls as you did above. There are many wonderful tools for debugging; however, these are my two favorites:
  • gdb avidemux3_qt4 (Note: You have to type "run" to start the program)
    Good ol' GNU debugger. If the application ever crashes, you will see a stack trace, hopefully providing you with the origin of your problem.

    For more complicated issues, including problems with memory management, I would recommend...
  • valgrind avidemux3_qt4
    This tool allows you to debug more complicated issues including memory management, thread management, performance profiling, and a heap profiler, among other useful tools.
    The memory management tool is arguably the most useful. The docs are here: http://valgrind.org/docs/manual/mc-manual.html

One more thing: Have you ever used git grep? It is awesome for finding whatever I need in the avidemux repository fast.

Thanks, and let me know if you all have any additional questions, comments, recommendations, or things you might do differently.
« Last Edit: December 13, 2014, 06:20:04 PM by KoolAidMan »

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10971
Re: Quick guide to Avidemux development
« Reply #1 on: November 25, 2014, 08:54:23 AM »
you might also want to install ccache
That speeds up rebuilding from scratch a lot

KoolAidMan

  • Jr. Member
  • **
  • Posts: 68
Re: Quick guide to Avidemux development
« Reply #2 on: November 25, 2014, 08:59:23 AM »
you might also want to install ccache
That speeds up rebuilding from scratch a lot
Oh wow! This is a life-saver. Thanks! I have added it to the original post.

AQUAR

  • Hero Member
  • *****
  • Posts: 1077
Re: Quick guide to Avidemux development
« Reply #3 on: November 26, 2014, 10:23:44 AM »
@ KoolAidMan

Thanks for that very generous response.
The detailed explanation of your build environment will help any member here trying to build/debug avidemux from  source. And it is a great wiki augmentation that covers this topic.

I have a little bit of familiarity with linux (Ubuntu) by way of running an OpenWRT port for my Mvix NAS box.
(That port was done by a Frenchman with a tiny bit of input from me - http://opengemini.free.fr/wiki/doku.php?id=start.)

My first objective really is to see the complete work flow involved with the build process.
Since I am stuck at the moment with the MinGW/Windows project, I will try your way as a parallel exercise.
(Probably by multibooting to fedora on a separate HDD !).
I am sure this will also generate plenty of noob problems - but with a common operational platform it will be easier to help out.

Ultimately I want to avoid cross compiling the windows versions ( like in the days of avidemux 2.5).
(But I'll keep that discussion to http://avidemux.org/smuf/index.php/topic,16289.0.html.).

KoolAidMan

  • Jr. Member
  • **
  • Posts: 68
Re: Quick guide to Avidemux development
« Reply #4 on: December 13, 2014, 06:22:23 PM »
Updated guide for Fedora 21...

AQUAR

  • Hero Member
  • *****
  • Posts: 1077
Re: Quick guide to Avidemux development
« Reply #5 on: December 15, 2014, 12:08:21 PM »
It takes a bit of patience to become familiar with virtualbox and fedora.
(it's kind of strange for a windows user!)

I tried the live desktop version but it seems to be a bit of a "look see but don't use" edition.
Suggest to go straight to the full DVD iso and work with that.

There is a Gnome tweak utility that I installed to get some familiar "windows" features (like windows minimise & maximise on title bar!).

Will have to make a new VM for fedora 21 now.
« Last Edit: December 16, 2014, 10:55:39 AM by AQUAR »

AQUAR

  • Hero Member
  • *****
  • Posts: 1077
Re: Quick guide to Avidemux development
« Reply #6 on: December 16, 2014, 11:03:43 AM »
@ KoolAidMan

What happened to the "sudo debuginfo-install" component of the guide?
Is it not needed with fedora 21?

Appears a full install DVD is no longer made for fedora post v20.
If I understand I now need the server edition and need to rumage the repositories to get to a full install.

KoolAidMan

  • Jr. Member
  • **
  • Posts: 68
Re: Quick guide to Avidemux development
« Reply #7 on: December 17, 2014, 02:29:00 AM »
@ KoolAidMan

What happened to the "sudo debuginfo-install" component of the guide?
Is it not needed with fedora 21?

Appears a full install DVD is no longer made for fedora post v20.
If I understand I now need the server edition and need to rumage the repositories to get to a full install.

It changes too often to keep in the guide. Just run gdb. It will tell you what debuginfo you need to install. Also, the workstation version of fedora should be adequate for development.

AQUAR

  • Hero Member
  • *****
  • Posts: 1077
Re: Quick guide to Avidemux development
« Reply #8 on: December 17, 2014, 05:02:05 AM »
Okay - Thanks,

Since fedora v20 refused to restart after doing various installs, I have to restart with a new VM anyway.

AQUAR

  • Hero Member
  • *****
  • Posts: 1077
Re: Quick guide to Avidemux development
« Reply #9 on: December 24, 2014, 03:54:35 AM »
After a bit of familiarisation with Virtualbox and Fedora, then following KoolAidMan's Guide.
Its a case of "so far so good" with the build environment creating a working linux avidemux out of the box.

The Git Cloning was painfully slow/unresponsive (took 3 tries to clone the avidemux branch!).

It would be good if the quick guide could be extended with some info about crosscompiling to windows.
Eg which Mingw-w64 packages are to be installed from the repositories plus dependencies for cross building ADM.

- For now I am just trying to duplicate what was needed by the windows native build environment.
-- starting with the 32 bit and 64 bit gcc and c++ crosscompiler and all the dependencies that these invoke.

Also I found that Yumex and GnomeTweak were usefull Dl's from a windows user operability perspective (we are spoiled with GUI's!).
« Last Edit: December 24, 2014, 04:40:10 AM by AQUAR »