libav

How to Convert CMSampleBuffer/UIImage into ffmpeg's AVPicture?

自作多情 提交于 2019-12-03 04:36:47
问题 I'm trying to encode iPhone's camera frames into a H.264 video using ffmpeg's libav* libraries. I found in this Apple's article how to convert CMSampleBuffer to UIImage, but how can I convert it to ffmpeg's AVPicture? Thanks. 回答1: Answering my own question: CVImageBufferRef pixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer); CVPixelBufferLockBaseAddress(pixelBuffer, 0); // access the data int width = CVPixelBufferGetWidth(pixelBuffer); int height = CVPixelBufferGetHeight(pixelBuffer);

How to convert sample rate from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16?

前提是你 提交于 2019-12-03 02:27:40
问题 I am decoding aac to pcm with ffmpeg with avcodec_decode_audio3. However it decodes into AV_SAMPLE_FMT_FLTP sample format (PCM 32bit Float Planar) and i need AV_SAMPLE_FMT_S16 (PCM 16 bit signed - S16LE). I know that ffmpeg can do this easily with -sample_fmt. I want to do the same with the code but i still couldn't figure it out. audio_resample did not work for: it fails with error message: .... conversion failed. 回答1: EDIT 9th April 2013 : Worked out how to use libswresample to do this...

How to convert sample rate from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16?

一笑奈何 提交于 2019-12-02 16:01:12
I am decoding aac to pcm with ffmpeg with avcodec_decode_audio3. However it decodes into AV_SAMPLE_FMT_FLTP sample format (PCM 32bit Float Planar) and i need AV_SAMPLE_FMT_S16 (PCM 16 bit signed - S16LE). I know that ffmpeg can do this easily with -sample_fmt. I want to do the same with the code but i still couldn't figure it out. audio_resample did not work for: it fails with error message: .... conversion failed. EDIT 9th April 2013 : Worked out how to use libswresample to do this... much faster! At some point in the last 2-3 years FFmpeg's AAC decoder's output format changed from AV_SAMPLE

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

illegal text reloc to non_lazy_ptr error while building in xcode 4 with libav* libraries

不打扰是莪最后的温柔 提交于 2019-12-01 05:46:33
问题 I'm trying to build a simple application that uses ffmpeg's libav* libraries in xcode 4 and getting the following error: ld: illegal text reloc to non_lazy_ptr from /ffmpeg/temp/ffmpeg-0.8/builduni/lib/libavcodec.a(ac3.o) in _ff_ac3_bit_alloc_calc_psd for architecture i386 I've already tried to run ranlib -c libavcodec.a to fix this problem, but nothing happend. One more thing: my libav* libraries are fat binaries (i386 + x86_64). Any ideas what can it be? 回答1: I have the same error. Finally,

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()

Linker error when unit testing: ld: illegal text-relocation to cstring in … from _av_image_check_size in …/libavutil.a(imgutils.o)

陌路散爱 提交于 2019-12-01 02:59:55
问题 In Xcode 4.3.2, building an iPad app, which includes libavutil.a from the ffmpeg distribution, it builds and runs correctly but when I try to run unit tests (Cmd-U) I get the following linker error: ld: illegal text-relocation to cstring in /myPath/libavutil.a(imgutils.o) from _av_image_check_size in /myPath/libavutil.a(imgutils.o) for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation) This is on the device (We can't run it in the simulator

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

Set RTSP/UDP buffer size in FFmpeg/LibAV

回眸只為那壹抹淺笑 提交于 2019-11-30 16:10:46
Note : I'm aware ffmpeg and libav are different libraries . This is a problem common to both. Disclaimer : Duplicate of SO question marked as answered but actually didn't give a proper solution. Insufficient UDP buffer size causes broken streams for several high resolution video streams. In LibAV/FFMPEG it's possible to set the udp buffer size for udp urls (udp://...) by appending some options (buffer_size) to it. However, for RTSP urls this is not supported . These are the only solutions I've found: Rebuilding ffmpeg/libav changing the UDP_MAX_PKT_SIZE in the udp.c source file. Using a nasty