Getting avconv working with x265 on Linux Mint 17.1 - linux-mint

I compiled and installed the x265 codec from multicoreware as suggested here: https://bitbucket.org/multicoreware/x265/wiki/Home and then manually installed libav with libx265 enabled as suggested here: https://wiki.libav.org/Encoding/hevc
Now, when I am trying to convert a x265 file to some other format using avconv (a tool that comes with libav) it is showing this error:
avconv: error while loading shared libraries: libx265.so.50: cannot open shared object file: No such file or directory
When I try to do whereis libx265.so.50, it gives me this:
libx265.so: /usr/local/lib/libx265.so /usr/local/lib/libx265.so.50
So, libx265 is indeed there but why isn't avconv/libav detecting it?
UPDATES:
Alternatively, you can simply answer how to get x265 working with avconv.
My system specs are: Linux Mint 17.1, based on Ubuntu 14.04

Okay. This works fine now. I was trying to convert an x265 video to an x264 video but there were a few things I was doing wrongly.
First, when I compiled my avconv manually, I only enabled the x265 codec and not the x264. Then, I was following wrong syntax for conversion in avconv. I will explain both here.
Let me tell it in plain steps:
First, of all. Install x265 as explained here: https://bitbucket.org/multicoreware/x265/wiki/Home.
Install missing x264 packages if they aren't installed:
sudo apt-get install libx264-dev x264
Then, manually compile avconv by downloading it from their website: https://www.libav.org/download.html. While compiling it, do it this way (this is the key):
./configure --enable-libx264 --enable-libx265 --enable-gpl
make; sudo make install;
Now the conversions can be done without fail:
avconv -i Some.Movie.x265.mkv -c:v libx264 -c:a copy out.mkv
PS: That error error while loading shared libraries was perhaps due to some mistake I did previously while compiling avconv or maybe due to wrong avconv syntax. I don't exactly know what fixed it. But the point is, it should now work just fine if one follows the above steps carefully.

Related

Installing GTK for use in Code::Blocks on Windows 10

Original Question
I am having trouble installing gtk to start building GUIs in C++ on Code::Blocks. Could anyone nudge me in the right direction? I'm running Windows 10 (64-bit) on a Lenovo.
I attempted an installation guide (https://www.youtube.com/watch?v=jvQXvTtSIQo), stack overflow (How do you install GTK+ 3.0 on Windows?), the official GTK installation guide (https://www.gtk.org/download/windows.php), a written guide (http://www.tarnyko.net/repo/gtk3_build_system/tutorial/gtk3_tutorial.htm), and just noticed a very similar stack overflow (Install GTK for c on Windows 10?)
Before this, my PATH environment variable only recorded C:\Users\Owner\AppData\Local\Microsoft\WindowsApps;C:\Users\Owner\AppData\Roaming\npm;C:\Users\Owner\AppData\Local\atom\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;
I downloaded MinGW from mingw.org. This was to the youtube link's comment that the official is more stable than the one that can be installed with Code::Blocks. I added C:\MinGW\bin to PATH.
Trying the official GTK installation site, I downloaded MSYS2 and used pacman -Syu to install core system packages and pacman -Su to then update. That's the end of that, so I think gtk is officially installed, I just need to get it to talk to Code::Blocks. I added C:\msys64\mingw64\bin to PATH but that didn't seem to work.
I tried to install the all-in-one bundle for GTK 3.6.4 at http://www.tarnyko.net/dl/gtk.htm , and extracted it to C:\gtk. I now have C:\gtk\bin in PATH. GTK should be in my path in one form or the other. I can run gtk3-demo and gtk-demo-application from CMD but not MSYS2. I'm a bit confused about that. It probably has something to do with MSYS2's specific path variable, I think? But it should search the system's PATH afterward? And I don't know how to change that specific path? Probably questions for another day.
So the similar stack overflow, youtube, and written tutorial all say to use pkg-config --cflags --libs gtk+-3.0 to check for a reasonable output to see if I have gtk correctly installed. I installed
pkg-config-lite to avoid the glib circular dependency issue that How to install pkg config in windows? describes and frankly I do not understand. I added it to C:\MinGW\bin to by in my path. Now I am able to run it, but get:
Package gtk+-3.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0' found
I tried 3.6.4 instead of 3.0. No dice. I tried just 3. Nope. I can only find gtk3 files, and not the actual version I installed anywhere. pkg-config --cflags --libs says that I need to name a library, so I tried just gtk hopiing to get libraries containing that. Nope. The rest of the tutorials are aimed at getting Code::Blocks compiler (I think) to include gtk. I hope this is the only obstacle, and I will be able to get the rest. But, if anyone can help me through the rest, it would be appreciated.
At this point I'm out of ideas. Can someone help me?
Gratefully,
John
More Questions After Liberforce's Answer
Thank you for writing up https://www.gtk.org/download/windows.php !! I bet it helps a lot of frustrated newbies like myself. I will kindly offer more proper feedback after I get everything to work. I am stuck on compiling a C/C++ program, if you can help more. Before I get to that, I want to be very clear about the precise steps I took. The step names correspond to your written instructions.
Step 1: Install MSYS2
Alright, resetting everything...
Removed C:/gtk directory from PATH and from computer, aka all the tarnyko files.
Removed C:/MinGW directory from PATH and from computer, effectively uninstalling. I read your conversation with Simon (Unable to compile code with GTK and https://chat.stackoverflow.com/rooms/156828/discussion-between-liberforce-and-simon) about the confusion between MinGW's terminal which includes msys1.0 and MSYS2 terminal which includes MinGW. I figured this would be safer.
Thus, I only have C:\msys64 in PATH (and what I had before, irrelevant to GTK).
Uninstalled MSYS2 (via Add/Remove Programs) and reinstalled using the x86_64 from www.msys2.org. On pacman -Syu, I received error, "msys2-runtime and catgets are in conflict" and "msys2-runtime and libcatgets are in conflict." Entered y to remove both.
I keep uninstalling and reinstallling but I hit the following problem... (5/5) upgrading pacman was at 100% and the warning pops up:
warning: terminate MSYS2 without returning to shell and check for updates again
warning: for example close your terminal window instead of calling exit
The program halts here. I assume this means to close the window. I did, and clicked OK for the dialogue "Processes are running in session: Close anyway?." Window now printed "Hangup signal received" and it is no longer responding. I use task-manager to kill it.
Openning MSYS2 by the desktop application after the first pacman -Syu gave me the dialogue to choose which shell: MSYS2, Mingw-w64 32 bit, Mingw-w64 64 bit. I instead went into the filesystem and openned C:\msys64\msys2_shell.cmd for all future instances.
Ran pacman -Syu to finish installing packages. I restart MSYS2 again, and ran pacman -Su to reveal
:: Starting core system upgrade...
there is nothing to do
:: Starting full system upgrade...
there is nothing to do
pacman -Syuu showed:
:: Synchronizing package databases...
mingw32 is up to date
mingw64 is up to date
msys is up to date
The pacman -Su, pacman -Sy, and pacman -Suu likewise reveal everything okay. Closed and reopenned C:\msys64\msys2_shell.cmd
pkg-cofig just gives "bash: pkg-config: command not found." So I ran pacman -S pkg-config and got that working. update-core, though, which is mentioned in https://github.com/msys2/msys2/wiki/MSYS2-installation cannot be found, and pacman -S update-core will not work. pacman -Ss core turns up:
msys/coreutils 8.26-2 (base) [installed]
The basic file, shell and text manipulation utilities of the GNU operating
system
And other files that seem unrelated. Results of pacman -Ss core likewise seem irrelevant.
pacman --version shows:
.--. Pacman v5.0.1 - libalpm v10.0.1
/ _.-' .-. .-. .-. Copyright (C) 2006-2016 Pacman Development Team
\ '-. '-' '-' '-' Copyright (C) 2002-2006 Judd Vinet
'--'
This program may be freely redistributed under
the terms of the GNU General Public License.
Ran "pacman --needed -S bash pacman pacman-mirrors msys2-runtime" to reveal:
warning: bash-4.4.019-2 is up to date -- skipping
warning: pacman-5.0.1-5 is up to date -- skipping
warning: pacman-mirrors-20160112-1 is up to date -- skipping
warning: msys2-runtime-2.10.0-2 is up to date -- skipping
there is nothing to do
I exited out of all msys shells, and ran C:\msys64\autorebase.bat, although not on a 32 bit system. I believe there is a typo when it says to reopen msys2_shell.bat, which I do not have. I openned msys2_shell.cmd. I use pacman -Suu once more to reveal that everything is okay.
Step 2 -> Step 5 (optional): Install build tools
Openned C:\msys64\msys2_shell.cmd and ran "pacman -S mingw-w64-x86_64-gtk3" (GTK+3 package) and "pacman -S mingw-w64-x86_64-toolchain base-devel" (package to develop GTK+3 applications in other languages) (defaulted to all installations when prompted).
Failed to Compile a GTK+3 Application
Restarted computer. Openned C:\msys64\msys2_shell.cmd. Following https://developer.gnome.org/gtk3/stable/gtk-getting-started.html.
Put the simple window tutorial file in C:\Users\Owner\Desktop\test_code\example-0.c . When running gcc pkg-config --cflags gtk+-3.0 -o example-0 example-0.c pkg-config --libs gtk+-3.0 , got the error in my original question. Used "pacman -Ss gtk3" to see two packages I think I need. Ran "pacman -S mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gtkmm3" .
To answer your questions to Simon about this same error at Unable to compile code with GTK , pkg-config --list-all | grep gtk returns nothing, even after closing and reopenning C:\msys64\msys2_shell.cmd. "which gcc" returns:
which: no gcc
in(/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:
/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
I see gtk-3.0 under C:\msys64\mingw64\include. I have no idea how to add this to the path. "echo $PKG_CONFIG_PATH" returns:
/usr/lib/pkgconfig:/usr/share/pkgconfig:/lib/pkgconfig
Correctly Compiled a File in Console with GTK+3
Checked that GTK was in Console
I needed to open up MSYS2 in a Mingw-w64 64 bit shell. This can be preformed via the Desktop app for MSYS2 which prompts you which one of three shells you want to open: MSYS2, Mingw32, and Mingw64. Specifically, me installing gtk with the command mingw-w64-x86_64-toolchain means it can only be accessed this way.
Commands in this shell show that I do, in fact, have gtk:
$ pkg-config --modversion gtk+-3.0 --> 3.22.29
$ which gcc --> /mingw64/bin/gcc
Compiled Sample Code from Mingw64 Console
I referenced https://github.com/msys2/msys2/wiki/MSYS2-introduction to learn the file system / drive mounting syntax. I will place the sample code gotten from https://developer.gnome.org/gtk3/stable/gtk-getting-started.html in `/c/Users/Owner/Desktop/test_code/example-0.c'. I just used my favorite IDE, Atom, but any text editor would do.
Openned MSYS2's Mingw64 shell, cd /c/Users/Owner/Desktop/test_code/ , compiled with gcc \pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0`` , and execute with ./example-0
Unsuccessful to Link GTK+3 and the Code::Blocks Compiler
I Understand some Linker Settings
I went into Code::Blocks. Went to Settings > Compiler... Made sure to use the dropdown box under Selected compiler to select GNU GCC Compiler, and clicked Reset Defaults because of complications when I first installed Code::Blocks. The check boxes under Compiler Flags should all blank after the reset, and so I checked "Have g++ follow the C++14 ISO C++ language standard [-std=c++14]" under General and "Enable all common compiler warnings (overrides many other settings) [-Wall]" under Warnings.
Next to where it says Compiler Flags, I went to Linker settings and added text to Other linker options. I got this text by running pkg-config --cflags gtk+-3.0:
-mms-bitfields -pthread -mms-bitfields -IC:/msys64/mingw64/include/gtk-3.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/pango-1.0 -IC:/msys64/mingw64/include/fribidi -IC:/msys64/mingw64/include/atk-1.0 -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include -LC:/msys64/mingw64/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lz -lpangowin32-1.0 -lpangocairo-1.0 -lpango-1.0 -lfribidi -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl
Explanation: When compiling from console, I used a command that included the text /pkg-config --cflags gtk+-3.0`` . The backticks mean to run pkg-config --cflags gtk+-3.0 BEFORE the higher-level compilation command, and insert whatever text comes out into the higher-level compilation command. Code::Blocks needs that text under the Linker settings.
I do not Understand the Search Directories
In Settings > Compiler... , beside where it says Compiler Settings, I clicked Search directories. I know you need to do some work here. After this, you go back to Linker Settings to finish, and your Code::Blocks will be ready to go!
If anyone can help me here, or if I figure it out, I would love to finish, in case this helps posterity. I have GTK compiling, and that is good enough for now.
Ok, let's start from the beginning.
Don't use tarnyko packages, they're outdated and not maintained anymore
Official way to get GTK+ 3 on Windows is through MSYS2
Don't blindly follow every guide you find on the internet, mixing them all together and expect things to work. Things change, and something that was advertised at some point can be outdated and plain wrong at the time you read it. If you cook a dish with 3 different recipes at the same time, don't expect it to taste good.
So:
Remove all remnants of the tarnyko bundle
Remove pkg-config-lite. pkg-config is already installed through MSYS2 if you follow official installations
Try to get things working with the MSYS2 guide (pkg-config detection, and compiling a simple GTK+ program) without the Code::Blocks integration first
Once this works, making it work on Code::Block should be a matter of setting some environment variables and pointing to the right pkg-config.
I used gtk+ bundle_2.24.10 32 bit on Windows 7.
I downloaded it from tarnkos, there's no need to do change a single setting in code blocks 17.12.

ERROR 1: libNCSEcw.so: cannot open shared object file: No such file or directory

I am trying to convert some ECW files to GeoTiff with Gdal command lines in Ubuntu 12.04 but ECW was not supported. I followed some instruction for installing the ecw libraries (http://lists.osgeo.org/pipermail/ubuntu/2014-May/001090.html) by downloading ECWJP2SDKSetup_5.1.1.bin and everything went smooth up to the point of testing if the extension is working with gdalinfo --formats | grep -i ecw. It looks like the installation. I get the following error message:
"ERROR 1: libNCSEcw.so: cannot open shared object file: No such file or directory"
I am using gdal v1.10.0. I should also say that when unpacking ECWJP2SDKSetup_5.1.1.bin it provided options for a free desktop-read-only licence or a paid desktop-read-write-only licence. I chose the first but maybe that has to do something with finding and accessing the library?
Anyone else had the same problem before? Your help would be very much appreciated.
Cheers,
George
The desktop-read-only option is the good one.
I had the same problem, but I found the solution with luck :
The instructions we followed are written for 32 bits architectures.
In this lign :
sudo ln -s /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only/lib/x86/release/libNCSEcw.so /usr/local/lib/libNCSEcw.so
I've just replaced the /x86/ folder by /x64/
So a 64 bits libNCSEcw.so was linked in /usr/local/lib.
Then, I've executed next commands :
sudo ldconfig
sudo apt-get install libgdal-ecw-src
sudo gdal-ecw-build /usr/local/ERDAS-ECW_JPEG_2000_SDK-5.1.1/Desktop_Read-Only
gdalinfo --formats | grep -i ecw
And voila :
ECW (rw+): ERDAS Compressed Wavelets (SDK 5.1)
JP2ECW (rw+v): ERDAS JPEG2000 (SDK 5.1)
I hope it can help you.
Cheers,
Vincent

How to use jpeglib in xCode

I'm developing an iPhone application and I'm kind of new to everything. I'm working on Mountain Lion OS X 10.8 and using xCode v4.5. I need JPEG handling capabilities in my project and I want to use the libjpeg (http://www.ijg.org/) library. I have tried a few different approaches, but being a bit naive, I'm not really sure how to begin. After downloading packages I've made usual ./configure; make and make install. Right now I have (jconfig.h, jerror.h, jmorecfg.h, jpeglib.h) under (/usr/local/include) and (libjpeg.a, libjpeg.la) under (/usr/local/lib) but I have no idea how to link/use this in my xCode project.
Can anyone link me to a tutorial or give me a push in the right direction?
If anyone successfully installed and used jpeg library please help..
This is a bit of a pain, because you will need to compile LibJPEG for two architectures: ARM, for iOS, and x86, for the simulator.
Your best bet is to use NSImage or CGImage. There already is a JPEG library on iOS, supplied with the system, so you don't need to use LibJPEG.
An alternative is to put the LibJPEG sources directly into your project (including the *.c files). This way, they will be built correctly for different architectures (simulation and deployment).
You could also just build for ARM, and then forget about running the simulator.
Or you could build LibJPEG as a fat binary by compiling it twice and combining the resulting library (libjpeg.a) from each compilation with libtool.
libtool -static path/to/arm/libjpeg.a path/to/x86/libjpeg.a -o libjpeg.a
You can see why the recommendation is to use NSImage or CGImage. Better to use a library that is already installed rather than try to build and install a new one.
How to make a fat static library
Since it sounds like you want to do things the hard way, here is an example of how to build a fat static library for i386 and ppc architectures. This was done on a PowerPC OS X box, you will have to adjust if you want to compile for ARM and i386.
Note that you have to specify --host and --build for cross-compiling. The values below are correct for my computer, but I am certain that they are wrong for your computer.
$ cd jpeg-8d
$ mkdir build-ppc build-i386
$ cd build-ppc
$ ../configure CFLAGS='-arch ppc -O2 -g' LDFLAGS='-arch ppc' \
--enable-static --disable-shared
$ make -j2
$ cd ../build-i386
$ ../configure CFLAGS='-arch i386 -O2 -g' LDFLAGS='-arch i386' \
--enable-static --disable-shared \
--build=powerpc-apple-darwin9.8.0 --host=i386-apple-darwin9.8.0
$ make -j2
$ cd ..
$ file build-ppc/.libs/libjpeg.a
build-ppc/.libs/libjpeg.a: current ar archive random library
$ file build-i386/.libs/libjpeg.a
build-i386/.libs/libjpeg.a: current ar archive random library
$ libtool -static build-*/.libs/libjpeg.a -o libjpeg.a
$ file libjpeg.a
libjpeg.a: Mach-O universal binary with 2 architectures
libjpeg.a (for architecture i386): current ar archive random library
libjpeg.a (for architecture ppc): current ar archive random library

compiling ffmpeg with librtmp and libx264

I have compiled librtmp from http://rtmpdump.mplayerhq.hu/ and also libx264.
I am finding it difficult to compile ffmpeg with --enable-librtmp and --enable-libx264 options.
Keep on getting Error: librtmp not found or Error: libx264 not found.
I have librtmp.a and libx264.a files in /usr/local/lib folder.
I don't know how to resolve this issue. If someone has compiled ffmpeg with librtmp enable please let me know how to do.
All the above is for iPhone 4.2/4.3 sdk with Intel mac 10.6.6.
Thank u very much for any help.
Have you updated the dynamic linker run-time bindings since you installed librtmp and libx264?
You should run: ldconfig As root.
Hi yeah I compiled ffmpeg with librtmp and libx264
make sure that libx264 is also configured with --enable-shared
AFAIK, ffmpeg may require shared library of libx264
also make sure that PKG_CONFIG_PATH value contatins the the folder path that includes libx264.pc and librtmp.pc files

Mac OS .deb packaging trouble

I've searched a lot, but didn't find the solution.
I need to package my ios app into .deb.
I have installed Mac Ports and dpkg, I have control file in DEBIAN folder in MyApp folder
I run /opt/local/bin/dpkg-deb -b MyApp and get error.
dpkg-deb: ignoring 3 warnings about the control file(s)
Can't use format gnu: No such format 'gnu': Invalid argument
There is another topic: How to create .deb packages on Mac OS X, but no answer to this question.
I assume you are using a tar implementation that does not support the GNU tar fotrmat, which dpkg-deb expects for its usage.
You should install GNU tar and either recompile dpkg to use that (usually named gtar) instead of simply the executable tar, or prepare a PATH environment to prefer the GNU tar when using dpkg-deb.
Newer dpkg versions detect this requirement at build time and will abort the build, to make sure this does not happen.