libavcodec

problem: FFMPEG seeking with av_seek_frame using byte positions

爷,独闯天下 提交于 2019-11-28 22:58: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

What is ffmpeg, avcodec, x264? [closed]

前提是你 提交于 2019-11-28 22:01:26
From wiki , I read that FFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line program for transcoding multimedia files. So ffmpeg is a wrapper of avcodec? And I often hear that people encode video with x264 using ffmpeg. So ffmpeg is also a wrapper of x264? How are they related ? First of all, to clear up some terms: FFmpeg is a software project with

Encode audio to aac with libavcodec

江枫思渺然 提交于 2019-11-28 20:45:12
I'm using libavcodec (latest git as of 3/3/10) to encode raw pcm to aac (libfaac support enabled). I do this by calling avcodec_encode_audio repeatedly with codec_context->frame_size samples each time. The first four calls return successfully, but the fifth call never returns. When I use gdb to break, the stack is corrupt. If I use audacity to export the pcm data to a .wav file, then I can use command-line ffmpeg to convert to aac without any issues, so I'm sure it's something I'm doing wrong. I've written a small test program that duplicates my problem. It reads the test data from a file,

Reading a file located in memory with libavformat

若如初见. 提交于 2019-11-28 16:24:16
I'm currently trying to read small video files sent from a server In order to read a file using libavformat, you are supposed to call av_open_input_file(&avFormatContext, "C:\\path\\to\\video.avi", 0, 0, 0); The problem is that in this case the file is not on the disk, but in memory. What I'm doing for the moment is downloading the file, writing it on the disk using a temporary name, and then calling av_open_input_file with the temporary file name, which is not a very clean solution. In fact what I want is a function like av_open_custom(&avFormatContext, &myReadFunction, &mySeekFunction); but

Problem to Decode H264 video over RTP with ffmpeg (libavcodec)

删除回忆录丶 提交于 2019-11-28 16:15:52
I set profile_idc, level_idc, extradata et extradata_size of AvCodecContext with the profile-level-id et sprop-parameter-set of the SDP. I separate the decoding of Coded Slice, SPS, PPS and NAL_IDR_SLICE packet : Init: uint8_t start_sequence[]= {0, 0, 1}; int size= recv(id_de_la_socket,(char*) rtpReceive,65535,0); Coded Slice : char *z = new char[size-16+sizeof(start_sequence)]; memcpy(z,&start_sequence,sizeof(start_sequence)); memcpy(z+sizeof(start_sequence),rtpReceive+16,size-16); ConsumedBytes = avcodec_decode_video(codecContext,pFrame,&GotPicture,(uint8_t*)z,size-16+sizeof(start_sequence))

FFmpeg decode raw buffer with avcodec_decode_video2

与世无争的帅哥 提交于 2019-11-28 07:51:34
I am receiving a h264 stream where I at least know the size of one frame. The stream is coming in right as I can store it in a file and playback with vlc. Playing back a file is no problem for me as I include the libavformat. But libavformat gives me back an AVPacket which I can directly give to avcodec_decode_video2. In this case I got a bytestream. How can I give the raw h264 stream to the avcodec_decode_video2? How can I wrap my data into a AVPacket. VLC does not need to guess any data. It is more or less easy to decode a stream. This code is working perfect for me: class

ffmpeg: RGB to YUV conversion loses color and scale

冷暖自知 提交于 2019-11-28 02:13:57
问题 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-

Reading a file located in memory with libavformat

烈酒焚心 提交于 2019-11-27 19:58:25
问题 I'm currently trying to read small video files sent from a server In order to read a file using libavformat, you are supposed to call av_open_input_file(&avFormatContext, "C:\\path\\to\\video.avi", 0, 0, 0); The problem is that in this case the file is not on the disk, but in memory. What I'm doing for the moment is downloading the file, writing it on the disk using a temporary name, and then calling av_open_input_file with the temporary file name, which is not a very clean solution. In fact

sws_scale YUV --> RGB distorted image

情到浓时终转凉″ 提交于 2019-11-27 16:27:35
问题 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

What is ffmpeg, avcodec, x264? [closed]

核能气质少年 提交于 2019-11-27 13:16:50
问题 From wiki, I read that FFmpeg is a free software project that produces libraries and programs for handling multimedia data. The most notable parts of FFmpeg are libavcodec, an audio/video codec library used by several other projects, libavformat, an audio/video container mux and demux library, and the ffmpeg command line program for transcoding multimedia files. So ffmpeg is a wrapper of avcodec? And I often hear that people encode video with x264 using ffmpeg. So ffmpeg is also a wrapper of