Questions tagged [avcodec]

avcodec is a free software/open source LGPL-licensed library of codecs for encoding and decoding video and audio data.

54 questions
29
votes
1 answer

Understanding PTS and DTS in video frames

I had fps issues when transcoding from avi to mp4(x264). Eventually the problem was in PTS and DTS values, so lines 12-15 where added before av_interleaved_write_frame function: 1. AVFormatContext* outContainer = NULL; 2. …
theateist
  • 13,879
  • 17
  • 69
  • 109
15
votes
1 answer

How can I create a FULL copy of a decoder?

I'm writing a video decoder (using FFMPEG/AVCodec) for a custom implementation of an mpeg4 video stream. The peculiarity of this video stream is that it could split into many "son" streams creating many P frames based on the same parent. The video…
damicolo
  • 161
  • 1
  • 7
13
votes
4 answers

ffmpeg::avcodec_encode_video setting PTS h264

I'm trying to encode video as H264 using libavcodec ffmpeg::avcodec_encode_video(codec,output,size,avframe); returns an error that I don't have the avframe->pts value set correctly. I have tried setting it to 0,1, AV_NOPTS_VALUE and 90khz *…
Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
8
votes
2 answers

FFMPEG decoding too slow (avcodec_send_packet() / avcodec_receive_frame())

I'm using ffmpeg libraries to decode, scale, and re-encode video within an MPEG transport stream. I've just recompiled from source to v3.3.2 and changed from the old avcodec_decode_video2() API to the new send/receive API. Both the old and new…
Danny
  • 2,482
  • 3
  • 34
  • 48
7
votes
2 answers

What's FFmpeg doing with avcodec_send_packet()?

I'm trying to optimise a piece of software for playing video, which internally uses the FFmpeg libraries for decoding. We've found that on some large (4K, 60fps) video, it sometimes takes longer to decode a frame than that frame should be displayed…
Jim
  • 71
  • 5
7
votes
0 answers

How to fill audio AVFrame (ffmpeg) with the data obtained from CMSampleBufferRef (AVFoundation)?

I am writing program for streaming live audio and video from webcamera to rtmp-server. I work in MacOS X 10.8, so I use AVFoundation framework for obtaining audio and video frames from input devices. This frames come into delegate: -(void)…
Aleksei2414904
  • 143
  • 1
  • 2
  • 7
6
votes
3 answers

avcodec_find_encoder(AV_CODEC_ID_H264) returns null

I am building an android application which will encode image captured from camera preview and later decode it. I am using ffmpeg library to encode and decode. To build static library with x264 I have used this tutorial.…
Monjura Rumi
  • 81
  • 1
  • 5
5
votes
1 answer

ffmpeg avcodec_encode_video2 hangs when using Quick Sync h264_qsv encoder

When I use the mpeg4 or h264 encoders, I am able to successfully encode images to make a valid AVI file using the API for ffmpeg 3.1.0. However, when I use the Quick Sync encoder (h264_qsv), avcodec_encode_video2 will hang some of the time. I found…
4
votes
2 answers

Play video frame by frame performance issues

I want to play a video (mostly .mov with Motion JPEG) in frame by frame mode with changing framerate. I have a function who gives me a framenumber and then I have to jump there. It will be mostly in one direction but can skip a few frames from time…
Patrick
  • 131
  • 1
  • 2
  • 10
4
votes
1 answer

avcodec YUV to RGB

I'm trying to convert an YUV frame to RGB using libswscale. Here is my code : AVFrame *RGBFrame; SwsContext *ConversionContext; ConversionContext = sws_getCachedContext(NULL, FrameWidth, FrameHeight, AV_PIX_FMT_YUV420P, FrameWidth, FrameHeight,…
MadMass
  • 313
  • 3
  • 10
4
votes
2 answers

How to force avcodec to use unaligned frame data planes?

I have been searching high and low for an option to force avcodec to use unaligned memory for its AVFrame data. Depending on the pixel format, the horizontal planes of an AVFrame->data may be padded with extra data to be aligned to memory for…
4
votes
0 answers

Video Create from a Image using avconv

I want create a video from a image,my code is avconv -f image2 -i test2.jpg -s 320X240 -r 30 -pix_fmt yuv420p -qmin 10 foo.mpg But I got a error VBV buffer size not set, muxing may fail How can I solve this?
Elby
  • 1,624
  • 3
  • 23
  • 42
3
votes
1 answer

Libavcodec "the procedure entry point for av_frame_alloc could not be located" error in Visual Studio 2017 C++ project

I am trying to use libavcodec from ffmpeg library in C++ with Visual Studio 2017 Community. I downloaded the latest x64 dev and shared builds from zeranoe (version 20171217), set up include directories and additional libraries in Visual Studio for…
Aves
  • 31
  • 3
3
votes
0 answers

FFmpeg get header size

The question is to get header size from format context (AVFormatContext) in ffmpeg. Now i'm using first packet position to get it: avformat_open_input(&m_formatContext, m_openedFilePath.toStdString().c_str(), NULL, NULL); //... AVPacket…
DEgITx
  • 960
  • 1
  • 13
  • 24
2
votes
1 answer

How to replace avcodec_encode_audio2()/avcodec_encode_video2() with avcodec_send_frame() and avcodec_receive_packet()?

In muxing example in link am attempting to use avcodec_send_frame() and avcodec_receive_packet() instead of avcodec_encode_audio2()/avcodec_encode_video2() as they are deprecated. In 352 ret = avcodec_encode_audio2(c, &pkt, frame,…
Optic_Ray
  • 63
  • 2
  • 8
1
2 3 4