libavformat

How to convert YUV420P image to JPEG using ffmpeg's libraries?

帅比萌擦擦* 提交于 2019-12-02 06:31:55
I'm trying to convert a YUV420P image ( AV_PIX_FMT_YUV420P ) to a JPEG using ffmpeg's libavformat and libavcodec . This is my code so far: AVFormatContext* pFormatCtx; AVOutputFormat* fmt; AVStream* video_st; AVCodecContext* pCodecCtx; AVCodec* pCodec; uint8_t* picture_buf; AVFrame* picture; AVPacket pkt; int y_size; int got_picture=0; int size; int ret=0; FILE *in_file = NULL; //YUV source int in_w = 720, in_h = 576; //YUV's width and height const char* out_file = "encoded_pic.jpg"; //Output file in_file = fopen(argv[1], "rb"); av_register_all(); pFormatCtx = avformat_alloc_context(); fmt =

How to decode AAC using avcodec_decode_audio4?

六月ゝ 毕业季﹏ 提交于 2019-12-01 07:13:04
I changed in my code avcodec_decode_audio3 to avcodec_decode_audio4 and added the frame handling. But now I cannot decode AAC frames anymore. Why does avcodec_decode_audio4 return -22 ( invalid argument )? Following the answer below, does this have something to do with the parameters in AVContext that need to be set? I had to use avcodec_decode_audio4 because I updated my ffmpeg and then got the following error: [NULL @ 0xb14f020] Custom get_buffer() for use withavcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer [NULL @ 0xb14f020] Please port your application to

How to decode AAC using avcodec_decode_audio4?

泪湿孤枕 提交于 2019-12-01 04:11:11
问题 I changed in my code avcodec_decode_audio3 to avcodec_decode_audio4 and added the frame handling. But now I cannot decode AAC frames anymore. Why does avcodec_decode_audio4 return -22 ( invalid argument )? Following the answer below, does this have something to do with the parameters in AVContext that need to be set? I had to use avcodec_decode_audio4 because I updated my ffmpeg and then got the following error: [NULL @ 0xb14f020] Custom get_buffer() for use withavcodec_decode_audio3()

How to use libavformat to concat 2 video files with same codec (re-muxing)?

霸气de小男生 提交于 2019-11-30 21:45:09
I have downloaded videos from CDN in flv format (video H264 and audio AAC) and remux to them to MP4 format. But videos are limited by length. So i've downloaded each video in several parts: started at start point, at point 1, at point 2 (by using seek parameter in url). Each point starts little earlier than ending of previous one. Using av_read_frame i scanned all parts and found that intersecting packets not only have same sizes and order but also their dts/pts shifted from each other by constant value. So to concat starting video with video started at point 1 I must do following: 1. Create

How can I turn libavformat error messages off

那年仲夏 提交于 2019-11-30 19:03:47
By default, libavformat writes error messages to stderr , Like: Estimating duration from bitrate, this may be inaccurate How can I turn it off? or better yet, pipe it to my own neat logging function? Edit: Redirecting stderr to somewhere else is not acceptable since I need it for other logging purposes, I just want libavformat to not write to it. Looking through the code, it appears you can change the behavior by writing your own callback function for the av_log function. From the description of this function in libavutil/log.h : Send the specified message to the log if the level is less than

Linking libavformat in Visual Studio 2010

允我心安 提交于 2019-11-30 16:13:16
I'm attempting to build some video-reading code around libavformat. After getting the compiled DLLs and .lib files here , I go to build my code, and the linker can't find any of the libavformat symbols even though I've linked in the provided .lib files. Inspecting libavformat.lib with dumpbin -headers reveals that it exports the desired functions with an underscore prefix. For example, while I want to call avformat_open_input , the .lib file gives _avformat_open_input . Why is this, and why can't I link the precompiled dlls? You need to do following all tasks to use libav with MSVC++ . First

Is there a set of working P/Invoke declarations for FFMpeg, libavutil, libavformat and libavcodec in .NET?

淺唱寂寞╮ 提交于 2019-11-30 13:54:27
I'm currently looking to access libavutil, libavformat and libavcodec (all part of FFMpeg) from .NET. Currently, I'm getting the libraries from the automated builds of the shared FFMpeg package performed every night for Windows 32-bit. I am also using the code from the ffmpeg-sharp project . In that project, I have removed a number of classes that were not compiling (they are wrapper classes not the P/Invoke declarations). The code compiles fine, but I am running into a few issues. First, it appears that the build of av*.dll uses the cdecl calling convention , as I was receiving a number of

How can libavformat be used without using other libav libraries?

筅森魡賤 提交于 2019-11-30 05:50:33
I would like a simple working example of using just libavformat to mux video. There are nice examples ( doc/examples/muxing.c ) that show encoding with libavcodec, muxing with libavformat and saving the data with libavio. However, there is no example I know of that uses libavformat by itself, feeding in encoded data in a buffer and getting muxed data in a buffer. The difficulty is two-fold: one, adding a stream with avformat_new_stream(AVFormatContext *s, const AVCodec *c) requires a reference to the codec; and two, the output from muxing is passed to AVFormatContext->pb which is an

How to use libavformat to concat 2 video files with same codec (re-muxing)?

丶灬走出姿态 提交于 2019-11-29 22:14:36
问题 I have downloaded videos from CDN in flv format (video H264 and audio AAC) and remux to them to MP4 format. But videos are limited by length. So i've downloaded each video in several parts: started at start point, at point 1, at point 2 (by using seek parameter in url). Each point starts little earlier than ending of previous one. Using av_read_frame i scanned all parts and found that intersecting packets not only have same sizes and order but also their dts/pts shifted from each other by

Is there a set of working P/Invoke declarations for FFMpeg, libavutil, libavformat and libavcodec in .NET?

时光总嘲笑我的痴心妄想 提交于 2019-11-29 19:14:22
问题 I'm currently looking to access libavutil, libavformat and libavcodec (all part of FFMpeg) from .NET. Currently, I'm getting the libraries from the automated builds of the shared FFMpeg package performed every night for Windows 32-bit. I am also using the code from the ffmpeg-sharp project. In that project, I have removed a number of classes that were not compiling (they are wrapper classes not the P/Invoke declarations). The code compiles fine, but I am running into a few issues. First, it