Coder Social home page Coder Social logo

ffmpeg-cpp's Issues

Building ffmpeg libraries for Qt

I want to use your wrapper in Qt, but the libraries are built with a MSVS compiler. so, the Qt compiler won't work with these. Now I've tried to build the project with Qt, but I've got a lot of errors on the ffmpeg header files.
So I was wondering if I just could compile the libraries with MinGW?

Amerge filter

Hi,
Thank you very much for ffmpeg-cpp. Very useable.
Can you help me with amerge filter for merge two audio files?
My code:

Muxer* muxer = new Muxer("output.wav");
AudioCodec* codec = new AudioCodec(AV_CODEC_ID_ADPCM_IMA_WAV);
AudioEncoder* encoder = new AudioEncoder(codec, muxer);
Filter* filter = new Filter("amerge", encoder);

Demuxer* source1 = new Demuxer("audio1.wav");
source1->DecodeBestAudioStream(filter);

Demuxer* source2 = new Demuxer("audio2.wav");
source2->DecodeBestAudioStream(filter);

source1->PreparePipeline();
source2->PreparePipeline();

while (!source1->IsDone()) {
source1->Step();
source2->Step();
}
muxer->Close();

Output file consist only header.

Kind regards, Yevgeniy.

compiling error

I do not know if it is the problem of of enviroment. I cannot compile the example project successfully.
It complains something like this,
libav-cpp/av/Decoder.hpp:81:26: error: ‘Packet’ has not been declared

It seems that the complier cannot find the header files under av/ directory. But I see it is right when checking
message("AV files: ${AV_FILES}")

What is wrong with it? I did not make any change from the git repo.

OpenCV and RTMP

Hi,
ffmpeg for cpp is quite challenging so thanks. I was wondering if this could be used as well using openCV Mat as input, and RTMP output

Win32 version

Not an issue, more of a suggestion....

Have you thought about supporting x86/Win32 build as well as x64?
Seems like it would just involve modifying the download script to pull both versions and then fiddling project properties to link the correct version.

Really handy project. Thank you for doing this.

cannot support Alpha-Channel video?

I tested a video file with .webm format, and you can see its translucent effect in chrome. After decoding with ffmpeg-cpp, cv::Mat does have 4 channels, but the value of the alpha channel is all 255 , Is my operation incorrect?

cannot load nvcuda.dll

The build was successful, but when I've tried to run the demo.cpp it crashed.
in the demo.exe i've got following feedback:
Encoding video as H264 on Nvidia GPU... Applying filter transpose=cclock[middle];[middle]vignette to video... Pulling video from samples/carphone.h264... [h264_nvenc @ 000001f8d00602c0] Cannot load nvcuda.dll Could not open codecContext for codec: Operation not permitted
when going back to VS I see that the error got catched by the FFmpegException and output is the following:

'demo.exe' (Win32): Loaded 'C:\Windows\System32\cryptbase.dll'. Cannot find or open the PDB file.
The thread 0x1960 has exited with code 0 (0x0).
Exception thrown at 0x00007FFEB1B0A388 in demo.exe: Microsoft C++ exception: ffmpegcpp::FFmpegException at memory location 0x0000005F2E0FC420.
Exception thrown at 0x00007FFEB1B0A388 in demo.exe: Microsoft C++ exception: ffmpegcpp::FFmpegException at memory location 0x0000005F2E0FF750.
Unhandled exception at 0x00007FFEB1B0A388 in demo.exe: Microsoft C++ exception: ffmpegcpp::FFmpegException at memory location 0x0000005F2E0FF750.

The program '[15140] demo.exe' has exited with code 0 (0x0).

Is this library good for Real-time IP Camera Video capturing and recording?

First of all, Thank you so much for this awesome project!
Secondly can you please mention if this library is good for real-time IP Camera Video capturing and recording? If yes, can you please include an example project in samples showing how to use this repository to record a live stream? I mean a live video is usually an endless video so how we can configure this library to save the video continuously or after an interval?

A sample rtsp stream address:
rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

Best regards

For your information

@Raveler

Hello,

First over all, thanks a lot for sharing your code, ffmpeg-cpp is really a nice idea, and works already very well (including on Linux).

My purpose is to (at least I expect to) first understand and simply use your very nice API in another software (see https://framagit.org/ericb/miniDart ), as a part of the final software (big factorization and layout redesign in progress, but not yet published). And I'll very probably use your lib, for several reasons:

  • I'm impressed by the way filter are handled. This is really black magic (filters are the worst source code documentation ever in ffmpeg)
  • light (and fast !)
  • I'm not satified of OpenCV video recording, nor reliable and somewhere fully buggy, and difficult to use for recording.
  • your API seems extremely well designed (maybe some parts are missing, but easy to understand and use)
  • I'd like to remux sound from several sources (using SDL2 for the sources), and currently only ffmpeg, or lib555 are a correct answer for the final muxing.

Other change : I do not like Github (being tracked for everything by Microsoft and more, + some other reasons) I preferred fork your code somewhere else. See: https://framagit.org/ericb/ffmpeg-cpp2 .

If something is missing, please tell me, and I'll add the information.

Of course, feel free to ask if something could be reversed to your project. For example, I started to implement the recording from a webcam (mjpeg). Even if it is currently sub-optimal, it works well, and the only missing part is to display colored frames + record in a file (I'm exactly stuck there : how to record color channels btw ?).

Current WIP : understand more precisely the fileSink, inputstream and output handling.

Last but not least, and as I wrote in another issue, I completed the Linux build and everything seems to work. Currently, all the changes are under GPL V3 license, to protect my work, but that's not a problem for me to reverse some part under LGPL on demand (be carefull : I modified the tree, more easy on Linux). I forgot : miniDart is by default cross compiled on Linux, for Windows. I don"t use the last in the mood API, but I promise it works on Windows too.

filter output

Not an issue, but a request. Your library is very nice, elegant, thanks for providing! Background: I compiled FFmpeg 4.2.2 using msys2 / gcc7.3.0. I compiled ffmpeg-cpp into a DLL using Qt and gcc7.3.0. Examples I have compiled are working well. I am interested in audio filters. I have started with the filtering_audio example. How do I get the output of each filter? For example, loudnorm uses a 2-pass approach (see http://k.ylo.ph/2016/04/04/loudnorm.html), where you parse the output of the first pass, and use those parameters in the second. Would appreciate if you can provide guidance.

transcode to memory

Is there a way to set up a muxer recipient to be memory instead of file?

I need the transcoded and muxed output in a memory buffer rather than written to file.

Thanks

Andrea

support for latest ffmpeg version

hello,

this seems to a good library and learning point to understand ffmpeg.

when can we have the support for latest ffmpeg library.

thanks & regards,
Amit. K.

Setting packet duration

Hi, I'm learning to use FFmpeg and I have a question regarding this packet duration calculation:
pkt->duration = stream->time_base.den / stream->time_base.num / stream->avg_frame_rate.num * stream->avg_frame_rate.den;
https://github.com/Raveler/ffmpeg-cpp/blob/master/source/ffmpeg-cpp/ffmpeg-cpp/Muxing/VideoOutputStream.cpp#L82

I have also experienced the incorrect total duration/frame rate with h264/mp4, if packet duration is not set.

When encoding, I have just set packets' duration to 1 as they come out of the encoder (fair enough for CFR content) and then call av_packet_rescale_ts() to rescale it to the stream timebase.

Your calculation appears to be (1/Tb) * (1/Fr), where Tb is the stream timebase and Fr is the stream average framerate.
This will be constant for CFR streams, and equivalent to setting the duration to 1 before the rescale. So what is the benefit of doing this more complex calculation? If the stream is VFR isn't this duration pretty much always wrong? Isn't it kind of just a guess of the average frame duration so far/

Also, wouldn't it be better to use the AVRational math functions to do this calculation to prevent overflow and other potential issues.
e.g.:
pkt->duration = av_mul_q(av_inv_q(stream->time_base), av_inv_q(stream->avg_frame_rate));

I'd appreciate if you could offer any insight into this, and maybe explain why this line of code is the way it is.

Thank you!
-Nathan

Reading timecode metadata from file?

Hi! And thanks for making this code available (the only windows build-able ffmpeg that I could find).

I am trying to read the metadata from a .mov file, specifically timecode data.

Based on the 'print_info' example, this code:

VideoStreamInfo stream = info.videoStreams[i];
			cout << "Stream #" << (i + 1)
				<< ": codec " << stream.codec->name
				<< ", pixel format " << stream.formatName
				<< ", resolution " << stream.width << "x" << stream.height
				<< ", bit rate " << stream.bitRate << "kb/s"
				<< ", fps " << ((float)stream.frameRate.num / (float)stream.frameRate.den)
				<< ", time base " << stream.timeBase.num  << "/" << stream.timeBase.den
		
				<< ", " << demuxer->GetFrameCount(stream.id) << " frames"
				<< endl;

prints as expected, how can I read the timecode from the file in the same way?

Thanks again!

demo with 'GENERATED video failed

While checking if this lib I noticed I had to remove this line below to get the demo project to work with 'GENERATED' video output
it resets the frame and caused the next WriteFrame call to fail with 'Invalid argument' trown.

Removing this call seems to work for the demo. However perhaps this could cause mem leaks elsewhere since it unreferences buffers also. Liking the lib so far though ty!

Linux support

Having trouble interfacing with the ffmpeg C API directly from C++, I would like to give a try to ffmpeg-cpp.
Unfortunately, it's not that straightforward.

First of all, the windows only crtdbg.h is included from ffmpeg.h (and the later have a common name which could cause troubles on Linux).
This can be fixed by adding the proper #ifdef statement.

But then, I got the following error :

../FFmpegException.h:18:23: error: looser exception specification on overriding virtual function ‘virtual const char* ffmpegcpp::FFmpegException::what() const’ 18 | virtual char const* what() const

I do think this is specific to Windows exception implementation.

If someone is interested in, the CMakelists is attached.
It should go to source/ffmpeg-cpp/ffmpeg-cpp folder.
This is a very kick of, only files besides the CMakelists.txt are taken (nothing from subdirectories).
CMakeLists.txt

UDP streaming

@Raveler
I want to stream OpenGL buffer data through UDP, I am a beginner in FFmpeg and would like to know if your projects could append frames from the OpenGL rendering to a stream and the same could be either played or saved per frame after decoding.

Thank you for publishing your wonderful project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.