How to import FFMPEG Library in my maven project? - java

I have a Spring-boot project, where I am using the ffmpeg library, I am executing the ffmpeg commands through a ProcessBuilder(in the terminal/cmd) and everything works fine, because I have already installed the ffmpeg on my macOS. When I try to generate a jar and run it on an another machine, where ffmpeg is not installed, it is executed, everything works fine, except the ffmpeg comamnds. Is there any change to import the library to my maven project or somehow to use it?
Is it a good idea to add an external jar of the library?
Thank you in advance!

Is the server you're deploying to Mac (same as your desktop) or Windows/Linux? The reason I ask is because ffmpeg is a binary app and has to be compiled to the specific platform.
You could include ffmpeg in maven, but before it runs it will need to be compiled. I found one maven repository here, though I do not know how well this will work: https://mvnrepository.com/artifact/com.tagtraum/ffmpeg/4.0.0. You could also try compiling from source (particularly if there's some non-standard encoding/decoding you're trying to do), which is a much more involved installation.
What I would do is install ffmpeg through a separate installation package, ideally through the OS's package management system; for linux this would be something like:
(Ubuntu)
sudo apt-get install ffmpeg
(CentOS)
sudo yum install epel-release
sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
sudo yum install ffmpeg ffmpeg-devel
More info on installation here:
https://www.ostechnix.com/install-ffmpeg-linux/
Sometimes these packages may be not be the latest or missing something you're trying to do, in which case you may need to compile from source.
Edit: You say you're using Windows. I'm not as familiar with deploying to Windows, but there are ffmpeg Windows packages available on this site (linked from the main ffmpeg page): https://ffmpeg.zeranoe.com/builds/ . I recommend installing separately rather than trying to package with your Java app. This page can help: https://windowsloop.com/install-ffmpeg-windows-10/

I’m not sure if Maven have a plug in for that, but I’d add a shell script to install ffmpeg, let’s call it resources/scripts/myscript.sh, in the script first validate it’s not installed already, then use wget to download what you need , install it , and continue with you app.
You can call this script from your app as the first thing to do

Related

Could not find or load main class com.nabinbhandari.lam.Main

I've read a lot of troubleshooting for similar occurrences of this error, but what is causing it for this particular .jar?
https://download.cnet.com/android/nabin-bhandari/3260-20_4-10982661-1.html
It works on Windows, but when attempting to run the file on a raspbian (linux) system running java version 1.8.0_65 with the command java -jar Local\ Area\ Messenger\ Desktop.jar it throws the error about not being able to find or load the main class.
The MANIFEST.MF defines Main-Class: com.nabinbhandari.lam.Main and there doesn't appear to be any issues with case sensitivity.
What am I missing? Do I need to install something more than Java Runtime Environment?
Edit: In case it is not clear, I am not the developer of this file. I am simply a user trying to run the file. This question has nothing to do with Eclipse and I don't understand why people are linking to that other question. I am not running Eclipse. Please stop linking to that. Please examination the .jar file I have provided.
Edit 2: I have followed the instructions and in this answer:
https://stackoverflow.com/a/1238173/2407742
It gives the error no main manifest attribute, in test.jar
Is there something missing from my java runtime environment? It seems like nothing works.
The Local Area Network Messenger application was developed using JavaFX, which is not included in the Oracle Java build for Rasperry Pi. I had to reinstall Java and then openjfx by doing the following:
sudo apt-get purge openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre-headless
sudo apt-get install openjdk-8-jre
sudo apt-get install openjfx
It runs fine now.
The solution to this was the following:
Close Eclipse/STS
Use a file explorer on your operating system to navigate to your workspace (In my case, I'm on Windows so I used Windows Explorer)
Delete the .metadata directory (or to be safe, copy the directory somewhere else to be safe, then delete it)
Restart Eclipse/STS
Is there a more improved answer than this? I don't want to look like I'm trying to boost my own reputation points, so if someone can provide a better answer then please do so.

Automated testing of InstallAnywhere wizard

I need to automate installation process of some product, but it has to be exactly installation through passing InstallAnywhere wizard (it's kinda GUI testing of installation process, so silent install won't work).
Any suggestion how to do this?
I guess the main problem is that installation file (*.exe) is just extractor which extract required files to temp folder and then run java application.
You may try pywinauto to test it on Windows. Java part of the installer may require new "UIA" back-end which will be released in March. For early testing you may try the following steps:
Install pyWin32 and comtypes by pip install pypiwin32 and pip install comtypes.
Install UIA branch of pywinauto by python setup.py install.
Try the following code:
import pywinauto
pywinauto.backend.activate('uia')
app = pywinauto.Application().start('your_installer_path.exe')
app.ApproximateMainWindowName.Wait('ready', timeout=15)
app.ApproximateMainWindowName.PrintControlIdentifiers()
PrintControlIdentifiers output is a hint for further steps. There are possible access names for the controls on the window. Only basic functionality like ClickInput() and TypeKeys('something') should work for now.
Available methods for the control can be advised here:
app.MainWindow.OKButton.WrapperObject(). # methods list can be displayed here in IDLE or Visual Studio Python Tools
app.MainWindow.OKButton.WrapperObject().ClickInput() # code for debugging
#app.MainWindow.OKButton.ClickInput() # it works the same way, for production code
Feel free to ask more help if something doesn't work.
Python scripts may require running as Administrator to have an access to the GUI. Or add manifest for python.exe with uiAccess="true".

rxtxSerial.dll for MacOS 10.8

I'm currently working on a ZigBee project and I'm programming on an Mac with Mountain Lion (10.8) and using Eclipse IDE. To use my Zigbee Module via USB for Serial communication, I need this rxtxSerial.dll. I only have a Windows compatible version right now.
Is somebody able to provide the necessary link to me?
Thank you!
Edit2
With all the latest updates as of 2012-11-15 (OSX 10.8.2) i needed to install glibtool via homebrew (http://mxcl.github.com/homebrew/) before I got the procedure below to work.
With homebrew installed and configured just do
brew install libtool
from a terminal.
Then proceed as described below.
/Edit2
Edit
So, I managed to compile it for my self on OS X Mountain Lion (10.8.2) and XCode (free from App Store).
Download rxtx-2.2pre2.zip and extract. Edit the "configure" file in the extracted directory and change the line that reads:
JAVAINCLUDEDIR=$JPATH/../../../Headers
to
JAVAINCLUDEDIR=/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
Then configure by doing
./configure
using a terminal in your working directory.
Now you will have a file named "Makefile" in your working directory, you need to edit the line in this file that reads:
LIBTOOLC = $(GLIBTOOL) --mode=compile $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(VERBOSE_IOEXCEPTIONS) -c
to
LIBTOOLC = $(GLIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(VERBOSE_IOEXCEPTIONS) -c
And then run
make
You will now have RXTXcomm.jar in your working directory and librxtxSerial.jnilib in workingdirectory/i386-apple-darwin12.2.0
These are the files you need.
To work with them you may need to do
sudo mkdir /var/lock
sudo chmod 777 /var/lock
This approach worked for me.
PS. If you trust me you can get these files from here and here.
PPS. You may get:
WARNING: RXTX Version mismatch Jar version = RXTX-2.2-20081207
Cloudhopper Build rxtx.cloudhopper.net native lib Version =
RXTX-2.2pre2
But it should still work.
/Edit
I am also trying to use rxtx on ML and while I have not have any success yet I did find this link.
Java 6 and librxtxSerial.jnilib on Intel Mac OS X
And even though it says nothing about ML, one of the comments states that it works with Lion if you tweak it a little bit.
I'll report back if I get it to work here.

Trying to install zgrviewer to view DOT files

I am trying to install zgrviewer on my Ubuntu machine,to view DOT files. I have already installed java jdk 1.6 and Graphviz (sudo apt-get install graphviz).
The java installation path i notice after typing "which javac" is /usr/bin/javac.
I checkout the zgrviewer from sourceforge.net:
svn co https://zvtm.svn.sourceforge.net/svnroot/zvtm/zgrviewer/trunk zgrviewer
I am supposed to launch zgr viewer by running the run.sh script. The contents of the run.sh script is:
#!/bin/sh
# If you want to be able to run ZGRViewer from any directory,
# set ZGRV_HOME to the absolute path of ZGRViewer's main directory
# e.g. ZGRV_HOME=/usr/local/zgrviewer
ZGRV_HOME=/usr/local/zgrviewer
java -Xmx1024M -Xms512M -jar $ZGRV_HOME/target/zgrviewer-0.9.0-SNAPSHOT.jar "$#"
I am not sure how to edit this script to point to a specific Java Virtual Machine ; right now, it just says java and therefore uses the first JVM it finds in my PATH.
so when i run the script it says: Unable to access jarfile /usr/local/zgrviewer/target/zgrviewer-0.9.0-SNAPSHOT.jar
Please help me install zgrviewer successfully.
I like graphviz a lot, but I eventually gave up on the native "dot" viewers. Instead, I build (or obtain) graphviz with pdf support, and translate .dot to pdf. From there, many PDF viewers work well (and they tend to be more polished than dot viewers, probably because the need is more common), even for large documents. I'm mostly a gnome 2.x person, but I find KDE's okular to be the best PDF viewer I've encountered for large PDF's so far.
If this can help, I've written a guide on how to install a Graphviz viewer (ZGRViewer) and thumbnailer on Ubuntu/Gnome.
It is available at http://bernaerts.dyndns.org/linux/74-ubuntu/287-ubuntu-graphviz-viewer-gnome-thumbnailer
I've been able to use ZGRViewer 0.8.2 without any problem, but no success till date with version 0.9.0.

Generate cab files on Linux

I'm looking for a stanadlone application, script or library (better Java) to generate cab files on Linux.
May I ask which distribution you are using?
If you are using Ubuntu, the package cabextract can read and extract a .cab file while the pacakge lcab lets you create one.
You may install the lcab package via the apt-get install command:
sudo apt-get install lcab
You may search the packages you want at Ubuntu Packages Search.
Please let me know if you are not using Ubuntu.
Have a look to lcab or libmspack.

Categories

Resources