This question already has an answer here:
What is ffmpeg, avcodec, x264? [closed]
(1 answer)
Closed 9 years ago.
So I'm trying to compile the H.264 codec so that I can use it to enhance performance in NoMachine as per https://www.nomachine.com/AR10K00695
Instructions below deal with the following possible cases on server
host:
Case 1: You don't have x264 library already compiled
Case 2: You have x264 library already compiled
and on client host:
Case 1: You have FFmpeg already installed
Case 2: You don't have FFmpeg installed
Case 3: You have FFmpeg libraries already compiled
The weird thing is that it states that you compile x264 on the server and ffmpeg on the client. Shouldn't you have either have x264 compiled on both the server and the client or ffmpeg on the server and the client?
Why use two different codecs for the server and the client?
We rewrote the article since it was not doing a good job of explaining the subtleties we wanted to present. Encoder and decoder in FFmpeg are different codecs, developed by different developers and with different licenses. FFmpeg provides a H.264 decoder in the default build, but not the encoder. Additionally, when FFmpeg is built with the H.264 encoder, the default build links the encoder statically, so that other applications can't use it. This means that in most cases the encoder must be built separately.
Anyway this is not important for the end-users :-) If you want to use H.264 on the NoMachine client just install FFmpeg from the repository of your Linux distribution or install a Windows or Mac build from one of the sites providing it. If you want to use H.264 on the server, install a FFmpeg package including libx264 as a shared library or build it yourself using the instructions you find on the website.
Note also that NoMachine on Windows and Mac uses the codecs provided by the OS, which have the additional benefit of often being HW accelerated, with the FFmpeg SW codecs used as fallback in the case no suitable encoder or decoder can be initialized.
The NoMachine Team
Related
I want to encode images to H264 video in OpenCV.
As part of my software for image tracking, I'm using VideoWriter in OpenCV 3.4 (64-bit) with Visual Studio 2017 C++. I use ffmpeg for manual encoding, and as it comes with OpenCV I assume this is the best option. My version of OpenCV indicates it has been compiled with ffmpeg, and I can verify it loads the opencv_ffmpeg340_64.dll.
Decoding H264 (AVC1) is absolutely fine, including when specifically using the ffmpeg API. But encoding anything other than MJPG or raw images doesn't work:
VideoWriter.Open() mostly returns false, for some cases it only writes an empty or small header but won't write frames. I've tried not only the ffmpeg API, but also any available API. Redirecting console/debug output to intermediate window in VC doesn't give any messages from OpenCV or ffmpeg.
There are numerous posts on previous versions of OpenCV using FFmpeg, including (Cisco) OpenH264 library and difficulties using this. I've tried many options, installing codecs pack including H264, ffmpeg static version, Cisco openH264 library, setting paths etc and even tried the low level ffmpeg library functions such as cvCreateVideoWriter exposed in OpenCV, and using different video containers (AVI, MPG, MP4) as well as fourcc strings.
I can't believe in 2018 the great OpenCV with FFmpeg support is unable to encode anything but arcane MJPG or raw images. If it uses FFmpeg surely a significant set of functionality should be available?
Though I think this should work, my next best option would be using a separate ffmpeg library, which would ironically add another ffmpeg.dll to my solution I imagine. Any suggestion appreciated!
Code fragment (using any video encoding API):
VideoWriter writer;
int codec = VideoWriter::fourcc('X', '2', '6', '4');
writer.open("test.avi", codec, 30, colorImage.size(), true);
writer.write(colorImage);
writer.release();
To answer my own question - thank you for the previous suggestions though - I've managed to create and write frames to H264 video now, without any recompiling needed. This is what I've used:
Using OpenCV version 3.4.1
In the same folder as the exe: opencv_ffmpeg341_64.dll (provided with OpenCV)
In the same folder: openh264-1.7.0-win64.dll (available from: https://github.com/cisco/openh264/releases)
Use OpenCV VideoWriter class, omitting a specific encoding API
Container: MP4
Codec fourcc string: "H264"
I formatted my machine (Windows 10 64bit) so I can't exclude any issues with potential codec-clashing - also I have not fully tested for other combinations. As this appears to be such a common problem (with many misconceptions) I hope this is useful.
I have created a Qt 5.8 web engine based application but unfortunately, the video is not playing in the application.
After coming across many forums I found that I need to build QT with flag proprietary-codec
But this solution comes with the warning: When distributing proprietary codec libraries, you must acquire licenses for them.
Unfortunately, I can't use these proprietary codec libraries.
If I use open source codec libraries do I need to compile QT again with some other flag.
Is there any other solution to this approach.
Unfortunately for mp4 file format using proprietary codecs is the only option (i.e. this includes acquiring licenses to distribute and configuring/building Qt with the option you specified already in your question).
From Qt docs:
Qt WebEngine supports the MPEG-4 Part 14 (MP4) file format only if the required proprietary audio and video codecs, such as H.264 and MPEG layer-3 (MP3), have been enabled.
When I use gst-play-1.0 to play any video source on ubuntu system, what I could see is, it is using very old gstreamer version i.e. gst-launch-1.0, GStreamer 1.2.4 using function gst_version (&major, &minor, µ, &nano).
When I listed all installed gstreamer versions I observed that gstreamer-1.8.2 is also present.
So, my question is how to change or linked the latest version of gstreamer.
The title of this question is misleading, and the question is actually an operating system question rather than a gstreamer question. Assuming you have a Linux OS you can create an alias.
creating an alias
I have a Qt 5.3 application that plays videos which works fine for some videos. Unfortunately when given some .mov files, I either get a QMediaPlayer::FormatError or I can hear audio but no video.
I am assuming this is due to missing codecs, is there a way to add support so that I can play the videos?
EDIT: This is on OS X
QMediaPlayer can play any format that the platform's media service supports. You should install the right codecs for a video type to be played successfully. Try to install GStreamer codecs on Linux. If you are on Windows install KLite Codecs.
QtMultimedia's implemention is platform dependent (uses direct show on windows, gstream on linux etc). May be it is good to consider using libraries like QtAV or libVLC.
They work for most platforms and no additional codecs and plugins are required to install.
I would like to play mov-files (Quicktime videos) in a Qt-application. As far as I see, QMediaPlayer is not capable to play this format. Does anybody know how to upgrade QMediaPlayer or know a good library to use or any other solution (except libVLC)?
Thanks
QMediaPlayer can play any format that the platform's media service supports. You should install the right codecs for a video type to be played successfully. Try to install GStreamer codecs on Linux. If you are on Windows install KLite Codecs.
QtMultimedia's implemention is platform dependent (uses direct show on windows, gstream on linux etc). May be it is good to consider using libraries like QtAV or libVLC.
They work for most platforms and no additional codecs and plugins are required to install.