libavcodec

How can I turn libavformat error messages off

感情迁移 提交于 2019-12-18 22:14:17
问题 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. 回答1: Looking through the code, it appears you can change the behavior by writing your own callback function for the av_log function. From the

FPS too high when saving video in mp4 container

你离开我真会死。 提交于 2019-12-18 16:47:52
问题 When I decode frames from avi file and then decode them in x264 and save to mp4 file, the fps of the output file is always 12,800. Therefore the file is played very fast. But, when I save the encoded in h264 frames in avi format and not mp4, so the fps is as I wanted - 25. What could be the problem? Here the code I wrote in VS2010: #include "stdafx.h" #include "inttypes.h" extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavutil/avutil.h" #include

Can anyone help in understanding AVFrame.linesize[]?

99封情书 提交于 2019-12-18 03:04:39
问题 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? 回答1: In the case of

What are the differences and similarities between ffmpeg, libav, and avconv?

社会主义新天地 提交于 2019-12-16 19:56:52
问题 When I run ffmpeg on Ubuntu, it shows: $ ffmpeg ffmpeg version v0.8, Copyright (c) 2000-2011 the Libav developers built on Feb 28 2012 13:27:36 with gcc 4.6.1 This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes). Or it shows (depending on the Ubuntu version): $ ffmpeg ffmpeg version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers built on Jan 24 2013 14:49:20 with gcc

FFMPEG Can't Display The Duration Of a Video

一笑奈何 提交于 2019-12-12 08:13:13
问题 I'm trying to use ffmpeg to capture frames from a video file, but I can't even get the duration of a video. everytime when I try to access it with pFormatCtx->duration I'm getting 0. I know the pointer initialized and contains the correct duration because if I use av_dump_format(pFormatCtx, 0, videoName, 0); then I actually get the duration data along with other information about the video. This is what I get when I use av_dump_format(pFormatCtx, 0, videoName, 0); : Input #0, avi, from

What is the official website for libavcodec?

六月ゝ 毕业季﹏ 提交于 2019-12-11 09:49:07
问题 I would like to use libavcodec for a project, the problem is i don't understand where i'm supposed to get the official release, this library is so popular that i can't tell what is the official website. for example there are 2 major projects like libav and ffmpeg that are using it but i can't find the official source. Where is this website ? 回答1: The official site is at ffmpeg.org. You can get the source with git or by using a release tarball. Git is recommended as it will provide the most up

Decode H264 video using libavcodec, C

折月煮酒 提交于 2019-12-11 03:52:43
问题 I'm trying to decode a raw h264 file with ffmpeg/libavcodec, but can't get it to work properly. Output should be a raw YUV-File for now. It's possible to compile the code with GCC gcc -o decoder decoder.c -L./lib/ -llibavcodec -llibavutil avcodec.dll, avutil.dll and swresample.dll must be placed in the directory for the .exe to start. Output in the CMD looks like this (only part of it, but its always like this): [h264 @ 00a80f20] reference picture missing during reorder [h264 @ 00a80f20]

ffmpeg record change color

时间秒杀一切 提交于 2019-12-11 01:28:03
问题 Im try record video from screen, for write to video file im use ffmpeg(libavcodec). But on result i see other colors, my example: AVCodec *codec; AVCodecContext *c= NULL; AVStream *video_stream; AVOutputFormat *out; AVFormatContext *out_context; int i, ret, x, y, got_output; AVFrame *frame; AVPacket pkt; uint8_t endcode[] = { 0, 0, 1, 0xb7 }; printf("Encode video file %s\n", filename); out = av_guess_format(NULL, filename, NULL); if (!out) { std::cout << "Could not deduce output format from

Convert .m4a to PCM using libavcodec

倖福魔咒の 提交于 2019-12-10 21:37:15
问题 I'm trying to convert a .m4a file to raw PCM file so that I can play it back in Audacity. According to the AVCodecContext it is a 44100 Hz track using the sample format AV_SAMPLE_FMT_FLTP which, to my understanding, when decodeded using avcodec_decode_audio4, I should get two arrays of floating point values (one for each channel). I'm unsure of the significance of the AVCodecContext's bits_per_coded_sample = 16 Unfortunately Audacity plays the result back as if I have the original track is

Create a copy of an AVPacket structure

帅比萌擦擦* 提交于 2019-12-10 11:35:53
问题 I'd like to make a copy of an AVPacket so that I can decode it later, when I like. The AVPacket is from the audio stream. av_dup_packet doesn't seem to work. AVPacket copy constructor does not work. Creating my own copy constructor causes memory corruption. 回答1: A way to copy an AVPacket structure: (that works) AVPacket newPacket(oldPacket); newPacket->data = reinterpret_cast<uint8_t*>(new uint64_t[(oldPacket->size + FF_INPUT_BUFFER_PADDING_SIZE)/sizeof(uint64_t) + 1]); memcpy(newPacket->data