libavcodec

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

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 to encode h.264 with libavcodec/x264?

本秂侑毒 提交于 2019-11-30 10:16:18
问题 I am attempting to encode video using libavcodec/libavformat. Audio works great, but when I try to encode video I get the following errors: [libx264 @ 0x10182a000]broken ffmpeg default settings detected [libx264 @ 0x10182a000]use an encoding preset (vpre) easy to fix using the command line ffmpeg, but I am trying to do this in C. my options are AVStream *pVideoOutStream = av_new_stream(pOutFormatCtx, 0); AVCodecContext *pVideoOutCodecCtx = pVideoOutStream->codec; pVideoOutCodecCtx->codec_id =

Why decoding frames from avi container and encode them to h264/mp4 doesn't work?

爷,独闯天下 提交于 2019-11-30 05:29:58
问题 I started using ffmpeg and I want to convert avi file to mp4/h264 file. I've read many posts including this, but I couldn't find any good example how to save frames to mp4 file. The code below is simplified one that decodes frames from avi file and encode it to H264/mp4 file, but when I save the frames the mp4 file cannot be played. I think I do somethinkg wrong in encoding I will appreciate if you could tell me what is wrong and how to fix it. const char* aviFileName = "aviFrom.avi"; const

problem: FFMPEG seeking with av_seek_frame using byte positions

本小妞迷上赌 提交于 2019-11-30 02:06:48
I am trying to get the av_seek_frame() function to go to a byte position I specify. I am implementing a frame accurate seeking mechanism for my application, and the way I see it, I will scan the entire video file, and store byte positions for each keyframe in a struct. I found out where to get the current byte position: AVPacket.pos. I now test this position with av_seek_frame like this: av_seek_frame( pFormatCtx, videoStream, 110285594, AVSEEK_FLAG_BYTE); However, this does not seem to do the right thing, when I call av_read_frame , it just starts with frame 23. If I do not seek, it starts at

How to encode h.264 with libavcodec/x264?

淺唱寂寞╮ 提交于 2019-11-29 19:39:21
I am attempting to encode video using libavcodec/libavformat. Audio works great, but when I try to encode video I get the following errors: [libx264 @ 0x10182a000]broken ffmpeg default settings detected [libx264 @ 0x10182a000]use an encoding preset (vpre) easy to fix using the command line ffmpeg, but I am trying to do this in C. my options are AVStream *pVideoOutStream = av_new_stream(pOutFormatCtx, 0); AVCodecContext *pVideoOutCodecCtx = pVideoOutStream->codec; pVideoOutCodecCtx->codec_id = CODEC_ID_H264; pVideoOutCodecCtx->codec_type = CODEC_TYPE_VIDEO; pVideoOutCodecCtx->bit_rate =

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

ffmpeg: RGB to YUV conversion loses color and scale

巧了我就是萌 提交于 2019-11-29 08:51:03
I am trying to convert RGB frames to YUV420P format in ffmpeg/libav. Following is the code for conversion and also the images before and after conversion. The converted image loses all color information and also the scale changes significantly. Does anybody have idea how to handle this? I am completely new to ffmpeg/libav! // Did we get a video frame? if(frameFinished) { i++; sws_scale(img_convert_ctx, (const uint8_t * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize); //============================================================== AVFrame

sws_scale YUV --> RGB distorted image

别来无恙 提交于 2019-11-29 02:08:24
I want to convert YUV420P image (received from H.264 stream) to RGB , while also resizing it, using sws_scale . The size of the original image is 480 × 800 . Just converting with same dimensions works fine. But when I try to change the dimensions, I get a distorted image, with the following pattern: changing to 481 × 800 will yield a distorted B&W image which looks like it's cut in the middle 482 × 800 will be even more distorted 483 × 800 is distorted but in color 484 × 800 is ok (scaled correctly). Now this pattern follows - scaling will only work fine if the difference between divides by 4.

Can anyone help in understanding AVFrame.linesize[]?

非 Y 不嫁゛ 提交于 2019-11-29 01:17:06
I tried to find what each cell of AVFrame.linesize[] means, but I didn't found. As I understood linesize[0] is the width, linesize[1] is the height. If I'm right what does other cells mean? why after avcodec_decode_video2(codecCtxDecode, frameDecoded, &frameFinished, &packet); only linesize[0] has the value and other cells are always 0? UPDATED I think AVFrame.data[i] and AVFrame.linesize[i] are the data of specific color in the row and the length of the row, am I correct? pogorskiy In the case of planar data, such as YUV420 , linesize[i] contains stride for the i -th plane. For example, for