From mc at enciris.com Fri Feb 1 17:00:02 2013 From: mc at enciris.com (=?iso-8859-1?Q?Malik_Ciss=E9?=) Date: Fri, 1 Feb 2013 11:00:02 -0500 Subject: [Libav-user] How to generate an index image files? In-Reply-To: <002601cdffcc$34700420$9d500c60$@coship.com> References: <002601cdffcc$34700420$9d500c60$@coship.com> Message-ID: <436399CBF77B614A9032D97E1D6E8AF163CE1B8985@VMBX116.ihostexchange.net> Hi, I have written an Mpeg-TS H.264 and AAC muxer. H.264 plays fine but AAC audio demuxing fails using FFMPEG (other players like WMP work). I receive "PES packet size mismatch" warning and the demuxed aac is corrupted. Here is the Mpeg Transport Stream file: ftp://public:enciris at ftp.enciris.com/output_mpegTs.ts Any idea what is wrong? Malik From lars.hammarstrand at gmail.com Sun Feb 3 00:04:20 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Sun, 3 Feb 2013 00:04:20 +0100 Subject: [Libav-user] xbmc: streaming m3u8 "playlists" causes stuttering video (How to debug trace/ffmpeg libs?) Message-ID: Hello folks! We are having some problems with the ffmpeg libraries in xbmc. Streaming * HLS M3U8* urls often causes stuttering video. For example, when testing the m3u8 url below, BANDWIDTH "984000" and "2793000" streams are stuttering, the rest works as normal. If you download the streams (ffmpeg -c copy) and play them locally they all work. All streams also works fine using mplayer2. Please have look at the xbmc forum link: "BUG No cache/buffer is used for m3u8 playlists, causes stuttering video". Also, check this recorded example of a stuttering video (same as in forum post #8): "SVT.Play.Screen.Recording.mp4" . Some questions: 1. Could this be it's buffering problem, i.e do we need to enable some sort of caching for m3u8 streams? 2. Are there any smart tricks we can use to debug/trace m3u8 streams with the ffmpeg libs? Any pointers, suggestions and ideas are appreciated! 3. Anyone seen a simular problem in the past? -- Thanks in advance! Regards, Lars. http://svtplay7m-f.akamaihd.net/i/se//open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/master.m3u8 ======================================================================================================================== #EXTM3U #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*984000*,RESOLUTION=768x432,CODECS="avc1.77.30, mp4a.40.5" http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_0_av.m3u8?null=&e=b2a7ace1bf661c32&id= #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*345000*,RESOLUTION=512x288,CODECS="avc1.66.30, mp4a.40.5" http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_1_av.m3u8?null=&e=b2a7ace1bf661c32&id= #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*561000*,RESOLUTION=512x288,CODECS="avc1.66.30, mp4a.40.5" http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_2_av.m3u8?null=&e=b2a7ace1bf661c32&id= #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*1677000*,RESOLUTION=1024x576,CODECS="avc1.77.30, mp4a.40.5" http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_3_av.m3u8?null=&e=b2a7ace1bf661c32&id= #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*2793000*,RESOLUTION=1280x720,CODECS="avc1.77.30, mp4a.40.5" http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_4_av.m3u8?null=&e=b2a7ace1bf661c32&id ======================================================================================================================= -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Sun Feb 3 01:27:47 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Sun, 3 Feb 2013 01:27:47 +0100 Subject: [Libav-user] xbmc: streaming m3u8 "playlists" causes stuttering video (How to debug trace/ffmpeg libs?) In-Reply-To: References: Message-ID: Forgot to add how xbmc opens and handles (demux) ffmpegs streams: "DVDDemuxFFmpeg.cpp - Line 233" (xbmc main repro) /Regards, Lars. On Sun, Feb 3, 2013 at 12:04 AM, Lars Hammarstrand < lars.hammarstrand at gmail.com> wrote: > Hello folks! > > We are having some problems with the ffmpeg libraries in xbmc. Streaming * > HLS M3U8* urls often causes stuttering video. For example, when testing > the m3u8 url below, BANDWIDTH "984000" and "2793000" streams are > stuttering, the rest works as normal. If you download the streams (ffmpeg > -c copy) and play them locally they all work. All streams also works fine > using mplayer2. Please have look at the xbmc forum link: "BUG No > cache/buffer is used for m3u8 playlists, causes stuttering video". > Also, check this recorded example of a stuttering video (same as in forum > post #8): "SVT.Play.Screen.Recording.mp4" > . > > Some questions: > > 1. Could this be it's buffering problem, i.e do we need to enable some > sort of caching for m3u8 streams? > 2. Are there any smart tricks we can use to debug/trace m3u8 streams with > the ffmpeg libs? Any pointers, suggestions and ideas are appreciated! > 3. Anyone seen a simular problem in the past? > -- > > Thanks in advance! > Regards, Lars. > > > > http://svtplay7m-f.akamaihd.net/i/se//open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/master.m3u8 > > ======================================================================================================================== > #EXTM3U > #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*984000*,RESOLUTION=768x432,CODECS="avc1.77.30, > mp4a.40.5" > > http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_0_av.m3u8?null=&e=b2a7ace1bf661c32&id= > #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*345000*,RESOLUTION=512x288,CODECS="avc1.66.30, > mp4a.40.5" > > http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_1_av.m3u8?null=&e=b2a7ace1bf661c32&id= > #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*561000*,RESOLUTION=512x288,CODECS="avc1.66.30, > mp4a.40.5" > > http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_2_av.m3u8?null=&e=b2a7ace1bf661c32&id= > #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*1677000*,RESOLUTION=1024x576,CODECS="avc1.77.30, > mp4a.40.5" > > http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_3_av.m3u8?null=&e=b2a7ace1bf661c32&id= > #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=*2793000*,RESOLUTION=1280x720,CODECS="avc1.77.30, > mp4a.40.5" > > http://svtplay7m-f.akamaihd.net/i/se/open/20130129/1230799-001A/DIVING_WITH_CRO-001A-23b378251ee65366_,900,348,564,1680,2800,.mp4.csmil/index_4_av.m3u8?null=&e=b2a7ace1bf661c32&id > > ======================================================================================================================= > -- > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From imrank at cdac.in Mon Feb 4 09:48:17 2013 From: imrank at cdac.in (Imran Khan) Date: Mon, 4 Feb 2013 14:18:17 +0530 (IST) Subject: [Libav-user] decoding H264 frames Message-ID: Hello All I am trying to decode raw H264 frames using libavcodec. After getting frames from webcam I am encoding it using H264 codec. After that I am passing these frames one by one to a H264 decoder. In decoder AVCodecContext I am setting width,height and pixel format only. Problem is decoder not decompressing the frames. the size of the frame are same as the encoded frame size. Can anyone tell me what may be the problem. Here is my decoder code... #include "video_decoder.h" using namespace std; uint8_t* rgb_bytes; AVFrame *alloc_dec_picture(enum PixelFormat pix_fmt, int width, int height){ AVFrame *picture; uint8_t *picture_buf; int size; picture = avcodec_alloc_frame(); if (!picture) return NULL; size = avpicture_get_size(pix_fmt, width, height); picture_buf = (uint8_t*)av_malloc(size); if (!picture_buf) { av_free(picture); return NULL; } avpicture_fill((AVPicture *)picture, picture_buf,pix_fmt, width, height); return picture; } VideoDecoder::VideoDecoder(){ avcodec_register_all(); avctx = NULL; picture = NULL; frame = NULL; } char* VideoDecoder::decoder_init(AVCodecID codec_id){ int error; AVCodec* codec; av_init_packet(&avpkt); codec = avcodec_find_decoder(codec_id); if(!codec){ return "codec not found"; } avctx = avcodec_alloc_context3(codec); if(!avctx){ return "can not allocate avcontext :: avocdec_alloc_context"; } avctx->width=640; avctx->height=480; avctx->pix_fmt=AV_PIX_FMT_YUV420P; if(codec->capabilities&CODEC_CAP_TRUNCATED) avctx->flags|= CODEC_FLAG_TRUNCATED; error = avcodec_open2(avctx ,codec ,NULL); if(error < 0 ){ return "can not open codec :: avcodec_open2"; } frame = avcodec_alloc_frame(); picture = alloc_dec_picture(PIX_FMT_RGB24, 640, 480); return "decoder init completed\n"; } char* VideoDecoder::decode_frame(uint8_t *frame_buffer, size_t data_length){ int w = 640; int h = 480; rgb_bytes =NULL; int memBytes = avpicture_get_size(PIX_FMT_RGB24 , avctx->width , avctx->height ); int len ,got_frame; avpkt.size = data_length; avpkt.data = frame_buffer; if(!frame_buffer){ return "frame buffer empty\n"; } len = avcodec_decode_video2(avctx ,frame ,&got_frame ,&avpkt); if( len < 0){ return "error while decoding\n"; } if( got_frame ){ static struct SwsContext *img_convert_ctx; if(img_convert_ctx == NULL) { img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P, avctx->width, avctx->height, PIX_FMT_BGR24, SWS_BICUBIC, NULL, NULL, NULL); if(img_convert_ctx == NULL) { return "Cannot initialize the conversion context!\n"; } } sws_scale(img_convert_ctx, frame->data , frame->linesize , 0, h ,picture->data, picture->linesize ); rgb_bytes = new uint8_t[memBytes]; memcpy(rgb_bytes ,picture->data ,memBytes); } rgb_bytes = new uint8_t[memBytes]; memcpy(rgb_bytes ,frame->data ,memBytes); av_free_packet(&avpkt); return "completed decoding\n"; } -- Thanks and Regards Imran Khan ------------------------------------------------------------------------------------------------------------------------------- This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. ------------------------------------------------------------------------------------------------------------------------------- From srkntmondal at gmail.com Mon Feb 4 10:25:56 2013 From: srkntmondal at gmail.com (srikanta mondal) Date: Mon, 4 Feb 2013 14:55:56 +0530 Subject: [Libav-user] decoding H264 frames In-Reply-To: References: Message-ID: The encoded raw data (nal[] units) can decode using ffmpeg library. You have to initialize the AVCodecContext there and pass each raw encoded-data to avcodec_decode_video2() method. On Mon, Feb 4, 2013 at 2:18 PM, Imran Khan wrote: > Hello All > > I am trying to decode raw H264 frames using libavcodec. After getting > frames from webcam I am encoding it using H264 codec. After that I am > passing these frames one by one to a H264 decoder. In decoder > AVCodecContext I am setting width,height and pixel format only. Problem > is decoder not decompressing the frames. the size of the frame are same as > the encoded frame size. Can anyone tell me what may be the problem. > > Here is my decoder code... > > #include "video_decoder.h" > > using namespace std; > > uint8_t* rgb_bytes; > > AVFrame *alloc_dec_picture(enum PixelFormat pix_fmt, int width, int > height){ > > AVFrame *picture; > > uint8_t *picture_buf; > > int size; > picture = avcodec_alloc_frame(); > > if (!picture) > return NULL; > > size = avpicture_get_size(pix_fmt, width, height); > > picture_buf = (uint8_t*)av_malloc(size); > > if (!picture_buf) { > > av_free(picture); > > return NULL; > > } > > avpicture_fill((AVPicture *)picture, picture_buf,pix_fmt, width, > height); > > return picture; > > } > > VideoDecoder::VideoDecoder(){ > > avcodec_register_all(); > > avctx = NULL; > > picture = NULL; > > frame = NULL; > > } > > > char* VideoDecoder::decoder_init(AVCodecID codec_id){ > > int error; > > AVCodec* codec; > > av_init_packet(&avpkt); > > codec = avcodec_find_decoder(codec_id); > > if(!codec){ > > return "codec not found"; > > > } > > avctx = avcodec_alloc_context3(codec); > > if(!avctx){ > > return "can not allocate avcontext :: > avocdec_alloc_context"; > > } > > avctx->width=640; > > avctx->height=480; > > avctx->pix_fmt=AV_PIX_FMT_YUV420P; > > if(codec->capabilities&CODEC_CAP_TRUNCATED) > avctx->flags|= CODEC_FLAG_TRUNCATED; > > error = avcodec_open2(avctx ,codec ,NULL); > > if(error < 0 ){ > > return "can not open codec :: avcodec_open2"; > > } > > frame = avcodec_alloc_frame(); > > picture = alloc_dec_picture(PIX_FMT_RGB24, 640, 480); > > return "decoder init completed\n"; > } > > char* VideoDecoder::decode_frame(uint8_t *frame_buffer, size_t > data_length){ > > int w = 640; > > int h = 480; > > rgb_bytes =NULL; > > int memBytes = avpicture_get_size(PIX_FMT_RGB24 , avctx->width , > avctx->height ); > > int len ,got_frame; > > avpkt.size = data_length; > > avpkt.data = frame_buffer; > > if(!frame_buffer){ > > return "frame buffer empty\n"; > > } > > len = avcodec_decode_video2(avctx ,frame ,&got_frame ,&avpkt); > > if( len < 0){ > > return "error while decoding\n"; > > } > > if( got_frame ){ > > static struct SwsContext *img_convert_ctx; > > if(img_convert_ctx == NULL) { > > img_convert_ctx = sws_getContext(w, h, > PIX_FMT_YUV420P, avctx->width, > avctx->height, PIX_FMT_BGR24, > SWS_BICUBIC, NULL, NULL, NULL); > > if(img_convert_ctx == NULL) { > > return "Cannot initialize the conversion context!\n"; > > } > > } > > sws_scale(img_convert_ctx, > frame->data , frame->linesize , > 0, h ,picture->data, > picture->linesize ); > > rgb_bytes = new uint8_t[memBytes]; > > memcpy(rgb_bytes ,picture->data ,memBytes); > > } > > rgb_bytes = new uint8_t[memBytes]; > > memcpy(rgb_bytes ,frame->data ,memBytes); > > > av_free_packet(&avpkt); > > return "completed decoding\n"; > } > > > -- > Thanks and Regards > Imran Khan > > > > > ------------------------------------------------------------------------------------------------------------------------------- > > This e-mail is for the sole use of the intended recipient(s) and may > contain confidential and privileged information. If you are not the > intended recipient, please contact the sender by reply e-mail and destroy > all copies and the original message. Any unauthorized review, use, > disclosure, dissemination, forwarding, printing or copying of this email > is strictly prohibited and appropriate legal action will be taken. > > ------------------------------------------------------------------------------------------------------------------------------- > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Mon Feb 4 10:41:08 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 4 Feb 2013 10:41:08 +0100 Subject: [Libav-user] FFusion for Win32 (was Re: porting FFusion codec to current FFmpeg libs - ParseContext1 ??) In-Reply-To: References: <7B07B13C-F379-4BE8-9F6D-F541576BBDD5@gmail.com> <0108394F-C3F2-46E6-98F1-E05DFE6A1F85@gmail.com> Message-ID: Quick (FWIW) update: I managed to hack together a version of the FFusion component that builds and functions with QuickTime for win32. Quick tests show playback performance that's about 1.5 - 2 times faster than with Apple's own decoding code. This is good news for another project I've been working on some time ago, but anyone interested can grab a copy here: github.com/RJVB/FFusion.git R. From imrank at cdac.in Mon Feb 4 10:42:51 2013 From: imrank at cdac.in (Imran Khan) Date: Mon, 4 Feb 2013 15:12:51 +0530 (IST) Subject: [Libav-user] decoding H264 frames In-Reply-To: References: , Message-ID: Sir I have initialized AVCodecContext (avctx) in init_decoder method.Actually I am not getting error from the decoder method. the return value from avcodec_decode_video2() is always same as the AVPacket size that I am passing into method. It is able to decode the frame because method is never returning zero or minus value. But the frame is containing distorted image. even if i am commenting the decode method the AVFrame (frame) contains same distorted image. Can you tell please me what default value AVFrame contains when it is allocated using avcodec_alloc_frame(). The decode method is not updating AVFrame while decompression. On Mon, Feb 4, 2013, srikanta mondal said: > --20cf307f3b345cbb5e04d4e2af87 > Content-Type: text/plain; charset=ISO-8859-1 > > The encoded raw data (nal[] units) can decode using ffmpeg library. You > have to initialize the AVCodecContext there and pass each raw encoded-data > to avcodec_decode_video2() method. > > On Mon, Feb 4, 2013 at 2:18 PM, Imran Khan wrote: > >> Hello All >> >> I am trying to decode raw H264 frames using libavcodec. After getting >> frames from webcam I am encoding it using H264 codec. After that I am >> passing these frames one by one to a H264 decoder. In decoder >> AVCodecContext I am setting width,height and pixel format only. Problem >> is decoder not decompressing the frames. the size of the frame are same as >> the encoded frame size. Can anyone tell me what may be the problem. >> >> Here is my decoder code... >> >> #include "video_decoder.h" >> >> using namespace std; >> >> uint8_t* rgb_bytes; >> >> AVFrame *alloc_dec_picture(enum PixelFormat pix_fmt, int width, int >> height){ >> >> AVFrame *picture; >> >> uint8_t *picture_buf; >> >> int size; >> picture = avcodec_alloc_frame(); >> >> if (!picture) >> return NULL; >> >> size = avpicture_get_size(pix_fmt, width, height); >> >> picture_buf = (uint8_t*)av_malloc(size); >> >> if (!picture_buf) { >> >> av_free(picture); >> >> return NULL; >> >> } >> >> avpicture_fill((AVPicture *)picture, picture_buf,pix_fmt, width, >> height); >> >> return picture; >> >> } >> >> VideoDecoder::VideoDecoder(){ >> >> avcodec_register_all(); >> >> avctx = NULL; >> >> picture = NULL; >> >> frame = NULL; >> >> } >> >> >> char* VideoDecoder::decoder_init(AVCodecID codec_id){ >> >> int error; >> >> AVCodec* codec; >> >> av_init_packet(&avpkt); >> >> codec = avcodec_find_decoder(codec_id); >> >> if(!codec){ >> >> return "codec not found"; >> >> >> } >> >> avctx = avcodec_alloc_context3(codec); >> >> if(!avctx){ >> >> return "can not allocate avcontext :: >> avocdec_alloc_context"; >> >> } >> >> avctx->width=640; >> >> avctx->height=480; >> >> avctx->pix_fmt=AV_PIX_FMT_YUV420P; >> >> if(codec->capabilities&CODEC_CAP_TRUNCATED) >> avctx->flags|= CODEC_FLAG_TRUNCATED; >> >> error = avcodec_open2(avctx ,codec ,NULL); >> >> if(error < 0 ){ >> >> return "can not open codec :: avcodec_open2"; >> >> } >> >> frame = avcodec_alloc_frame(); >> >> picture = alloc_dec_picture(PIX_FMT_RGB24, 640, 480); >> >> return "decoder init completed\n"; >> } >> >> char* VideoDecoder::decode_frame(uint8_t *frame_buffer, size_t >> data_length){ >> >> int w = 640; >> >> int h = 480; >> >> rgb_bytes =NULL; >> >> int memBytes = avpicture_get_size(PIX_FMT_RGB24 , avctx->width , >> avctx->height ); >> >> int len ,got_frame; >> >> avpkt.size = data_length; >> >> avpkt.data = frame_buffer; >> >> if(!frame_buffer){ >> >> return "frame buffer empty\n"; >> >> } >> >> len = avcodec_decode_video2(avctx ,frame ,&got_frame ,&avpkt); >> >> if( len < 0){ >> >> return "error while decoding\n"; >> >> } >> >> if( got_frame ){ >> >> static struct SwsContext *img_convert_ctx; >> >> if(img_convert_ctx == NULL) { >> >> img_convert_ctx = sws_getContext(w, h, >> PIX_FMT_YUV420P, avctx->width, >> avctx->height, PIX_FMT_BGR24, >> SWS_BICUBIC, NULL, NULL, NULL); >> >> if(img_convert_ctx == NULL) { >> >> return "Cannot initialize the conversion context!\n"; >> >> } >> >> } >> >> sws_scale(img_convert_ctx, >> frame->data , frame->linesize , >> 0, h ,picture->data, >> picture->linesize ); >> >> rgb_bytes = new uint8_t[memBytes]; >> >> memcpy(rgb_bytes ,picture->data ,memBytes); >> >> } >> >> rgb_bytes = new uint8_t[memBytes]; >> >> memcpy(rgb_bytes ,frame->data ,memBytes); >> >> >> av_free_packet(&avpkt); >> >> return "completed decoding\n"; >> } >> >> >> -- >> Thanks and Regards >> Imran Khan >> >> >> >> >> ------------------------------------------------------------------------------------------------------------------------------- >> >> This e-mail is for the sole use of the intended recipient(s) and may >> contain confidential and privileged information. If you are not the >> intended recipient, please contact the sender by reply e-mail and destroy >> all copies and the original message. Any unauthorized review, use, >> disclosure, dissemination, forwarding, printing or copying of this email >> is strictly prohibited and appropriate legal action will be taken. >> >> ------------------------------------------------------------------------------------------------------------------------------- >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > --20cf307f3b345cbb5e04d4e2af87 > Content-Type: text/html; charset=ISO-8859-1 > Content-Transfer-Encoding: quoted-printable > > The encoded raw data (nal[] units) can decode using ffmpeg library. You hav= > e to initialize the AVCodecContext there and pass each raw encoded-data to = > avcodec_decode_video2() method.

On Mon, F= > eb 4, 2013 at 2:18 PM, Imran Khan < mrank at cdac.in" target=3D"_blank">imrank at cdac.in> wrote:
> >
x #ccc solid;padding-left:1ex">Hello All
>
> I am trying to decode raw H264 frames using libavcodec. After getting
> frames from webcam I am encoding it using H264 codec. After that I am
> passing these frames one by one to a H264 decoder. In decoder
> AVCodecContext I am setting width,height and =A0pixel format only. Problem<= > br> > is decoder not decompressing the frames. the size of the frame are same as<= > br> > the encoded frame size. Can anyone tell me what may be the problem.
>
> Here is my decoder code...
>
> #include "video_decoder.h"
>
> using namespace std;
>
> uint8_t* rgb_bytes;
>
> AVFrame *alloc_dec_picture(enum PixelFormat pix_fmt, int width, int
> height){
>
> =A0 =A0 =A0 =A0 AVFrame *picture;
>
> =A0 =A0 uint8_t *picture_buf;
>
> =A0 =A0 int size;
> =A0 =A0 picture =3D avcodec_alloc_frame();
>
> =A0 =A0 if (!picture)
> =A0 =A0 =A0 =A0 return NULL;
>
> =A0 =A0 size =3D avpicture_get_size(pix_fmt, width, height);
>
> =A0 =A0 picture_buf =3D (uint8_t*)av_malloc(size);
>
> =A0 =A0 if (!picture_buf) {
>
> =A0 =A0 =A0 =A0 av_free(picture);
>
> =A0 =A0 =A0 =A0 return NULL;
>
> =A0 =A0 }
>
> =A0 =A0 avpicture_fill((AVPicture *)picture, picture_buf,pix_fmt, width,> > height);
>
> =A0 =A0 return picture;
>
> }
>
> VideoDecoder::VideoDecoder(){
>
> =A0 =A0 =A0 =A0 avcodec_register_all();
>
> =A0 =A0 =A0 =A0 avctx =3D NULL;
>
> =A0 =A0 =A0 =A0 picture =3D NULL;
>
> =A0 =A0 =A0 =A0 frame =3D NULL;
>
> }
>
>
> char* VideoDecoder::decoder_init(AVCodecID codec_id){
>
> =A0 =A0 =A0 =A0 int error;
>
> =A0 =A0 =A0 =A0 AVCodec* codec;
>
> =A0 =A0 =A0 =A0 av_init_packet(&avpkt);
>
> =A0 =A0 =A0 =A0 codec =3D avcodec_find_decoder(codec_id);
>
> =A0 =A0 =A0 =A0 if(!codec){
>
> =A0 =A0 =A0 =A0 return "codec not found";
>
>
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 avctx =3D avcodec_alloc_context3(codec);
>
> =A0 =A0 =A0 =A0 if(!avctx){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return "can not allocate avcontext :: = > avocdec_alloc_context";
>
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 avctx->width=3D640;
>
> =A0 =A0 =A0 =A0 avctx->height=3D480;
>
> =A0 =A0 =A0 =A0 avctx->pix_fmt=3DAV_PIX_FMT_YUV420P;
>
> =A0 =A0 =A0 =A0 if(codec->capabilities&CODEC_CAP_TRUNCATED)
> =A0 =A0 =A0 =A0 avctx->flags|=3D CODEC_FLAG_TRUNCATED;
>
> =A0 =A0 =A0 =A0 error =3D avcodec_open2(avctx ,codec ,NULL);
>
> =A0 =A0 =A0 =A0 if(error < 0 ){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return "can not open codec :: avcodec_= > open2";
>
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 frame =3D avcodec_alloc_frame();
>
> =A0 =A0 =A0 =A0 picture =3D alloc_dec_picture(PIX_FMT_RGB24, 640, 480);
>
> =A0 =A0 =A0 =A0 return "decoder init completed\n";
> }
>
> char* VideoDecoder::decode_frame(uint8_t *frame_buffer, size_t
> data_length){
>
> =A0 =A0 =A0 =A0 int w =3D 640;
>
> =A0 =A0 int h =3D 480;
>
> =A0 =A0 =A0 =A0 rgb_bytes =3DNULL;
>
> =A0 =A0 =A0 =A0 int memBytes =3D avpicture_get_size(PIX_FMT_RGB24 , avctx-&= > gt;width ,
> avctx->height );
>
> =A0 =A0 =A0 =A0 int len ,got_frame;
>
> =A0 =A0 =A0 =A0 avpkt.size =3D data_length;
>
> =A0 =A0 =A0 =A0 avpkt.data =3D frame_buffer;
>
> =A0 =A0 =A0 =A0 if(!frame_buffer){
>
> =A0 =A0 =A0 =A0 return "frame buffer empty\n";
>
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 len =3D avcodec_decode_video2(avctx ,frame ,&got_frame = > ,&avpkt);
>
> =A0 =A0 =A0 =A0 if( len < 0){
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return "error while decoding\n";<= > br> >
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 if( got_frame ){
>
> =A0 =A0 =A0 =A0 static struct SwsContext *img_convert_ctx;
>
> =A0 =A0 =A0if(img_convert_ctx =3D=3D NULL) {
>
> =A0 =A0 =A0 img_convert_ctx =3D sws_getContext(w, h,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 PIX_FMT_YUV420P, avctx->width,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 avctx->height, PIX_FMT_BGR24,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SWS_BICUBIC, NULL, NULL, NULL);
>
> =A0 =A0 =A0 =A0if(img_convert_ctx =3D=3D NULL) {
>
> =A0 =A0 =A0 =A0 =A0 =A0 return =A0"Cannot initialize the conversion co= > ntext!\n";
>
> =A0 =A0 =A0 }
>
> =A0 =A0 }
>
> =A0 =A0 =A0 =A0 sws_scale(img_convert_ctx,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 frame->data , frame->linesize ,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0, h ,picture->data,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 picture->linesize );
>
> =A0 =A0 =A0 =A0 rgb_bytes =3D new uint8_t[memBytes];
>
> =A0 =A0 =A0 =A0 memcpy(rgb_bytes ,picture->data ,memBytes);
>
> =A0 =A0 =A0 =A0 }
>
> =A0 =A0 =A0 =A0 rgb_bytes =3D new uint8_t[memBytes];
>
> =A0 =A0 =A0 =A0 memcpy(rgb_bytes ,frame->data ,memBytes);
>
>
> =A0 =A0 =A0 =A0 av_free_packet(&avpkt);
>
> =A0 =A0 =A0 =A0 return "completed decoding\n";
> }
>
>
> --
> Thanks and Regards
> Imran Khan
>
>
>
> ---------------------------------------------------------------------------= > ----------------------------------------------------
>
> This e-mail is for the sole use of the intended recipient(s) and may
> contain confidential and privileged information. If you are not the
> intended recipient, please contact the sender by reply e-mail and destroy r> > all copies and the original message. Any unauthorized review, use,
> disclosure, dissemination, forwarding, printing or copying of this email> > is strictly prohibited and appropriate legal action will be taken.
> ---------------------------------------------------------------------------= > ----------------------------------------------------
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/libav-user
>

> > --20cf307f3b345cbb5e04d4e2af87-- > -- Thanks and Regards Imran Khan Project Engineer CDAC Hyderabad ------------------------------------------------------------------------------------------------------------------------------- This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. ------------------------------------------------------------------------------------------------------------------------------- From eclipse7 at gmx.net Mon Feb 4 19:08:42 2013 From: eclipse7 at gmx.net (Alexander Strasser) Date: Mon, 4 Feb 2013 19:08:42 +0100 Subject: [Libav-user] FFmpeg at Chemnitzer Linux-Tage Message-ID: <20130204180842.GB2330@akuma> We happily announce that FFmpeg will be represented at `Chemnitzer Linux-Tage' in Chemnitz, Germany. The event will take place on 16th and 17th of March. More information can be found here: http://chemnitzer.linux-tage.de/2013/info/index?cookielang=en We hereby invite you to visit us at our booth located in the Linux-Live area! There we will demonstrate usage of FFmpeg, answer your questions and listen to your problems and wishes. From vsawant at crestron.com Tue Feb 5 00:05:40 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Mon, 4 Feb 2013 23:05:40 +0000 Subject: [Libav-user] Error: selected processor does not support `it gt' Message-ID: I'm cross-compiling ffmpeg (through mplayer) and getting this error. AS libavcodec/arm/ac3dsp_arm.o ./libavutil/arm/asm.S: Assembler messages: ./libavutil/arm/asm.S:134: Warning: stray `\' ./libavutil/arm/asm.S:135: Warning: stray `\' ./libavutil/arm/asm.S:143: Warning: stray `\' libavcodec/arm/ac3dsp_arm.S:30: Error: selected processor does not support `it gt' make[1]: *** [libavcodec/arm/ac3dsp_arm.o] Error 1 make[1]: Leaving directory `/home/vsawant/latest_mplayer/mplayer_arm/ffmpeg' make: *** [ffmpeg/libavcodec/libavcodec.a] Error 2 I tried to compile the assembly code individually, but I still see this error: $ arm-none-linux-gnueabi-gcc -march=armv5te -I../../ -c ac3dsp_arm.S ../../libavutil/arm/asm.S: Assembler messages: ../../libavutil/arm/asm.S:134: Warning: stray `\' ../../libavutil/arm/asm.S:135: Warning: stray `\' ../../libavutil/arm/asm.S:143: Warning: stray `\' ac3dsp_arm.S:30: Error: selected processor does not support `it gt' I believe it's a thumb instruction, but I have disabled thumb. Is there a way to get around it or modify it? Thanks, Vikas This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 00:29:35 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 4 Feb 2013 23:29:35 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Error=3A_selected_processor_does_not_suppo?= =?utf-8?q?rt_=60it_gt=27?= References: Message-ID: Vikas Sawant writes: > AS????? libavcodec/arm/ac3dsp_arm.o > ./libavutil/arm/asm.S: Assembler messages: > ./libavutil/arm/asm.S:134: Warning: stray `\' > ./libavutil/arm/asm.S:135: Warning: stray `\' > ./libavutil/arm/asm.S:143: Warning: stray `\' > libavcodec/arm/ac3dsp_arm.S:30: Error: > selected processor does not support `it gt' Can you reproduce this compilation error with FFmpeg? If yes, please post your configure line and some information about your toolchain. If it is not reproducible, then this is not the right mailing list. (It is not unlikely that MPlayer does not support some - or all - cross-compiling options but this should by discussed on mplayer-users.) [...] > This e-mail message and all attachments > transmitted with it may contain legally > privileged and confidential information Please note that this makes no sense on a public mailing list that is mirrored many times on the internet. Carl Eugen From brado at bighillsoftware.com Tue Feb 5 00:44:49 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 4 Feb 2013 16:44:49 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format Message-ID: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Hello, Quick summary of my use case: I am capturing video on Mac OS X using QTKit, and then using FFmpeg to stream FLV video. I am presently successfully capturing from my internal MacBook Pro camera, using FFmpeg to encode, using FFmpeg to stream (publish) to a server (Wowza), and then am able to successfully play this video in a client from the server. So in other words, the capture / publish / play pipeline is in tact and video is moving across it as expected. The problem is that the video quality (specifically color and artifacts) isn't what I'm capturing. The color is off -- desaturated with a slightly green hue, with colored lines consistently across the the video image. In addition, the left border of the image appears cut off/repeated. I suspect that the problem is due to a mismatch between pixel formats of the captured video frames, vs. the expected pixel format in the filled frame. Because my AVCodec is outputting FLV, it only supports one pixel format: PIX_FMT_YUV420P. Choosing any other pixel format results in an error, and that would seem to be supported in the source code I read in flvenc.c. So the codec is set to that pixel format. The data coming in from the QTCapture on the OSX / Cocoa side is set as kCVPixelFormatType_420YpCbCr8BiPlanarFullRange,one of only two pixel formats that work in this case. The doc for this format reads as follows: "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range (luma=[0,255] chroma=[1,255]). baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct." My code (heavily abridged for brevity) hits these high points: NOTE: frameBufferAddress is a CVImageBufferRef received from the QT capture callback: int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); ... returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, &gotPacket); ... returnVal = av_interleaved_write_frame(_avOutputFormatContext, &avPacket); My suspicion is that kCVPPixelFormatType_420YpCBCrBBiPlanarFullRange isn't matching properly to PIX_FMT_YUV420P, and so the avpicture_fill call isn't properly filling the frame with data. I've spent the day poring over the pixel format descriptions in pixfmt.h, and doing trial and error in that first line of code with a number of other formats that have come close in description, to no avail. In fact, most of them crash the app with no log message at all. If anyone has any idea on how to fix this video quality, I would greatly appreciate your help. Any ideas are welcome. Thanks so much in advance. Regards, Brad -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 00:55:18 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 4 Feb 2013 23:55:18 +0000 (UTC) Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range > (luma=[0,255] chroma=[1,255]).?baseAddr?points to a > big-endian?CVPlanarPixelBufferInfo_YCbCrBiPlanar?struct." > > My code (heavily abridged for brevity) hits these high points:? > > NOTE: frameBufferAddress is a CVImageBufferRef received > from the QT capture callback:? > > ? ??int?returnVal =?avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress,?PIX_FMT_YUV420P, width, height); Could "biplanar" point to AV_PIX_FMT_NV12? (Or something else that is not AV_PIX_FMT_YUV420P) Carl Eugen From brado at bighillsoftware.com Tue Feb 5 01:31:41 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 4 Feb 2013 17:31:41 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: Carl, Thanks for the reply. I've tried both PIX_FMT_NV12 and PIX_FMT_NV21 (in fact, those were the ones I originally thought would work based on description). However, when I use either of those formats in place of PIX_FMT_YUV420P in the following line of code: int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); then while it executes the avpicture_fill line successfully, the subsequent line of code returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, &gotPacket); crashes the whole app with an EXC_BAD_ACCESS error -- and there's no message of any kind written to the console. I have no idea what is causing the crash. Here's the complete block of the code between those two lines: ... int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, PIX_FMT_NV21, width, height); if (returnVal < 0) { if (error) { NSLOG(@"Frame fill failed."); } return NO; } AVPacket avPacket; av_init_packet(&avPacket); avPacket.data = NULL; avPacket.size = 0; int gotPacket; returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, &gotPacket); ... That's been pretty standard for most of the other pixel formats I've tried. There have been one or two that didn't crash the app, but had very wacky distortions (like half the image being neon green), but most of them just crash the app outright. Ideas? Brad On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos wrote: > Brad O'Hearne writes: > >> "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range >> (luma=[0,255] chroma=[1,255]). baseAddr points to a >> big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct." >> >> My code (heavily abridged for brevity) hits these high points: >> >> NOTE: frameBufferAddress is a CVImageBufferRef received >> from the QT capture callback: >> >> int returnVal = avpicture_fill((AVPicture*)avFrame, >> frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > Could "biplanar" point to AV_PIX_FMT_NV12? > (Or something else that is not AV_PIX_FMT_YUV420P) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From michel at marex.tv Tue Feb 5 02:05:02 2013 From: michel at marex.tv (Michel Marchand) Date: Mon, 4 Feb 2013 20:05:02 -0500 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: I'm no expert in ffmpeg but one in broadcast video and normally YCrCb 422 is not full range that is Y ranges from16 to 235 and Cr/Cb are signed and range from 16 to 240 (128 being 0). The Full range term may use the full 0-255 range and that could cause problems but not sure... On Mon, Feb 4, 2013 at 7:31 PM, Brad O'Hearne wrote: > Carl, > > Thanks for the reply. I've tried both PIX_FMT_NV12 and PIX_FMT_NV21 (in > fact, those were the ones I originally thought would work based on > description). However, when I use either of those formats in place of > PIX_FMT_YUV420P in the following line of code: > > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > then while it executes the avpicture_fill line successfully, the > subsequent line of code > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, > avFrame, &gotPacket); > > crashes the whole app with an EXC_BAD_ACCESS error -- and there's no > message of any kind written to the console. I have no idea what is causing > the crash. Here's the complete block of the code between those two lines: > > ... > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_NV21, width, height); > > > if (returnVal < 0) > { > if (error) > { > NSLOG(@"Frame fill failed."); > } > > > return NO; > } > > AVPacket avPacket; > av_init_packet(&avPacket); > avPacket.data = NULL; > avPacket.size = 0; > int gotPacket; > > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, > avFrame, &gotPacket); > ... > > That's been pretty standard for most of the other pixel formats I've > tried. There have been one or two that didn't crash the app, but had very > wacky distortions (like half the image being neon green), but most of them > just crash the app outright. > > Ideas? > > Brad > > On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos wrote: > > Brad O'Hearne writes: > > "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range > (luma=[0,255] chroma=[1,255]). baseAddr points to a > big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct." > > My code (heavily abridged for brevity) hits these high points: > > NOTE: frameBufferAddress is a CVImageBufferRef received > from the QT capture callback: > > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > > Could "biplanar" point to AV_PIX_FMT_NV12? > (Or something else that is not AV_PIX_FMT_YUV420P) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Tue Feb 5 06:51:41 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 4 Feb 2013 22:51:41 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Thanks for the reply Michel. I've actually tried the following pixel formats on the QT Capture side: kCVPixelFormatType_420YpCbCr8Planar Planar Component Y'CbCr 8-bit 4:2:0. baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct. kCVPixelFormatType_420YpCbCr8PlanarFullRange Planar Component Y'CbCr 8-bit 4:2:0, full range. baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct. kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange Bi-Planar Component Y'CbCr 8-bit 4:2:0, video-range (luma=[16,235] chroma=[16,240]). baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct. kCVPixelFormatType_420YpCbCr8BiPlanarFullRange Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range (luma=[0,255] chroma=[1,255]). baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct. The first two cause the avcodec_encode_video2 line to crash. The last two transmit video properly but are distorted. I have in my mind that the first one is probably the right pixel format (also the one I need to use), but there's some state of the resulting frame / packet that isn't being set properly I'm guessing, and it is causing to dereference a null pointer somewhere inside libavcodec. Does anyone have any idea what might be causing this? Is there some value I need to set before encoding the video? Thanks, Brad On Feb 4, 2013, at 6:05 PM, Michel Marchand wrote: > I'm no expert in ffmpeg but one in broadcast video and normally YCrCb 422 is not full range that is Y ranges from16 to 235 and Cr/Cb are signed and range from 16 to 240 (128 being 0). The Full range term may use the full 0-255 range and that could cause problems but not sure... > > On Mon, Feb 4, 2013 at 7:31 PM, Brad O'Hearne wrote: > Carl, > > Thanks for the reply. I've tried both PIX_FMT_NV12 and PIX_FMT_NV21 (in fact, those were the ones I originally thought would work based on description). However, when I use either of those formats in place of PIX_FMT_YUV420P in the following line of code: > > int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > then while it executes the avpicture_fill line successfully, the subsequent line of code > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, &gotPacket); > > crashes the whole app with an EXC_BAD_ACCESS error -- and there's no message of any kind written to the console. I have no idea what is causing the crash. Here's the complete block of the code between those two lines: > > ... > int returnVal = avpicture_fill((AVPicture*)avFrame, frameBufferBaseAddress, PIX_FMT_NV21, width, height); > > if (returnVal < 0) > { > if (error) > { > NSLOG(@"Frame fill failed."); > } > > return NO; > } > > AVPacket avPacket; > av_init_packet(&avPacket); > avPacket.data = NULL; > avPacket.size = 0; > int gotPacket; > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, avFrame, &gotPacket); > ... > > That's been pretty standard for most of the other pixel formats I've tried. There have been one or two that didn't crash the app, but had very wacky distortions (like half the image being neon green), but most of them just crash the app outright. > > Ideas? > > Brad > > On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos wrote: > >> Brad O'Hearne writes: >> >>> "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range >>> (luma=[0,255] chroma=[1,255]). baseAddr points to a >>> big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct." >>> >>> My code (heavily abridged for brevity) hits these high points: >>> >>> NOTE: frameBufferAddress is a CVImageBufferRef received >>> from the QT capture callback: >>> >>> int returnVal = avpicture_fill((AVPicture*)avFrame, >>> frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); >> >> Could "biplanar" point to AV_PIX_FMT_NV12? >> (Or something else that is not AV_PIX_FMT_YUV420P) >> >> Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 09:44:55 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 08:44:55 +0000 (UTC) Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > The problem is that the video quality (specifically > color and artifacts) isn't what I'm capturing. The > color is off -- desaturated with a slightly green > hue, with colored lines consistently across the the > video image. In addition, the left border of the > image appears cut off/repeated. I am not sure if I understand correctly, but if this were only about full-range vs video than you can use swscale for conversion. I suspect though that either stride or the source pointers are not set up correctly, I can only suggest you debug them to see if they match what you expect. Please do not top-post here, it is considered rude and please set your mailer to text-only, your mails are difficult to read. Carl Eugen From alexcohn at netvision.net.il Tue Feb 5 10:47:40 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 5 Feb 2013 11:47:40 +0200 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: On Tue, Feb 5, 2013 at 7:51 AM, Brad O'Hearne wrote: > I have in my mind that the first one is probably the right pixel format (also > the one I need to use), but there's some state of the resulting frame / > packet that isn't being set properly I'm guessing, and it is causing to > dereference a null pointer somewhere inside libavcodec. Does anyone have any > idea what might be causing this? Is there some value I need to set before > encoding the video? Unfortunately, most video codecs support only few (usually, one) pixel formats - both as input for encoding and output for decoding. When you use ffmpeg command line and specify an incompatible pixel format, ffmpeg will perform format conversion for you. But when you use the libavcodec library, you must take care of this conversion yourself. It works (well, fails miserably) as expected when you specify AV_PIX_FMT_NV12 (which, as far as I can tell, is the ffmpeg equivalent for kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) for a codec that does not support this format. You can use swscale to convert the images to AV_PIX_FMT_YUV420P, which is supported by vast majority of ffmpeg video encoders. It does puzzle me, though, that you experience crash when you configure your capture with kCVPixelFormatType_420YpCbCr8Planar. How do you pass it to avpicture_fill()? If I understand correctly, kCVPixelFormatType_420YpCbCr8Planar exposes three fields: ComponentInfoY, ComponentInfoCb, and ComponentInfoCr. But ffmpeg expects a contiguous byte array of Y pixels (w*h), followed by Cb (w/2*h/2). Therefore, even for conversion from kCVPixelFormatType_420YpCbCr8Planar to AV_PIX_FMT_YUV420P you need some extra step: create a byte array of size w*h*3/2 and copy the three planes to this array. If the source has line padding, you should take care of this, too. Regards, Alex From max_schmerz at gmx.net Tue Feb 5 10:58:22 2013 From: max_schmerz at gmx.net (Ronny Wegener) Date: Tue, 5 Feb 2013 10:58:22 +0100 Subject: [Libav-user] Decoding Packets, missing Frames at End Message-ID: Hi, i'm running a simple while loop, reading all video packets, decode the corresponding frames and print the timestamps. The first frame is successfully decoded after reading the fifth packet. So the while loop stops after reading the last packet, before i decoded all frames: [OUTPUT] packet.pts=0 => GOT NO PICTURE packet.pts=1 => GOT NO PICTURE packet.pts=2 => GOT NO PICTURE packet.pts=3 => GOT NO PICTURE packet.pts=4 => frame.pts=0 packet.pts=5 => frame.pts=1 packet.pts=6 => frame.pts=2 packet.pts=7 => frame.pts=3 packet.pts=8 => frame.pts=4 packet.pts=9 => frame.pts=5 [END] It seems the packets are buffered, how can i decode the last frames from the internal buffered packets? _______________________________ + source code: http://pastebin.com/SjLYQfS7 + demo project: http://rghost.net/43560908 From alexcohn at netvision.net.il Tue Feb 5 11:03:31 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 5 Feb 2013 12:03:31 +0200 Subject: [Libav-user] Decoding Packets, missing Frames at End In-Reply-To: References: Message-ID: On Tue, Feb 5, 2013 at 11:58 AM, Ronny Wegener wrote: > Hi, > > i'm running a simple while loop, reading all video packets, decode the > corresponding frames and print the timestamps. > > The first frame is successfully decoded after reading the fifth > packet. So the while loop stops after reading the last packet, before > i decoded all frames: > > [OUTPUT] > packet.pts=0 => GOT NO PICTURE > packet.pts=1 => GOT NO PICTURE > packet.pts=2 => GOT NO PICTURE > packet.pts=3 => GOT NO PICTURE > packet.pts=4 => frame.pts=0 > packet.pts=5 => frame.pts=1 > packet.pts=6 => frame.pts=2 > packet.pts=7 => frame.pts=3 > packet.pts=8 => frame.pts=4 > packet.pts=9 => frame.pts=5 > [END] > > It seems the packets are buffered, how can i decode the last frames > from the internal buffered packets? Your description is correct. After av_read_frame() returns FALSE, you should continue to call avcodec_decode_video2() with empty input packet while got_picture is TRUE. BR, Alex From caglarakyuz at gmail.com Tue Feb 5 11:52:08 2013 From: caglarakyuz at gmail.com (Caglar AKYUZ) Date: Tue, 5 Feb 2013 12:52:08 +0200 Subject: [Libav-user] Handling RTCP RR Message-ID: Hello, I'm using libavformat for streaming RTP video from my embedded device. Is there any way/API to handle RTP receiver reports from my application? Since rtp muxer is an AVOutputFormat, I cannot call av_read_frame on my context, am I correct? Regards, Caglar From max_schmerz at gmx.net Tue Feb 5 12:06:02 2013 From: max_schmerz at gmx.net (Ronny Wegener) Date: Tue, 5 Feb 2013 12:06:02 +0100 Subject: [Libav-user] Decoding Packets, missing Frames at End In-Reply-To: References: Message-ID: Thanks for the fast reply, it's working now... for those interested, here is the code that uses empty packets to decode frames from the internal buffer: http://pastebin.com/HxurrH9S On Tue, Feb 5, 2013 at 11:03 AM, Alex Cohn wrote: > On Tue, Feb 5, 2013 at 11:58 AM, Ronny Wegener wrote: >> Hi, >> >> i'm running a simple while loop, reading all video packets, decode the >> corresponding frames and print the timestamps. >> >> The first frame is successfully decoded after reading the fifth >> packet. So the while loop stops after reading the last packet, before >> i decoded all frames: >> >> [OUTPUT] >> packet.pts=0 => GOT NO PICTURE >> packet.pts=1 => GOT NO PICTURE >> packet.pts=2 => GOT NO PICTURE >> packet.pts=3 => GOT NO PICTURE >> packet.pts=4 => frame.pts=0 >> packet.pts=5 => frame.pts=1 >> packet.pts=6 => frame.pts=2 >> packet.pts=7 => frame.pts=3 >> packet.pts=8 => frame.pts=4 >> packet.pts=9 => frame.pts=5 >> [END] >> >> It seems the packets are buffered, how can i decode the last frames >> from the internal buffered packets? > > Your description is correct. After av_read_frame() returns FALSE, you > should continue to call avcodec_decode_video2() with empty input > packet while got_picture is TRUE. > > BR, > Alex > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From salsaman at gmail.com Tue Feb 5 12:08:29 2013 From: salsaman at gmail.com (salsaman) Date: Tue, 5 Feb 2013 08:08:29 -0300 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: NV12 is planar Y, followed by packed UV combined. So to convert to YUV420, the Y plane remains the same, but you need to move the V values so they are after the U values. I.e. Ydata[width * height] + UVdata[widt * height/2] -> Ydata[width*height] + Udata[width*height/4] + Vdata[width*height/4] I have never encountered a YUV format with extra rowstride padding, so most likely that is not a problem. Regards, Salsaman. http://lives.sourceforge.net https://www.ohloh.net/accounts/salsaman On Tue, Feb 5, 2013 at 6:47 AM, Alex Cohn wrote: > On Tue, Feb 5, 2013 at 7:51 AM, Brad O'Hearne wrote: >> I have in my mind that the first one is probably the right pixel format (also >> the one I need to use), but there's some state of the resulting frame / >> packet that isn't being set properly I'm guessing, and it is causing to >> dereference a null pointer somewhere inside libavcodec. Does anyone have any >> idea what might be causing this? Is there some value I need to set before >> encoding the video? > > Unfortunately, most video codecs support only few (usually, one) pixel > formats - both as input for encoding and output for decoding. When you > use ffmpeg command line and specify an incompatible pixel format, > ffmpeg will perform format conversion for you. But when you use the > libavcodec library, you must take care of this conversion yourself. > > It works (well, fails miserably) as expected when you specify > AV_PIX_FMT_NV12 (which, as far as I can tell, is the ffmpeg equivalent > for kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) for a codec that > does not support this format. You can use swscale to convert the > images to AV_PIX_FMT_YUV420P, which is supported by vast majority of > ffmpeg video encoders. > > It does puzzle me, though, that you experience crash when you > configure your capture with kCVPixelFormatType_420YpCbCr8Planar. How > do you pass it to avpicture_fill()? If I understand correctly, > kCVPixelFormatType_420YpCbCr8Planar exposes three fields: > ComponentInfoY, ComponentInfoCb, and ComponentInfoCr. But ffmpeg > expects a contiguous byte array of Y pixels (w*h), followed by Cb > (w/2*h/2). > > Therefore, even for conversion from > kCVPixelFormatType_420YpCbCr8Planar to AV_PIX_FMT_YUV420P you need > some extra step: create a byte array of size w*h*3/2 and copy the > three planes to this array. If the source has line padding, you should > take care of this, too. > > Regards, > Alex > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From michel at marex.tv Tue Feb 5 13:09:46 2013 From: michel at marex.tv (Michel Marchand) Date: Tue, 5 Feb 2013 07:09:46 -0500 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: <-8880125981410533329@unknownmsgid> First one looks good. If the image is distorded then it could be the pitch of line of pixels that is wrong. This would offset the start of a pixel row and could produce different visual effects. I wouls start by replacing al Cr Cb bytes by 128 to get monochrome and see if that looks ok in gray. This can give you hints on whether it's the pitch or the pointer to a plane that is offset. Sent from my iPad On Feb 5, 2013, at 12:52 AM, Brad O'Hearne wrote: Thanks for the reply Michel. I've actually tried the following pixel formats on the QT Capture side: kCVPixelFormatType_420YpCbCr8Planar Planar Component Y'CbCr 8-bit 4:2:0. baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct. kCVPixelFormatType_420YpCbCr8PlanarFullRange Planar Component Y'CbCr 8-bit 4:2:0, full range. baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrPlanar struct. kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange Bi-Planar Component Y'CbCr 8-bit 4:2:0, video-range (luma=[16,235] chroma=[16,240]). baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct. kCVPixelFormatType_420YpCbCr8BiPlanarFullRange Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range (luma=[0,255] chroma=[1,255]). baseAddr points to a big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct. The first two cause the avcodec_encode_video2 line to crash. The last two transmit video properly but are distorted. I have in my mind that the first one is probably the right pixel format (also the one I need to use), but there's some state of the resulting frame / packet that isn't being set properly I'm guessing, and it is causing to dereference a null pointer somewhere inside libavcodec. Does anyone have any idea what might be causing this? Is there some value I need to set before encoding the video? Thanks, Brad On Feb 4, 2013, at 6:05 PM, Michel Marchand wrote: I'm no expert in ffmpeg but one in broadcast video and normally YCrCb 422 is not full range that is Y ranges from16 to 235 and Cr/Cb are signed and range from 16 to 240 (128 being 0). The Full range term may use the full 0-255 range and that could cause problems but not sure... On Mon, Feb 4, 2013 at 7:31 PM, Brad O'Hearne wrote: > Carl, > > Thanks for the reply. I've tried both PIX_FMT_NV12 and PIX_FMT_NV21 (in > fact, those were the ones I originally thought would work based on > description). However, when I use either of those formats in place of > PIX_FMT_YUV420P in the following line of code: > > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > then while it executes the avpicture_fill line successfully, the > subsequent line of code > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, > avFrame, &gotPacket); > > crashes the whole app with an EXC_BAD_ACCESS error -- and there's no > message of any kind written to the console. I have no idea what is causing > the crash. Here's the complete block of the code between those two lines: > > ... > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_NV21, width, height); > > if (returnVal < 0) > { > if (error) > { > NSLOG(@"Frame fill failed."); > } > > return NO; > } > > AVPacket avPacket; > av_init_packet(&avPacket); > avPacket.data = NULL; > avPacket.size = 0; > int gotPacket; > > returnVal = avcodec_encode_video2(_videoStream->codec, &avPacket, > avFrame, &gotPacket); > ... > > That's been pretty standard for most of the other pixel formats I've > tried. There have been one or two that didn't crash the app, but had very > wacky distortions (like half the image being neon green), but most of them > just crash the app outright. > > Ideas? > > Brad > > On Feb 4, 2013, at 4:55 PM, Carl Eugen Hoyos wrote: > > Brad O'Hearne writes: > > "Bi-Planar Component Y'CbCr 8-bit 4:2:0, full-range > (luma=[0,255] chroma=[1,255]). baseAddr points to a > big-endian CVPlanarPixelBufferInfo_YCbCrBiPlanar struct." > > My code (heavily abridged for brevity) hits these high points: > > NOTE: frameBufferAddress is a CVImageBufferRef received > from the QT capture callback: > > int returnVal = avpicture_fill((AVPicture*)avFrame, > frameBufferBaseAddress, PIX_FMT_YUV420P, width, height); > > > Could "biplanar" point to AV_PIX_FMT_NV12? > (Or something else that is not AV_PIX_FMT_YUV420P) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 13:38:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 12:38:43 +0000 (UTC) Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: Alex Cohn writes: > If I understand correctly, kCVPixelFormatType_420YpCbCr8Planar > exposes three fields: > ComponentInfoY, ComponentInfoCb, and ComponentInfoCr. > But ffmpeg expects a contiguous byte array of Y > pixels (w*h), followed by Cb (w/2*h/2). > > Therefore, even for conversion from > kCVPixelFormatType_420YpCbCr8Planar to AV_PIX_FMT_YUV420P > you need some extra step: create a byte array of size > w*h*3/2 and copy the three planes to this array. This does not sound correct. AV_PIX_FMT_YUV420P is a planar format with three pointers, one for y, one for u and one for v. This should correspond to the "ComponentInfo" pointer you mention above. Carl Eugen From vsawant at crestron.com Tue Feb 5 16:30:20 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Tue, 5 Feb 2013 15:30:20 +0000 Subject: [Libav-user] configure script fails for cross-compiling Message-ID: I'm trying to cross compile ffmpeg for the arm processor and run the following configure command: ./configure --enable-cross-compile --host-cc=/usr/bin/gcc --cc=arm-none-linux-gnueabi-gcc --as=arm-none-linux-gnueabi-as --nm=arm-none-linux-gnueabi-nm --ar=arm-none-linux-gnueabi-ar --disable-asm --disable-vfp --disable-armv6 --arch=armv5te --target-os=arm-linux --disable-yasm --disable-everything But nothing happens. Compiling tools directory is included in the PATH, so that doesn't seem to be an issue. The script looks stuck somewhere. All it has generated is a 0 bytes a.out file and config.log. Here's how the tail of config.log looks like: $ tail config.log yadif_filter_deps=gpl yasm=no yasmexe_default=yasm zerocodec_decoder_select=zlib zlib_decoder_select=zlib zlib_encoder_select=zlib zmbv_decoder_select=zlib zmbv_encoder_select=zlib mktemp -u XXXXXX T13966 Am I missing something in the configure script? Thanks, Vikas This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Tue Feb 5 16:39:27 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Tue, 5 Feb 2013 17:39:27 +0200 Subject: [Libav-user] Noise on mms-stream playing Message-ID: <38D7216823974E2597AEB99409871F4A@mlsdev.com> Hello everybody! I'm building an iOS app. And found that when I'm updated ffmpeg, there are noise occurs on mms-stream playing. For ffmpeg building, I'm using this scrip: (from - http://www.tangentsoftworks.com/blog/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/) /configure \ --prefix=i386 \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --enable-avresample \ --enable-cross-compile \ --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" \ --target-os=darwin \ --cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" \ --extra-cflags="-arch i386" \ --extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk" \ --arch=i386 \ --cpu=i386 \ --enable-pic \ --disable-asm \ make clean && make && make install But if I'm build regular ffmpeg (./configure && make clean && make && make insall). And trying to play the same with ffplay-tool, everything works fine. Any ideas? -- Alexey Belkevich -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 16:51:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 15:51:19 +0000 (UTC) Subject: [Libav-user] configure script fails for cross-compiling References: Message-ID: Vikas Sawant writes: > I?m trying to cross compile ffmpeg for the arm processor > and run the following configure command: > ./configure --enable-cross-compile --host-cc=/usr/bin/gcc > --cc=arm-none-linux-gnueabi-gcc > --as=arm-none-linux-gnueabi-as Remove this part from the configure line. If you believe it ever made sense, please report, I am about to remove the option! [...] > This e-mail message and all attachments transmitted > with it may contain legally privileged and > confidential information Please note that this sentence makes no sense on a public mailing list mirrored many times on the internet. Carl Eugen From cehoyos at ag.or.at Tue Feb 5 16:53:26 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 15:53:26 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> Message-ID: Alexey Belkevich writes: > I'm building an iOS app. And found that when I'm updated ffmpeg, > there are noise occurs on mms-stream playing. When decoding the stream with ffmpeg (the application)? Or with a different use-case? If yes, please explain. > For ffmpeg building, I'm using this scrip: (from > -?http://www.tangentsoftworks.com/blog/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/) While this is not related, please understand that such scripts are generally unsupported here, if you find a bug with our build script, please report it! Carl Eugen From belkevich at mlsdev.com Tue Feb 5 17:01:00 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Tue, 5 Feb 2013 18:01:00 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> Message-ID: <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Yes I'm using ffmpeg in iOS app to play mms-streams. It's because it's not supported out-of-box. The question is why ffplay works fine, but in app there are a lot of noise. And it's happened, after update of ffmpeg. The script is provided to explain how I built ffmpeg-libraries. -- Alexey Belkevich On Tuesday, February 5, 2013 at 5:53 PM, Carl Eugen Hoyos wrote: > Alexey Belkevich writes: > > > I'm building an iOS app. And found that when I'm updated ffmpeg, > > there are noise occurs on mms-stream playing. > > > > > When decoding the stream with ffmpeg (the application)? > Or with a different use-case? If yes, please explain. > > > For ffmpeg building, I'm using this scrip: (from > - http://www.tangentsoftworks.com/blog/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/) > > While this is not related, please understand that such > scripts are generally unsupported here, if you > find a bug with our build script, please report it! > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 17:11:30 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 16:11:30 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: Alexey Belkevich writes: > Yes I'm using ffmpeg in iOS app to play mms-streams. Please add at least ffmpeg -i input out.wav console output on a supported platform. (Can't you test ffmpeg on your iOS device like this?) Please do not top-post here, it is considered rude. Carl Eugen From vsawant at crestron.com Tue Feb 5 17:23:42 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Tue, 5 Feb 2013 16:23:42 +0000 Subject: [Libav-user] configure script fails for cross-compiling In-Reply-To: References: Message-ID: Thanks, Carl! I removed this option as you suggested: > --as=arm-none-linux-gnueabi-as added a few more and it worked. I do make and that compiles the libraries. Stripping failed, so I disabled it and I wanted to avoid assemblt code, so I disabled that too. Here's the exact command that worked: ./configure --disable-runtime-cpudetect --enable-cross-compile --cc=arm-none-linux-gnueabi-gcc --arch=armv5te --disable-vfp --disable-armv6 --disable-armv6t2 --disable-neon --target-os=linux --enable-small --disable-debug --disable-asm --disable-yasm --disable-stripping --disable-everything The next challenge for me is to make mplayer build accept the ffmpeg libraries I just built instead of building on its own. Thanks, Vikas From: Vikas Sawant Sent: Tuesday, February 05, 2013 10:30 AM To: 'libav-user at ffmpeg.org' Subject: configure script fails for cross-compiling I'm trying to cross compile ffmpeg for the arm processor and run the following configure command: ./configure --enable-cross-compile --host-cc=/usr/bin/gcc --cc=arm-none-linux-gnueabi-gcc --as=arm-none-linux-gnueabi-as --nm=arm-none-linux-gnueabi-nm --ar=arm-none-linux-gnueabi-ar --disable-asm --disable-vfp --disable-armv6 --arch=armv5te --target-os=arm-linux --disable-yasm --disable-everything But nothing happens. Compiling tools directory is included in the PATH, so that doesn't seem to be an issue. The script looks stuck somewhere. All it has generated is a 0 bytes a.out file and config.log. Here's how the tail of config.log looks like: $ tail config.log yadif_filter_deps=gpl yasm=no yasmexe_default=yasm zerocodec_decoder_select=zlib zlib_decoder_select=zlib zlib_encoder_select=zlib zmbv_decoder_select=zlib zmbv_encoder_select=zlib mktemp -u XXXXXX T13966 Am I missing something in the configure script? Thanks, Vikas This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Tue Feb 5 17:57:00 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Tue, 5 Feb 2013 18:57:00 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: Unfortunately it's can't be done. FFMpeg is only decoder, all playback routine done with iOS SDK. But I will try to think in this direction. Is console log of decoding and connection could be helpful? Also, is any flag or macros that will enable more detailed console output of ffmpeg? 2013/2/5 Carl Eugen Hoyos > Alexey Belkevich writes: > > > Yes I'm using ffmpeg in iOS app to play mms-streams. > > Please add at least ffmpeg -i input out.wav console > output on a supported platform. > (Can't you test ffmpeg on your iOS device like this?) > > Please do not top-post here, it is considered rude. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Feb 5 18:00:26 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 17:00:26 +0000 (UTC) Subject: [Libav-user] configure script fails for cross-compiling References: Message-ID: Vikas Sawant writes: > added a few more and it worked. I do make and that compiles > the libraries. Stripping failed, so I disabled it and I (is this expected? or is the wrong stripping command called? How does it "fail"?) > wanted to avoid assemblt code, so I disabled that too. (Depending on what you plan:) That sounds like an exceptional bad idea. > Here?s the exact command that worked: > ./configure --disable-runtime-cpudetect --enable-cross-compile > --cc=arm-none-linux-gnueabi-gcc --arch=armv5te --disable-vfp > --disable-armv6 --disable-armv6t2 --disable-neon --target-os=linux > --enable-small --disable-debug --disable-asm --disable-yasm > --disable-stripping --disable-everything Do you know what --disable-everything does? If not, please remove it. (And please remove "--disable-yasm", if it is needed, it would be a bug, please report it.) > The next challenge for me is to make mplayer build > accept the ffmpeg libraries I just built instead of > building on its own. This is not a good approach. Instead, please report your build problems with MPlayer on mplayer-users so we at least know about them. (And there is a chance they get fixed.) Please do not top-post here, it is considered rude. Carl Eugen From cehoyos at ag.or.at Tue Feb 5 18:04:17 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 17:04:17 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: Alexey Belkevich writes: > Unfortunately?it's can't be done. FFMpeg is only decoder, > all playback routine done with iOS SDK. > But I will try to think in this direction. Is console log > of decoding and connection could be helpful? Also, is any > flag or macros that will enable more detailed console > output of ffmpeg? Please stop top-posting! Iirc, you wrote that ffplay works on your desktop for the given stream. Does ffmpeg (ffmpeg -i yourstream out.wav) also work? If yes, please provide complete, uncut console output. Next step: Compile ffmpeg (the application) for your iDevice (it has no additional requirements, so there is no reason why it should not compile fine). Then test the same command as above on your device and report if the output (wav) file is correct. (If I did not understand correctly and your stream can actually not be decoded on your desktop system, then this should be analyzed: It will be significantly simpler to reproduce / fix.) Carl Eugen From vsawant at crestron.com Tue Feb 5 18:30:28 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Tue, 5 Feb 2013 17:30:28 +0000 Subject: [Libav-user] configure script fails for cross-compiling Message-ID: Carl, Here's the stripping error: STRIP ffmpeg strip: Unable to recognise the format of the input file `ffmpeg' make: *** [ffmpeg] Error 1 If I use assembly, I get into all sorts of "Error: selected processor does not support `XYZ'" errors. Here's one: AS libavcodec/arm/ac3dsp_arm.o ./libavutil/arm/asm.S: Assembler messages: ./libavutil/arm/asm.S:134: Warning: stray `\' ./libavutil/arm/asm.S:135: Warning: stray `\' ./libavutil/arm/asm.S:143: Warning: stray `\' libavcodec/arm/ac3dsp_arm.S:30: Error: selected processor does not support `it gt' make[1]: *** [libavcodec/arm/ac3dsp_arm.o] Error 1 make[1]: Leaving directory `/home/vsawant/latest_mplayer/mplayer_arm/ffmpeg' make: *** [ffmpeg/libavcodec/libavcodec.a] Error 2 I use FreeScale iMX27 that uses Processor : ARM926EJ-S rev 4 (v5l) . The toolkit doesn't have YASM, but the configure script needs one. That's why I have to disable it. arm-none-linux-gnueabi-gcc is used for assembly. As with -disable-everything, we only need a limited set of audio codecs such as WMA and none of the video codecs. So the first thing was to build the libraries using the cross-compiler and then enable just the needed codecs. You have any suggestions? -Vikas This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From vsawant at crestron.com Tue Feb 5 20:09:30 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Tue, 5 Feb 2013 19:09:30 +0000 Subject: [Libav-user] configure script fails for cross-compiling Message-ID: I had to explicitly change the STRIP and RANLIB in config.mak to pick the one from the arm tool chain. RANLIB=arm-none-linux-gnueabi-ranlib STRIP=arm-none-linux-gnueabi-strip This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Tue Feb 5 22:11:14 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 5 Feb 2013 14:11:14 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: Carl, Apologies for the top-post. Etiquette varies across mailings lists, and now that I understand this one, I'll be sure to abide by that in the future. Thanks again for taking the time to respond to my question. Cheers, Brad On Feb 5, 2013, at 1:44 AM, Carl Eugen Hoyos wrote: > Brad O'Hearne writes: > >> The problem is that the video quality (specifically >> color and artifacts) isn't what I'm capturing. The >> color is off -- desaturated with a slightly green >> hue, with colored lines consistently across the the >> video image. In addition, the left border of the >> image appears cut off/repeated. > > I am not sure if I understand correctly, but if this > were only about full-range vs video than you can use > swscale for conversion. > > I suspect though that either stride or the source > pointers are not set up correctly, I can only > suggest you debug them to see if they match > what you expect. > > Please do not top-post here, it is considered rude > and please set your mailer to text-only, your mails > are difficult to read. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From cehoyos at ag.or.at Wed Feb 6 00:49:07 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 23:49:07 +0000 (UTC) Subject: [Libav-user] configure script fails for cross-compiling References: Message-ID: Vikas Sawant writes: > I had to explicitly change the STRIP and RANLIB >?in config.mak to pick the one from the arm tool chain. Did you try the configure option --cross-prefix= ? Carl Eugen From cehoyos at ag.or.at Wed Feb 6 00:51:49 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 23:51:49 +0000 (UTC) Subject: [Libav-user] configure script fails for cross-compiling References: Message-ID: Vikas Sawant writes: > As with ?disable-everything, we only need a > limited set of audio codecs such as WMA and > none of the video codecs. Understood, I just would have imagined you first want to compile everything and then disable what you don't need, but this is of course possible. Regarding your problems with arm asm: I cannot really help you, but I know that --disable-asm is not the right answer. You could look at http://fate.ffmpeg.org/ There are some configure lines for arm that may help you finding the problem. Carl Eugen From cehoyos at ag.or.at Wed Feb 6 00:53:31 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Feb 2013 23:53:31 +0000 (UTC) Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > Apologies for the top-post. Etiquette varies across > mailings lists, and now that I understand this one, > I'll be sure to abide by that in the future. Now of course comes the unavoidable question: If you understood that top-posting is not welcome here, why did you do it again? Carl Eugen From brado at bighillsoftware.com Wed Feb 6 02:16:56 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 5 Feb 2013 18:16:56 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> Message-ID: <5CB35FE3-9353-4C68-8F51-7BB4E7074041@bighillsoftware.com> On Feb 5, 2013, at 4:53 PM, Carl Eugen Hoyos wrote: > Brad O'Hearne writes: > >> Apologies for the top-post. Etiquette varies across >> mailings lists, and now that I understand this one, >> I'll be sure to abide by that in the future. > > Now of course comes the unavoidable question: > If you understood that top-posting is not > welcome here, why did you do it again? Egad! I switched computers...sorry about that. B From brado at bighillsoftware.com Wed Feb 6 02:58:16 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 5 Feb 2013 18:58:16 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: On Feb 5, 2013, at 2:47 AM, Alex Cohn wrote: > Unfortunately, most video codecs support only few (usually, one) pixel > formats - both as input for encoding and output for decoding. When you > use ffmpeg command line and specify an incompatible pixel format, > ffmpeg will perform format conversion for you. But when you use the > libavcodec library, you must take care of this conversion yourself. > > It works (well, fails miserably) as expected when you specify > AV_PIX_FMT_NV12 (which, as far as I can tell, is the ffmpeg equivalent > for kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) for a codec that > does not support this format. You can use swscale to convert the > images to AV_PIX_FMT_YUV420P, which is supported by vast majority of > ffmpeg video encoders. > > It does puzzle me, though, that you experience crash when you > configure your capture with kCVPixelFormatType_420YpCbCr8Planar. How > do you pass it to avpicture_fill()? If I understand correctly, > kCVPixelFormatType_420YpCbCr8Planar exposes three fields: > ComponentInfoY, ComponentInfoCb, and ComponentInfoCr. But ffmpeg > expects a contiguous byte array of Y pixels (w*h), followed by Cb > (w/2*h/2). > > Therefore, even for conversion from > kCVPixelFormatType_420YpCbCr8Planar to AV_PIX_FMT_YUV420P you need > some extra step: create a byte array of size w*h*3/2 and copy the > three planes to this array. If the source has line padding, you should > take care of this, too. Thanks for the response. I am in the process of trying to decipher what kind of output formats I can actually get cleanly from QTKit on the cocoa-dev and QuickTime API lists. I am suspecting all was not actually well with the decompressed kCVPixelFormatType_420YpCbCr8Planar frame config -- the other pixel formats I believe were just wrong but my suspicion is if I can get the aforementioned pixel format outputting properly (meaning that QuickTime is performing any conversion) that it will work once sent to FFmpeg. There is no guarantee that is going to work, however. In the meantime, I decided to output the native device format descriptions of the two webcams I have, the first being my internal MacBook Pro camera, and the second being an external USB-webcam. Both of them are supporting the same output, as follows: Component Y'CbCr 8-bit 4:2:2 ordered Y'0 Cb Y'1 Cr, 160 ? 120 Reading in the some of the QuickTime documentation, it doesn't seem clear whether the camera will completely dictate the output format at the point where my program is called back and handed the decompressed frame; in other words, there is some verbiage to suggest that QuickTime may either output this format by default regardless of the camera, or compatibility with QuickTime may demand this format be available. For my question at the moment, that is irrelevant, as this is now a concrete point of reference from which I can work. So -- to the FFmpeg / video format gurus out there, can you give some guidance as to the approach to convert a frame in the format mentioned above to that of AV_PIX_FMT_YUV420P? Thanks! Cheers, Brad -------------- next part -------------- An HTML attachment was scrubbed... URL: From salsaman at gmail.com Wed Feb 6 04:14:38 2013 From: salsaman at gmail.com (salsaman) Date: Wed, 6 Feb 2013 00:14:38 -0300 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: On Tue, Feb 5, 2013 at 10:58 PM, Brad O'Hearne wrote: > > On Feb 5, 2013, at 2:47 AM, Alex Cohn wrote: > > Unfortunately, most video codecs support only few (usually, one) pixel > formats - both as input for encoding and output for decoding. When you > use ffmpeg command line and specify an incompatible pixel format, > ffmpeg will perform format conversion for you. But when you use the > libavcodec library, you must take care of this conversion yourself. > > It works (well, fails miserably) as expected when you specify > AV_PIX_FMT_NV12 (which, as far as I can tell, is the ffmpeg equivalent > for kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) for a codec that > does not support this format. You can use swscale to convert the > images to AV_PIX_FMT_YUV420P, which is supported by vast majority of > ffmpeg video encoders. > > It does puzzle me, though, that you experience crash when you > configure your capture with kCVPixelFormatType_420YpCbCr8Planar. How > do you pass it to avpicture_fill()? If I understand correctly, > kCVPixelFormatType_420YpCbCr8Planar exposes three fields: > ComponentInfoY, ComponentInfoCb, and ComponentInfoCr. But ffmpeg > expects a contiguous byte array of Y pixels (w*h), followed by Cb > (w/2*h/2). > > Therefore, even for conversion from > kCVPixelFormatType_420YpCbCr8Planar to AV_PIX_FMT_YUV420P you need > some extra step: create a byte array of size w*h*3/2 and copy the > three planes to this array. If the source has line padding, you should > take care of this, too. > > > Thanks for the response. I am in the process of trying to decipher what kind > of output formats I can actually get cleanly from QTKit on the cocoa-dev and > QuickTime API lists. I am suspecting all was not actually well with the > decompressed kCVPixelFormatType_420YpCbCr8Planar frame config -- the other > pixel formats I believe were just wrong but my suspicion is if I can get the > aforementioned pixel format outputting properly (meaning that QuickTime is > performing any conversion) that it will work once sent to FFmpeg. There is > no guarantee that is going to work, however. > > In the meantime, I decided to output the native device format descriptions > of the two webcams I have, the first being my internal MacBook Pro camera, > and the second being an external USB-webcam. Both of them are supporting the > same output, as follows: > > Component Y'CbCr 8-bit 4:2:2 ordered Y'0 Cb Y'1 Cr, 160 ? 120 > > Reading in the some of the QuickTime documentation, it doesn't seem clear > whether the camera will completely dictate the output format at the point > where my program is called back and handed the decompressed frame; in other > words, there is some verbiage to suggest that QuickTime may either output > this format by default regardless of the camera, or compatibility with > QuickTime may demand this format be available. For my question at the > moment, that is irrelevant, as this is now a concrete point of reference > from which I can work. > > So -- to the FFmpeg / video format gurus out there, can you give some > guidance as to the approach to convert a frame in the format mentioned above > to that of AV_PIX_FMT_YUV420P? > > Thanks! > > Cheers, > > Brad > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > Take a look here: http://svn.code.sf.net/p/lives/code/trunk/src/colourspace.c (search for convert_yuyv_to_yuv420_frame). Salsaman. (apologies for earlier top posting, its the default in gmail...) http://lives.sourceforge.net https://www.ohloh.net/accounts/salsaman From xuanyu.huang at gmail.com Wed Feb 6 04:56:45 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Wed, 6 Feb 2013 14:56:45 +1100 Subject: [Libav-user] How to specify the audio sample format when opening a file Message-ID: Hi all, I'm upgrading our application from using FFMPEG v0.8.5 to latest version. As new audio sample formats were introduced in libavutil/samplefmt.h. Now we have both packed format and planar format. Our application, when used with old version to open a MP4 file with AAC encoded audio, the populated pAudioCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLP, but when used with latest FFMPEG version, this value changed to AV_SAMPLE_FMT_FLTP. I found a member AVCodecContext::request_sample_fmt which is said can be set by user. So my question is, how to set it when opening a file. Here is the steps in our application to open a file. 1. avformat_open_input to open a file 2. avcodec_find_decoder get a pointer to AVCodec 3. call avcodec_open to open codec could anybody tell me where to set the requested sample fmt? And if anyone can provide the conversion function from packed data to planar data, I'll be so grateful. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Wed Feb 6 10:29:06 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 6 Feb 2013 11:29:06 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: > Alexey Belkevich writes: > > > Unfortunately it's can't be done. FFMpeg is only decoder, > > all playback routine done with iOS SDK. > > But I will try to think in this direction. Is console log > > of decoding and connection could be helpful? Also, is any > > flag or macros that will enable more detailed console > > output of ffmpeg? > > > > > Please stop top-posting! > > Iirc, you wrote that ffplay works on your desktop for the > given stream. > Does ffmpeg (ffmpeg -i yourstream out.wav) also work? > If yes, please provide complete, uncut console output. > > Next step: Compile ffmpeg (the application) for your > iDevice (it has no additional requirements, so there is > no reason why it should not compile fine). Then test the > same command as above on your device and report if the > output (wav) file is correct. > > (If I did not understand correctly and your stream can > actually not be decoded on your desktop system, then > this should be analyzed: It will be significantly simpler > to reproduce / fix.) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user > > I've checked output.wav for both architectures,and everything is correct. Looks like it's problem in my code. Thanks for help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 6 11:13:24 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 10:13:24 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: Alexey Belkevich writes: > > Does ffmpeg (ffmpeg -i yourstream out.wav) also work? > > If yes, please provide complete, uncut console output. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Please believe me that I do not copy-paste that and that I do not write this to make your life more difficult but because it is needed to get support! > I've checked output.wav for both architectures, > and everything is correct. Looks like it's problem > in my code. My guess is that the decoder you are using changed its output format but it's difficult to say, see above. Please fix your quoting, Carl Eugen From cehoyos at ag.or.at Wed Feb 6 11:17:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 10:17:00 +0000 (UTC) Subject: [Libav-user] How to specify the audio sample format when opening a file References: Message-ID: ??? writes: > Our application, when used with old version to > open a MP4 file with AAC encoded audio, the populated > pAudioCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLP, but > when used with latest FFMPEG version, this value > changed to AV_SAMPLE_FMT_FLTP.? > > I found a member AVCodecContext::request_sample_fmt > which is said can be set by user. This is not a solution because most decoders only support one sample_fmt. Use the aconvert filter to convert between sample formats. Carl Eugen From cehoyos at ag.or.at Wed Feb 6 11:19:07 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 10:19:07 +0000 (UTC) Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: salsaman writes: > http://svn.code.sf.net/p/lives/code/trunk/src/colourspace.c > > (search for convert_yuyv_to_yuv420_frame). This does not look like a good idea, I would expect libswscale to be a magnitude faster. (and it supports other pix_fmts as well.) Carl Eugen From rjvbertin at gmail.com Wed Feb 6 12:04:40 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 6 Feb 2013 12:04:40 +0100 Subject: [Libav-user] cross-compiling - to lib.exe or not, that's the question Message-ID: <802F1ED9-82CE-4FDE-B11C-50B04A225F23@gmail.com> Hello all, The ffmpeg cross-building instructions list 2 ways to link to the produced DLLs from MSVC. Either one runs lib.exe on the corresponding import (.lib) libraries, or one configures the MSVC project not to use linker references. The latter is the default for the MSVC Debug configuration, which begs my question. Is there a reason NOT to skip the lib.exe step so as to be able to build using linker references? In particular, does that allow faster access to the DLL's functions and/or data, which could be beneficial for an application that uses lavc for decompressing content while it plays? TIA, Ren? From belkevich at mlsdev.com Wed Feb 6 12:57:45 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 6 Feb 2013 13:57:45 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: > Please believe me that I do not copy-paste that and > that I do not write this to make your life more > difficult but because it is needed to get support! Here it is. This is output of ffmpeg built for iPhoneSimulator ./ffmpeg -i mmst://wstream5a.di.fm/vocaltrance output.wav ffmpeg version N-49622-g127ff88 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 6 2013 11:14:05 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=i386 --enable-avresample --enable-cross-compile --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --extra-cflags='-arch i386' --extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' --arch=i386 --cpu=i386 --enable-pic --disable-asm libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.101 / 3. 35.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 [asf @ 0x7a203c00] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, asf, from 'mmst://wstream5a.di.fm/vocaltrance': Metadata: title : DIGITALLY IMPORTED - Vocal Trance artist : www.di.fm genre : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: N/A, start: 964129.628000, bitrate: 40 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, stereo, fltp, 40 kb/s Stream #0:1(eng): Data: none, 0 kb/s Output #0, wav, to 'output.wav': Metadata: INAM : DIGITALLY IMPORTED - Vocal Trance IART : www.di.fm IGNR : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 ISFT : Lavf54.61.104 Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s Stream mapping: Stream #0:0 -> #0:0 (wmav2 -> pcm_s16le) Press [q] to stop, [?] for help size= 3832kB time=00:00:30.69 bitrate=1022.9kbits/s video:0kB audio:3832kB subtitle:0 global headers:0kB muxing overhead 0.004332% And this one for native OS X ffmpeg build /ffmpeg -i mmst://wstream5a.di.fm/vocaltrance output.wav ffmpeg version N-49588-g0b6f34c Copyright (c) 2000-2013 the FFmpeg developers built on Feb 5 2013 15:18:40 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.101 / 3. 35.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 [asf @ 0x7f827c00f200] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, asf, from 'mmst://wstream5a.di.fm/vocaltrance': Metadata: title : DIGITALLY IMPORTED - Vocal Trance artist : www.di.fm genre : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: N/A, start: 964197.455000, bitrate: 40 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, stereo, fltp, 40 kb/s Stream #0:1(eng): Data: none, 0 kb/s Output #0, wav, to 'output.wav': Metadata: INAM : DIGITALLY IMPORTED - Vocal Trance IART : www.di.fm IGNR : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 ISFT : Lavf54.61.104 Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s Stream mapping: Stream #0:0 -> #0:0 (wmav2 -> pcm_s16le) Press [q] to stop, [?] for help size= 2296kB time=00:00:18.44 bitrate=1019.8kbits/s video:0kB audio:2296kB subtitle:0 global headers:0kB muxing overhead 0.007231% > My guess is that the decoder you are using changed > its output format but it's difficult to say, see > above. I'm agree with you > Please fix your quoting, Carl Eugen I'm don't understand what exactly you mean? > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 6 13:07:03 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 12:07:03 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: Alexey Belkevich writes: > ? ? Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), > 32000 Hz, stereo, > fltp, 40 kb/s ^^^^^^ This used to be s16, you have to update your source code. Carl Eugen From belkevich at mlsdev.com Wed Feb 6 13:54:44 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 6 Feb 2013 14:54:44 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> Message-ID: <7D8DC44DB8134A349BBC97D89C46CF6B@mlsdev.com> > > This used to be s16, you have to update your source code. > Ok, here it is output of ffmpeg (commit - 8ab2173ed141aa2c3336be7f9880340dfb8dcf5e) iPhoneSimulator build: ./ffmpeg -i mmst://wstream5a.di.fm/vocaltrance output.wav ffmpeg version N-49630-g8ab2173 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 6 2013 14:52:27 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: --prefix=i386 --enable-avresample --enable-cross-compile --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk --target-os=darwin --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc --extra-cflags='-arch i386' --extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk' --arch=i386 --cpu=i386 --enable-pic --disable-asm libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.101 / 3. 35.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 [asf @ 0x79200000] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, asf, from 'mmst://wstream5a.di.fm/vocaltrance': Metadata: title : DIGITALLY IMPORTED - Vocal Trance artist : www.di.fm genre : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: N/A, start: 967853.592000, bitrate: 40 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, stereo, fltp, 40 kb/s Stream #0:1(eng): Data: none, 0 kb/s Output #0, wav, to 'output.wav': Metadata: INAM : DIGITALLY IMPORTED - Vocal Trance IART : www.di.fm IGNR : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 ISFT : Lavf54.61.104 Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s Stream mapping: Stream #0:0 -> #0:0 (wmav2 -> pcm_s16le) Press [q] to stop, [?] for help size=17179869184kB time=00:00:07.01 bitrate=20060934837.9kbits/s video:0kB audio:872kB subtitle:0 global headers:0kB muxing overhead 1970168384.403670% Native build: ./ffmpeg -i mmst://wstream5a.di.fm/vocaltrance output.wav ffmpeg version N-49630-g8ab2173 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 6 2013 14:53:20 with llvm-gcc 4.2.1 (LLVM build 2336.11.00) configuration: libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.100 / 54. 91.100 libavformat 54. 61.104 / 54. 61.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 35.101 / 3. 35.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 [asf @ 0x7fa65980f200] Estimating duration from bitrate, this may be inaccurate Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, asf, from 'mmst://wstream5a.di.fm/vocaltrance': Metadata: title : DIGITALLY IMPORTED - Vocal Trance artist : www.di.fm genre : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 Duration: N/A, start: 967894.016000, bitrate: 40 kb/s Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, stereo, fltp, 40 kb/s Stream #0:1(eng): Data: none, 0 kb/s Output #0, wav, to 'output.wav': Metadata: INAM : DIGITALLY IMPORTED - Vocal Trance IART : www.di.fm IGNR : Electronic Trance Pop WMFSDKVersion : 10.00.00.4007 WMFSDKNeeded : 0.0.0.0000 IsVBR : 0 ISFT : Lavf54.61.104 Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, stereo, s16, 1024 kb/s Stream mapping: Stream #0:0 -> #0:0 (wmav2 -> pcm_s16le) Press [q] to stop, [?] for help size= 1128kB time=00:00:09.08 bitrate=1016.9kbits/s video:0kB audio:1128kB subtitle:0 global headers:0kB muxing overhead 0.014718% > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 6 16:25:41 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 15:25:41 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> <7D8DC44DB8134A349BBC97D89C46CF6B@mlsdev.com> Message-ID: Alexey Belkevich writes: > This used to be s16, you have to update your source code. > > Ok, here it is output of ffmpeg It appears that my sentence above was unclear - sorry! You have to update your source code because FFmpeg does not output decoded wma as s16 anymore. Carl Eugen From belkevich at mlsdev.com Wed Feb 6 17:02:06 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 6 Feb 2013 18:02:06 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> <7D8DC44DB8134A349BBC97D89C46CF6B@mlsdev.com> Message-ID: <5C6E0FDCB7994C5B92F0C1833672E176@mlsdev.com> > It appears that my sentence above was unclear - sorry! > > You have to update your source code because FFmpeg does > not output decoded wma as s16 anymore. > > Carl Eugen My last message contains output of ffmpeg, that I've built today from head of branch master. In my iOS app I hear the sound, but there are a lot of noise. And it's not looks like there are no support of wma. And I found, ffmpeg release, that works fine for me. Here it is - http://ffmpeg.org/releases/ffmpeg-0.11.2.tar.bz2 > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 6 17:47:31 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Feb 2013 16:47:31 +0000 (UTC) Subject: [Libav-user] Noise on mms-stream playing References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> <7D8DC44DB8134A349BBC97D89C46CF6B@mlsdev.com> Message-ID: Carl Eugen Hoyos writes: > Alexey Belkevich writes: > > > This used to be s16, you have to update your source code. > > > > Ok, here it is output of ffmpeg > > It appears that my sentence above was unclear - sorry! Third try: ;-) > You have to update your source code because FFmpeg does > not output decoded wma as s16 anymore. If I understand your use-case correctly, you have written a software that uses libavcodec internally to decode wma. Your software works fine with older versions of libavcodec (FFmpeg 0.11) but not with newer versions of libavcodec (although ffmpeg - the command line application - still works fine, its console outputs looks slightly different though). The reason is that the wma decoder has changed. wma internally uses floats, in the past (until FFmpeg 0.11) these floats were converted to s16 (16 bit integer) inside the decoder. For clarity reasons, it was decided that it makes no sense to convert these floats into int's inside the decoder. The decoder now outputs (planar) floats (the native wma format), assuming you need int's (s16) in your application, you now have to use the aconvert filter (or libswresample directly) to convert from float to int16. Please understand that it is not a solution for you to use 0.11 forever because new features are not backported to old versions of FFmpeg. I hope that clears it up, Carl Eugen From brado at bighillsoftware.com Wed Feb 6 21:20:45 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 6 Feb 2013 13:20:45 -0700 Subject: [Libav-user] Mapping / converting QTCapture's to FFmpeg's pixel format In-Reply-To: References: <548E3B55-FE73-4715-A475-0057C8FFBF9F@bighillsoftware.com> <6AF7F6D2-8597-4D42-87AB-F38AD6FB0631@bighillsoftware.com> Message-ID: <03464EC4-A8B5-4A49-A9E3-084778458862@bighillsoftware.com> On Feb 6, 2013, at 3:19 AM, Carl Eugen Hoyos wrote: > salsaman writes: > >> http://svn.code.sf.net/p/lives/code/trunk/src/colourspace.c >> >> (search for convert_yuyv_to_yuv420_frame). > > This does not look like a good idea, I would > expect libswscale to be a magnitude faster. > (and it supports other pix_fmts as well.) Carl, Salsaman, Alex, Michel (I hope I listed everyone, if I missed someone -- apologies, you too are included), I want to give you guys a huge thanks for the guidance and thoughts on this. I now have video successfully being captured from a webcam, being encoded into FLV format, and published to a Wowza server where it is being consumed by a Flash player. I still have to stream the audio, so there's a good chance you'll be getting some more questions from me on this, but at this point, this is a major leap toward the end result. So here was the answer: My app is pinned back to Snow Leopard for compatibility, so that unfortunately limited me to pixel formats supported by the QTKit API version compatible with OS X 10.6.x, reducing my options there. But I was able to connected the wires: the QTCaptureDecompressedVideoOutput pixel format of kCVPixelFormatType_422YpCbCr8 coincides with the FFmpeg AV_PIX_FMT_UYVY422 pixel format. So I filled an input AVFrame, converted it to a new frame in AV_PIX_FMT_YUV420P pixel format using sws_scale, and then FLV encoding and RTMP streaming worked as expected. So therein was the answer, and knowing that this use case is not all that uncommon (and having spent huge amounts of time Google-touring corners of the Internet for an answer), I hope that others can benefit knowing that a) it can be done, and b) here's how. I'd love to be able to provide some code (in a little more general format) out on Github in the near future. Again guys, thanks...and I'm sure I'll be back soon for audio questions... Cheers, Brad From xuanyu.huang at gmail.com Wed Feb 6 23:38:56 2013 From: xuanyu.huang at gmail.com (FFMPEG) Date: Thu, 7 Feb 2013 09:38:56 +1100 Subject: [Libav-user] How to specify the audio sample format when opening a file In-Reply-To: References: Message-ID: <3E623B4B-BD26-4A94-828F-C96CC77C6FD4@gmail.com> Thanks Carl, Yes, I checked the AAC decoder code and found that only AV_SAMPLE_FMT_FLTP is supported. So I have to do conversion myself. Thanks! ? 2013-2-6?21:17?Carl Eugen Hoyos ??? > ??? writes: > >> Our application, when used with old version to >> open a MP4 file with AAC encoded audio, the populated >> pAudioCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLP, but >> when used with latest FFMPEG version, this value >> changed to AV_SAMPLE_FMT_FLTP. >> >> I found a member AVCodecContext::request_sample_fmt >> which is said can be set by user. > > This is not a solution because most decoders > only support one sample_fmt. > > Use the aconvert filter to convert between > sample formats. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From cehoyos at ag.or.at Thu Feb 7 01:28:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 7 Feb 2013 00:28:19 +0000 (UTC) Subject: [Libav-user] How to specify the audio sample format when opening a file References: <3E623B4B-BD26-4A94-828F-C96CC77C6FD4@gmail.com> Message-ID: FFMPEG writes: > Yes, I checked the AAC decoder code and found that > only AV_SAMPLE_FMT_FLTP is supported. > So I have to do conversion myself. Fortunately not! You can either use the aconvert filter or call libswresample directly. Please do not top-post here, Carl Eugen From belkevich at mlsdev.com Thu Feb 7 08:34:01 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Thu, 7 Feb 2013 09:34:01 +0200 Subject: [Libav-user] Noise on mms-stream playing In-Reply-To: References: <38D7216823974E2597AEB99409871F4A@mlsdev.com> <72C68657869C420280EF1F1F35321AC6@mlsdev.com> <7D8DC44DB8134A349BBC97D89C46CF6B@mlsdev.com> Message-ID: <58855646F8C94102BD94F375AF12068F@mlsdev.com> > If I understand your use-case correctly, you have written > a software that uses libavcodec internally to decode wma. > Your software works fine with older versions of libavcodec > (FFmpeg 0.11) but not with newer versions of libavcodec > (although ffmpeg - the command line application - still > works fine, its console outputs looks slightly different > though). > > Exactly! > > The reason is that the wma decoder has changed. wma > internally uses floats, in the past (until FFmpeg 0.11) > these floats were converted to s16 (16 bit integer) inside > the decoder. For clarity reasons, it was decided that it > makes no sense to convert these floats into int's inside > the decoder. > The decoder now outputs (planar) floats (the native wma format), > assuming you need int's (s16) in your application, you now have > to use the aconvert filter (or libswresample directly) to > convert from float to int16. > > Ok, I will try to use it > > Please understand that it is not a solution for you to use > 0.11 forever because new features are not backported to > old versions of FFmpeg. > > Of course, thats why I'm writing here =) > > I hope that clears it up, Carl Eugen > > Now everything is clear. Thank you very much Carl! -------------- next part -------------- An HTML attachment was scrubbed... URL: From pavel at sokolov.me Thu Feb 7 15:00:10 2013 From: pavel at sokolov.me (Pavel Sokolov) Date: Thu, 07 Feb 2013 18:00:10 +0400 Subject: [Libav-user] avio read proxy Message-ID: <5113B36A.8030207@sokolov.me> Hi! For some reasons I need to implement universal avio proxy, which will support all ffmpeg protocols. The main goal is to parse all avio_read traffic via some custom function. So, I create custom context with direct i/o: AVIOContext* _ffmpeg_io_context = avio_alloc_context(NULL, 0, 0, // writeflag this, //context (opaque) readFunctionWrapper, //read NULL , //write seekFunctionWrapper );//seek _ffmpeg_io_context->direct = true; After I open the original avio: AVIOContext* _origAvio = NULL; avio_open2(&_origAvio, _url.c_str(), AVIO_FLAG_READ, NULL, NULL); _ffmpeg_io_context->seekable = _origAvio->seekable; /// Set to custom avio seekable flags from the original avio My custom functions looks like this: int FFmpegIoProxy::readFunction(uint8_t* buf, int buf_size){ int res = avio_read(_origAvio, buf, buf_size); if (res>0){ ... do something with buf } return buf; } int64_t FFmpegIoProxy::seekFunction(int64_t offset, int whence){ return avio_seek(_origAvio, offset, whence); } After I open avformat with custom i/o: _ffmpeg_format_context = avformat_alloc_context(); _ffmpeg_format_context->pb= _ffmpeg_io_context; avformat_open_input(&_ffmpeg_format_context, NULL, NULL, NULL); Local (file://) url works fine, but when I try to open http:// protocol I see messages: [http @ 0x4b97c0] HTTP error 416 Requested Range Not Satisfiable So, really it requesting out-of range data. Is somebody knows, what is wrong? May be I need to set some more fields of my proxy avio? -- With best regards, Pavel A. Sokolov mobile: +7(921)419-1819 skype: pavel_a_sokolov From vsawant at crestron.com Thu Feb 7 17:54:31 2013 From: vsawant at crestron.com (Vikas Sawant) Date: Thu, 7 Feb 2013 16:54:31 +0000 Subject: [Libav-user] Compiling fails when compiling using FreeScale iMX27 toolchain Message-ID: configure --disable-runtime-cpudetect --enable-cross-compile --cc='arm-none-linux-gnueabi-gcc' --cross-prefix='/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-' --arch=armv5te --cpu=armv5te --pkg-config='/opt/freescale/ltib/usr/bin/pkg-config' --disable-vfp --disable-armv6 --disable-armv6t2 --disable-neon --target-os=linux --disable-debug --disable-yasm --enable-postproc --disable-encoders --disable-muxers CC libavfilter/af_volume.o /tmp/ccpfLjll.s: Assembler messages: /tmp/ccpfLjll.s:99: Error: selected processor does not support `itet ne' make: *** [libavfilter/af_volume.o] Error 1 Compilation goes through only after I disable assembly (--disable-asm). Thanks, Vikas This e-mail message and all attachments transmitted with it may contain legally privileged and confidential information intended solely for the use of the addressee. If you are not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Feb 7 18:49:39 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 7 Feb 2013 17:49:39 +0000 (UTC) Subject: [Libav-user] Compiling fails when compiling using FreeScale iMX27 toolchain References: Message-ID: Vikas Sawant writes: > CC????? libavfilter/af_volume.o > /tmp/ccpfLjll.s: Assembler messages: > /tmp/ccpfLjll.s:99: Error: selected processor does not support `itet ne' > make: *** [libavfilter/af_volume.o] Error 1 Since it is not clear to me if this is a compiler error or a bug in FFmpeg: Please provide the preprocessed source file. > This e-mail message and all attachments transmitted > with it may contain legally privileged and > confidential information Please understand that this sentence makes no sense on a public mailing list that is mirrored many times on the internet. Carl Eugen From ashwin.c at sisa.samsung.com Fri Feb 8 00:08:05 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Thu, 7 Feb 2013 23:08:05 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 Message-ID: I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashwin.c at sisa.samsung.com Fri Feb 8 00:28:43 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Thu, 7 Feb 2013 23:28:43 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: Message-ID: To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From er.anshul.maheshwari at gmail.com Fri Feb 8 07:13:45 2013 From: er.anshul.maheshwari at gmail.com (Anshul) Date: Fri, 08 Feb 2013 11:43:45 +0530 Subject: [Libav-user] FFMPEG giving error at compilation In-Reply-To: References: Message-ID: <51149799.9080805@gmail.com> HI Guys when I compile ffmpeg1.1 with enable-gpl flag and enable-x264 flag I get an error "can?t find a register in class ?GENERAL_REGS?" Its in File libpostproc/postprocess_template.c:1094:5 can anyone help me to remove it out Thanks Anshul From cehoyos at ag.or.at Fri Feb 8 08:22:37 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 8 Feb 2013 07:22:37 +0000 (UTC) Subject: [Libav-user] FFMPEG giving error at compilation References: <51149799.9080805@gmail.com> Message-ID: Anshul writes: > Guys when I compile ffmpeg1.1 with enable-gpl flag and > enable-x264 flag I get an error "can?t find a register > in class ?GENERAL_REGS?" > Its in File libpostproc/postprocess_template.c:1094:5 Please test the following: $ make distclean $ ./configure --enable-gpl --enable-libx264 && make ffmpeg If you see the build failure indicated above, please run: $ make V=1 and post the complete, uncut console output of the last make run. Please do never post the complete, uncut console output of the first make call. And please post your gcc version. Note that thread-hijacking is very rude and therefore not welcome! Carl Eugen From er.anshul.maheshwari at gmail.com Fri Feb 8 09:14:24 2013 From: er.anshul.maheshwari at gmail.com (Anshul) Date: Fri, 08 Feb 2013 13:44:24 +0530 Subject: [Libav-user] FFMPEG giving error at compilation In-Reply-To: References: <51149799.9080805@gmail.com> Message-ID: <5114B3E0.4060103@gmail.com> On 02/08/2013 12:52 PM, Carl Eugen Hoyos wrote: > Anshul writes: > >> Guys when I compile ffmpeg1.1 with enable-gpl flag and >> enable-x264 flag I get an error "can?t find a register >> in class ?GENERAL_REGS?" >> Its in File libpostproc/postprocess_template.c:1094:5 > Please test the following: > $ make distclean > $ ./configure --enable-gpl --enable-libx264 && make ffmpeg > > If you see the build failure indicated above, please run: > $ make V=1 > > and post the complete, uncut console output of the last > make run. Please do never post the complete, uncut > console output of the first make call. > > And please post your gcc version. > > Note that thread-hijacking is very rude and therefore > not welcome! > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user using command /configure --enable-gpl --enable-libx264 && make ffmpeg every thing worked but when i am using the below flag it is giving me compilation error: ./configure --disable-optimizations --enable-gpl --enable-libx264 error at compile Time gcc -I. -I./ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DHAVE_AV_CONFIG_H -std=c99 -pthread -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -g -Wdeclaration-after-statement -Wall -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=vla -MMD -MF libpostproc/postprocess.d -MT libpostproc/postprocess.o -c -o libpostproc/postprocess.o libpostproc/postprocess.c In file included from libpostproc/postprocess.c:556:0: libpostproc/postprocess_template.c: In function ?dering_MMX2?: libpostproc/postprocess_template.c:1094:5: error: can?t find a register in class ?GENERAL_REGS? while reloading ?asm? libpostproc/postprocess_template.c:1094:5: error: ?asm? operand has impossible constraints make: *** [libpostproc/postprocess.o] Error 1 gcc version 4.6.2 pardon me if I am unintentionaly culprit of thread hi-jacking, but can you expain it how. Note that thread-hijacking is very rude and therefore not welcome! Thanks Anshul -------------- next part -------------- An HTML attachment was scrubbed... URL: From harald.jordan at redstream.at Fri Feb 8 09:53:29 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Fri, 8 Feb 2013 09:53:29 +0100 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: Message-ID: <001601ce05d9$c464b720$4d2e2560$@redstream.at> If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x2 64 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From xuanyu.huang at gmail.com Fri Feb 8 14:00:31 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Sat, 9 Feb 2013 00:00:31 +1100 Subject: [Libav-user] What' the difference of decoding an Audio frame of planar sample format with avcodec_decode_audio3 and 4 Message-ID: Hi All, I'm now upgrading our application to use the latest ffmpeg version. In old version the AAC decoder supports packed sample but the latest AAC decoder only supports planar sample format. Our application uses avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, int *frame_size_ptr, AVPacket *avpkt) to decode a frame. While the sample data is stored in a simple array. I want to know how the data will be laid out in this array. Let's assume audio has 2 channels: A and B. 1. will the output sample array be laid out like A1B1A2B2A3B3... if we use avcodec_decode_audio3 with old version AAC decoder 2. will the output sample array be laid out like A1A2A3....B1B2B3... if use avcodec_decode_audio3 with latest AAC decoder and I also want to know what's the result if I use avcodec_decode_audio4 to decode a frame, because unlike the decode_audio3, the decoded samples are stored in an two-dimensional array uint8_t *AVFrame::data[AV_NUM_DATA_POINTERS]; 3. will the output sample array be laid out like data[0] : A1B1A2B2A3B3.... data[1] : 0 data[2] : 0 if we use avcodec_decode_audio4 with old version AAC decoder 4. will the output sample array be laid out like data[0] : A1A2A3... data[1] : B1B2B3 data[2] : 0 if we use avcodec_decode_audio4 with latest version AAC decoder? I don't have code at hand now so I can't run application myself to check the result. Another thing is about libavresample and libswresample. I know this two libraries provide interfaces to convert data format. But if what I want is just array re-layout (as AAC decoder upgraded from packed sample format to planar format). May I just do that by array manipulation, without using these two libraries? Great thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Feb 8 14:28:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 8 Feb 2013 13:28:19 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?What=27_the_difference_of_decoding_an_Audi?= =?utf-8?q?o_frame_of_planar_sample_format_with_avcodec=5Fdecode=5F?= =?utf-8?q?audio3_and_4?= References: Message-ID: ??? writes: > Another thing is about libavresample and libswresample. Please note that only libswresample is supported (and shold therefore be used). > I know this two libraries provide interfaces to convert data format. > But if what I want is just array re-layout (as AAC decoder upgraded > from packed sample format to planar format). May I just do that by > array manipulation, without using these two libraries? Just as with libswscale, the library libswresample is provided for your convenience, you may or may not use it on your discretion. Carl Eugen From jmorgie at yahoo.com Fri Feb 8 16:43:23 2013 From: jmorgie at yahoo.com (jim morgenstern) Date: Fri, 8 Feb 2013 10:43:23 -0500 Subject: [Libav-user] avpicture_alloc returns error -12 at frame 308 Message-ID: <04f301ce0613$0770c7a0$165256e0$@yahoo.com> Application using ffmpeg to read and write QT files. C++, Win 7. First 300+ calls to avpicture_alloc succeed; then the next one returns error despite valid parameters in function call: { AVPicture* reformatFrame = new AVPicture; ap = avpicture_alloc( reformatFrame, iPxfmt, nss, nlines); in same module, after processing reformatFrame it gets released: avpicture_free(reformatFrame); delete reformatFrame; } When it fails, the return code, ap, is -12 Smells like a memory leak, though. I run vld [visual lead detector] and it does not report any memory leaks. Any ideas where to look? What would -12 mean ?? Jim Morgenstern Image Mining LLC 248-252-2626 -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Fri Feb 8 16:58:03 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Fri, 8 Feb 2013 16:58:03 +0100 Subject: [Libav-user] cross-compiling for win32 with --enable-libopenjpeg Message-ID: <3B2B8710-2E00-40E9-B04F-E250A160DB41@gmail.com> Hello, I'm probably overlooking something but am a bit stuck trying to cross-compile FFmpeg for win32 (on OS X), linking in libopenjpeg. I've grabbed the libopenjpeg-1.5.1 binaries from openjpeg.org, but the the configure process fails on the test app, not finding opj_version. What's the way around this? Curiously, I had the same error after downloading the 1.5.1 binaries for OS X, even though the symbol clearly existed in the dylib. I ended up installing the universal openjpeg at 1.5.0 from MacPorts and linking against that, but clearly that's not an option for cross-compiling ... Ren? From ashwin.c at sisa.samsung.com Fri Feb 8 17:38:45 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Fri, 8 Feb 2013 16:38:45 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: <001601ce05d9$c464b720$4d2e2560$@redstream.at> References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> Message-ID: But the decoding_encoding example works for me without any changes. The problem is if you just want to encode two frames and flush them all out. With 25 there doesn't seem to be any issues. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 12:53 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x264 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerome.salayet at hymatom.fr Fri Feb 8 18:49:46 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Fri, 8 Feb 2013 18:49:46 +0100 Subject: [Libav-user] FFMPEG decoding H264 and Multithreading Message-ID: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> Hello, I'm using FFMPEG to decode video streaming from an IP Camera. all seems good but I try to decrease the CPU usage of my application when I decompress several differents streams. In fact, I have a dual core processor, and if I decode one stream, my CPU usage is very low (so good). If I decompress two streams, it's ok too. But if I had a third decompression, my CPU increase from 2-5% to 25-30%. So, I try to activate Mutlithreading in FFMPEG (compiling with --enable-w32threads) with Mingw. But if I initialize my AVCodecContext with thread_count=3 (because I have a dual core processor) and thread_type = FF_THREAD_FRAME|FF_THREAD_SLICE, when I use avcodec_open2, I always got an result error -22: The maximum value for lowres supported by the decoder is 0. I read where this message appear in FFMPEG code source and it's in utils.c if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) But in my code before call avcodec_open2( lpCodecCtx, lpCodec, ...) I have m_lpCodec->max_lowres=0 and m_lpCodecCtx->lowres=0, so I don't understa,nd why I always have this error. After add some traces in Utils.c, it seems I have avctx->codec->max_lowres=0 and avctx->lowres=3 but I don't understand why... Perhaps, trying Multithreading isn"t the good solution to decrease the CPU usage, I'm not very sure of this point. Thanks for your answers, J?r?me SALAYET Ing?nieur Informatique T?l : 04 67 87 61 12 Fax : 04 67 70 85 44 Site web : www.hymatom.fr Email : jerome.salayet at hymatom.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 7598 bytes Desc: image001.png URL: From ashwin.c at sisa.samsung.com Fri Feb 8 19:21:55 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Fri, 8 Feb 2013 18:21:55 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> Message-ID: All those presets I tried but didn't help. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Friday, February 08, 2013 8:39 AM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 But the decoding_encoding example works for me without any changes. The problem is if you just want to encode two frames and flush them all out. With 25 there doesn't seem to be any issues. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 12:53 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x264 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From harald.jordan at redstream.at Fri Feb 8 19:42:14 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Fri, 8 Feb 2013 19:42:14 +0100 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> Message-ID: <018801ce062c$04158550$0c408ff0$@redstream.at> Hm, i really dont believe your problem is the flushing part itself. I wonder if the pkt you are sending to the encoder is initialized - at least i cannot see how. There is a huge number of issues in avcodec_encode_video2 that occur when you send it a pkt that it did not expect. Here is how I flush at the end of transcoding: int stillgotframes = 1; while(stillgotframes){ AVPacket pkt; av_init_packet(&pkt); int got_packet=0; int ret = -1; pkt.size = video_outbuf_size; //1000000 pkt.data = video_outbuf; // constant location in memory ret = avcodec_encode_video2(video_st->codec, &pkt, NULL, &got_packet); av_interleaved_write_frame(oc, &pkt); stillgotframes = got_packet; } Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Friday, February 08, 2013 7:22 PM An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 All those presets I tried but didn't help. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Friday, February 08, 2013 8:39 AM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 But the decoding_encoding example works for me without any changes. The problem is if you just want to encode two frames and flush them all out. With 25 there doesn't seem to be any issues. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 12:53 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x2 64 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From ashwin.c at sisa.samsung.com Fri Feb 8 20:26:11 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Fri, 8 Feb 2013 19:26:11 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: <018801ce062c$04158550$0c408ff0$@redstream.at> References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <018801ce062c$04158550$0c408ff0$@redstream.at> Message-ID: Tried your flushing method too but did not make a difference. The only way I can get this to work correctly is if I never flush frames until I know I'm at the end of the video stream. The problem is in my case I don't know when the video stream ends or changes into a different one (different width/height). I still don't get why MPEG2 encoder is fine with flushing after every encode but H264 is not. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 10:42 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 Hm, i really dont believe your problem is the flushing part itself. I wonder if the pkt you are sending to the encoder is initialized - at least i cannot see how. There is a huge number of issues in avcodec_encode_video2 that occur when you send it a pkt that it did not expect. Here is how I flush at the end of transcoding: int stillgotframes = 1; while(stillgotframes){ AVPacket pkt; av_init_packet(&pkt); int got_packet=0; int ret = -1; pkt.size = video_outbuf_size; //1000000 pkt.data = video_outbuf; // constant location in memory ret = avcodec_encode_video2(video_st->codec, &pkt, NULL, &got_packet); av_interleaved_write_frame(oc, &pkt); stillgotframes = got_packet; } Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Friday, February 08, 2013 7:22 PM An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 All those presets I tried but didn't help. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Friday, February 08, 2013 8:39 AM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 But the decoding_encoding example works for me without any changes. The problem is if you just want to encode two frames and flush them all out. With 25 there doesn't seem to be any issues. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 12:53 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x264 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sat Feb 9 01:19:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 9 Feb 2013 00:19:43 +0000 (UTC) Subject: [Libav-user] FFMPEG decoding H264 and Multithreading References: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> Message-ID: J?r?me SALAYET writes: > if I decode one stream, my CPU usage is very low > (so good). If I decompress two streams, it's ok too. > But if I had a third decompression, my CPU increase > from 2-5% to 25-30%.So, I try to activate > Mutlithreading in FFMPEG You should use multi-threading if you want to decrease overall decoding time, if you need minimal cpu usage, force -threads 1 (multithreading always has an overhead). > (compiling with --enable-w32threads) with Mingw I believe this should not be necessary, if it is there may be a bug (that should be reported). Carl Eugen From cehoyos at ag.or.at Sat Feb 9 12:55:01 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 9 Feb 2013 11:55:01 +0000 (UTC) Subject: [Libav-user] FFMPEG giving error at compilation References: <51149799.9080805@gmail.com> <5114B3E0.4060103@gmail.com> Message-ID: Anshul writes: > ./configure --disable-optimizations --enable-gpl I sent a patch to fix this but please note that --disable-optimizations is a debugging option (for developers) that may not allow to compile all files (depending on architecture and compiler), please make sure you do not use it for production. [...] > pardon me if I am unintentionaly culprit of thread > hi-jacking, but can you expain it how. See http://ffmpeg.org/contact.html and http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/9877/focus=9879 Carl Eugen From cehoyos at ag.or.at Sat Feb 9 15:06:30 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 9 Feb 2013 14:06:30 +0000 (UTC) Subject: [Libav-user] FFMPEG giving error at compilation References: <51149799.9080805@gmail.com> <5114B3E0.4060103@gmail.com> Message-ID: Anshul writes: > when i am using the below flag it is giving me > compilation error: > > ./configure --disable-optimizations --enable-gpl Should be fixed, thank you for the report! Carl Eugen From rjvbertin at gmail.com Sat Feb 9 17:07:11 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Sat, 9 Feb 2013 17:07:11 +0100 Subject: [Libav-user] yuv420p mjp2 track misidentified as gray8 ? Message-ID: Hello, I'm playing with Motion-JPEG2000 support in my FFusion QuickTime component, mostly for fun, I have a test video produced with a recent ffmpeg version, from an mp4v video with `-vcodec libopenjpeg kk2.mov` The matching ffprobe identifies this as mjp2 yuv420p content, ffprobe from the ffmpeg version used by FFusion identifies it as gray8. The same libopenjpeg is used in both cases. I'm aware that FFusion uses an old lavc (v 52), and that maybe it does some kind of internal conversion of the yuv420p content into gray8, for whatever reason. But if that is not the case, is there a way to interpret (or complete) the frame data returned by avcodec_decode_video2() to reconstruct a colour image? The ffprobe outputs: > ffprobe -show_streams kk2.mov ffprobe version 1.1.1 Copyright (c) 2007-2013 the FFmpeg developers built on Jan 27 2013 12:08:35 with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3) configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/gcc-4.2 --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid libavutil 52. 13.100 / 52. 13.100 libavcodec 54. 86.100 / 54. 86.100 libavformat 54. 59.106 / 54. 59.106 libavdevice 54. 3.102 / 54. 3.102 libavfilter 3. 32.100 / 3. 32.100 libswscale 2. 1.103 / 2. 1.103 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kk2.mov': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt encoder : Lavf54.59.106 Duration: 00:00:53.00, start: 0.000000, bitrate: 20575 kb/s Stream #0:0(eng): Video: jpeg2000 (mjp2 / 0x32706A6D), yuv420p, 720x576, 20575 kb/s, 12 fps, 12 tbr, 12288 tbn, 12288 tbc Metadata: handler_name : DataHandler [STREAM] index=0 codec_name=libopenjpeg codec_long_name=OpenJPEG JPEG 2000 profile=unknown codec_type=video codec_time_base=1/12288 codec_tag_string=mjp2 codec_tag=0x32706a6d width=720 height=576 has_b_frames=0 sample_aspect_ratio=0:1 display_aspect_ratio=0:1 pix_fmt=yuv420p level=-99 timecode=N/A id=N/A r_frame_rate=12/1 avg_frame_rate=12/1 time_base=1/12288 start_pts=0 start_time=0.000000 duration_ts=651264 duration=53.000000 bit_rate=20575025 nb_frames=636 nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=0 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 TAG:language=eng TAG:handler_name=DataHandler [/STREAM] > FFusion-124R/FFmpeg/osx86/bin/ffprobe -show_streams kk2.mov FFprobe version SVN-r1435, Copyright (c) 2007-2011 the FFmpeg developers built on Feb 8 2013 16:20:46 with gcc 4.2.1 (Apple Inc. build 5664) configuration: --extra-ldflags='-mmacosx-version-min=10.6 -D__DARWIN_UNIX03=0 -Dattribute_deprecated= -w -msse3 -msse4 -mssse3 -arch i386' --cpu=core2 --extra-cflags='-arch i386 -mmacosx-version-min=10.6 -D__DARWIN_UNIX03=0 -Dattribute_deprecated= -w -msse3 -msse4 -mssse3 -fweb -fstrict-aliasing -finline-limit=1000 -freorder-blocks -O3 -finline-functions -funroll-loops -ftree-vectorize -ftracer -mdynamic-no-pic -mtune=core2 --param max-completely-peel-times=2' --prefix=/Volumes/Debian/Users/bertin/work/src/MacOSX/FFusion-124R/FFmpeg/osx86 --cc=gcc-4.2 --disable-amd3dnow --disable-doc --disable-encoders --enable-ffprobe --disable-ffserver --disable-muxers --disable-network --enable-libopenjpeg --extra-cflags=-I/opt/local/include --extra-ldflags=-L/opt/local/lib --enable-swscale --enable-avfilter --disable-avdevice --enable-ffmpeg --target-os=darwin libavutil 50.36. 0 / 50.36. 0 libavcore 0.16. 1 / 0.16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52.93. 0 / 52.93. 0 libavfilter 1.74. 0 / 1.74. 0 libswscale 0.12. 0 / 0.12. 0 [libopenjpeg @ 0x100a000] Only first component will be used. Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'kk2.mov': Metadata: major_brand : qt minor_version : 512 compatible_brands: qt encoder : Lavf54.59.106 Duration: 00:00:53.00, start: 0.000000, bitrate: 20575 kb/s Stream #0.0(eng): Video: libopenjpeg, gray, 720x576, 20575 kb/s, 12 fps, 12 tbr, 12288 tbn, 12288 tbc [STREAM] index=0 codec_name=libopenjpeg codec_long_name=OpenJPEG based JPEG 2000 decoder codec_type=video codec_time_base=1/12288 codec_tag_string=mjp2 codec_tag=0x32706a6d width=720 height=576 has_b_frames=0 pix_fmt=gray r_frame_rate=12/1 avg_frame_rate=12/1 time_base=1/12288 start_time=0.000000 duration=53.000000 nb_frames=636 TAG:language=eng [/STREAM] From onemda at gmail.com Sat Feb 9 17:12:59 2013 From: onemda at gmail.com (Paul B Mahol) Date: Sat, 9 Feb 2013 16:12:59 +0000 Subject: [Libav-user] yuv420p mjp2 track misidentified as gray8 ? In-Reply-To: References: Message-ID: On 2/9/13, "Rene J.V. Bertin" wrote: > Hello, > > I'm playing with Motion-JPEG2000 support in my FFusion QuickTime component, > mostly for fun, > > I have a test video produced with a recent ffmpeg version, from an mp4v > video with `-vcodec libopenjpeg kk2.mov` > > The matching ffprobe identifies this as mjp2 yuv420p content, ffprobe from > the ffmpeg version used by FFusion identifies it as gray8. > The same libopenjpeg is used in both cases. > > I'm aware that FFusion uses an old lavc (v 52), and that maybe it does some > kind of internal conversion of the yuv420p content into gray8, for whatever > reason. But if that is not the case, is there a way to interpret (or > complete) the frame data returned by avcodec_decode_video2() to reconstruct > a colour image? Negative. From i.like.privacy.too at gmail.com Sat Feb 9 19:32:48 2013 From: i.like.privacy.too at gmail.com (Camera Man) Date: Sat, 09 Feb 2013 13:32:48 -0500 Subject: [Libav-user] FFMPEG decoding H264 and Multithreading In-Reply-To: References: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> Message-ID: <51169650.1060908@gmail.com> On 02/08/2013 07:19 PM, Carl Eugen Hoyos wrote: > You should use multi-threading if you want > to decrease overall decoding time, if you > need minimal cpu usage, force -threads 1 > (multithreading always has an overhead). Additionally, multithreading introduces a decoding delay of (number of threads) frames - e.g., if you use 4 threads, the earliest time you'll get your frame out is when you feed in the 5th. If you're decoding from a file, that makes no difference - however, if you're showing a live stream at (say) 15 fps, then a 4 frame delay = ~300ms which is very noticeable - in this case you would also want to disable threads. From rjvbertin at gmail.com Sat Feb 9 19:44:14 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Sat, 9 Feb 2013 19:44:14 +0100 Subject: [Libav-user] FFMPEG decoding H264 and Multithreading In-Reply-To: <51169650.1060908@gmail.com> References: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> <51169650.1060908@gmail.com> Message-ID: <06A3F9D2-53D5-4B18-BE30-811B49C66524@gmail.com> On Feb 09, 2013, at 19:32, Camera Man wrote: > On 02/08/2013 07:19 PM, Carl Eugen Hoyos wrote: > >> You should use multi-threading if you want >> to decrease overall decoding time, if you >> need minimal cpu usage, force -threads 1 >> (multithreading always has an overhead). And, if it's still actual, multithreaded decoding only makes sense for H.264 with slices. R From cehoyos at ag.or.at Sat Feb 9 20:03:34 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 9 Feb 2013 19:03:34 +0000 (UTC) Subject: [Libav-user] FFMPEG decoding H264 and Multithreading References: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> <51169650.1060908@gmail.com> <06A3F9D2-53D5-4B18-BE30-811B49C66524@gmail.com> Message-ID: Ren? J.V. Bertin writes: > multithreaded decoding only makes sense for H.264 with slices. This is not correct. Carl Eugen From alexcohn at netvision.net.il Sat Feb 9 20:07:54 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sat, 9 Feb 2013 21:07:54 +0200 Subject: [Libav-user] FFMPEG decoding H264 and Multithreading In-Reply-To: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> References: <79C91ED810DD8A49B375C899D0034D270993AE@mail.hymatom.fr> Message-ID: On Fri, Feb 8, 2013 at 7:49 PM, J?r?me SALAYET wrote: > Hello, I'm using FFMPEG to decode video streaming from an IP Camera. all > seems good but I try to decrease the CPU usage of my application when I > decompress several differents streams. > In fact, I have a dual core processor, and if I decode one stream, my CPU > usage is very low (so good). If I decompress two streams, it's ok too. But > if I had a third decompression, my CPU increase from 2-5% to 25-30%. > > So, I try to activate Mutlithreading in FFMPEG (compiling with > --enable-w32threads) with Mingw.**** > > Perhaps, trying Multithreading isn"t the good solution to decrease the CPU > usage, I'm not very sure of this point. > Other authors gave you important advice, but to address your specific question: multithreading is definitely nice for multi-stream decoding, especially when you have multi-core CPU. But this should not be multithreaded decoding: the best overall performance can be achieved when separate threads are attached to each input stream, and each thread uses a "single-threaded" decoder instance. BR, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexcohn at netvision.net.il Sat Feb 9 20:37:56 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sat, 9 Feb 2013 21:37:56 +0200 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> Message-ID: On Fri, Feb 8, 2013 at 8:21 PM, Ashwin Chandra - SISA wrote: > All those presets I tried but didn?t help. You should try the zerolatency preset, and not allow any b-frames if you want to flush so often. You can try to set max gop size to 1. Even in this case, h264 is not optimized for this kind of flushing. What were the motivations of choosing this codec? JPEG should suit you best. BR, Alex From harald.jordan at redstream.at Sat Feb 9 20:58:42 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Sat, 9 Feb 2013 20:58:42 +0100 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <018801ce062c$04158550$0c408ff0$@redstream.at> Message-ID: <01a201ce06ff$dd3b20f0$97b162d0$@redstream.at> I prefer using the mux example for playing around with encoding stuff. Here is a version that I slightly altered especially for you. Additionally I it as a text file in attachment (don't know if this works). As you can see in the include section, it is a Visual studio (2010) one and C++. It is tested only to encode h264+aac and flush the video encoder, this worked. The part that allows to set the audio_codec_string manually is not implemented by now, its just begun. Using ffmpeg-20120810-git-633b90c-win64-dev /* * Libavformat API example: Output a media file in any supported * libavformat format. The default codecs are used. * * Copyright (c) 2003 Fabrice Bellard * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include "stdafx.h" #include "inttypes.h" #include #include #include #include extern "C" { #include #include #include #include #include #include #include } #undef exit const char * audio_codec_string = "pcm_s16le"; //set audio and video codec manually, const char * video_codec_string = "libx264"; const char *filename="c:\\out.mov"; //format is deduced from file extension /* 5 seconds stream duration */ #define STREAM_DURATION 200.0 #define STREAM_FRAME_RATE 25 /* 25 images/s */ #define STREAM_NB_FRAMES ((int)(STREAM_DURATION * STREAM_FRAME_RATE)) #define STREAM_PIX_FMT PIX_FMT_YUV420P /* default pix_fmt */ static int sws_flags = SWS_BICUBIC; /**************************************************************/ /* audio output */ static float t, tincr, tincr2; static int16_t *samples; static int audio_input_frame_size; /* * add an audio output stream */ static AVStream *add_audio_stream(AVFormatContext *oc, enum AVCodecID codec_id) { /* * add an audio output stream */ AVCodecContext *c; AVStream *st; st = av_new_stream(oc, 1); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(130); } c = st->codec; c->codec_id = codec_id; c->codec_type = AVMEDIA_TYPE_AUDIO; c->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; //for aac /* put sample parameters */ AVCodec* out_codec = avcodec_find_encoder(codec_id); c->sample_fmt = out_codec->sample_fmts[0]; c->bit_rate = 64000; c->sample_rate = 22050; c->channels = 1; // some formats want stream headers to be separate if(oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } static void open_audio(AVFormatContext *oc, AVStream *st) { AVCodecContext *c; c = st->codec; c->codec = avcodec_find_encoder(c->codec_id); //original ; /* open it */ if (avcodec_open2(c, c->codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(301); } /* init signal generator */ t = 0; tincr = 2 * M_PI * 110.0 / c->sample_rate; /* increment frequency by 110 Hz per second */ tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate; if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) audio_input_frame_size = 10000; else audio_input_frame_size = c->frame_size; samples = (int16_t *)av_malloc(audio_input_frame_size * av_get_bytes_per_sample(c->sample_fmt) * c->channels); } /* Prepare a 16 bit dummy audio frame of 'frame_size' samples and * 'nb_channels' channels. */ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels) { int j, i, v; int16_t *q; q = samples; for (j = 0; j < frame_size; j++) { v = (int)(sin(t) * 10000); for (i = 0; i < nb_channels; i++) *q++ = v; t += tincr; tincr += tincr2; } } static void write_audio_frame(AVFormatContext *oc, AVStream *st) { AVCodecContext *c; AVPacket pkt = { 0 }; // data and size must be 0; AVFrame *frame = avcodec_alloc_frame(); int got_packet; av_init_packet(&pkt); c = st->codec; get_audio_frame(samples, audio_input_frame_size, c->channels); frame->nb_samples = audio_input_frame_size; avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, (uint8_t *)samples, audio_input_frame_size * av_get_bytes_per_sample(c->sample_fmt) * c->channels, 1); avcodec_encode_audio2(c, &pkt, frame, &got_packet); if (!got_packet) return; pkt.stream_index = st->index; /* Write the compressed frame to the media file. */ if (av_interleaved_write_frame(oc, &pkt) != 0) { fprintf(stderr, "Error while writing audio frame\n"); exit(1); } } static void close_audio(AVFormatContext *oc, AVStream *st) { avcodec_close(st->codec); av_free(samples); } /**************************************************************/ /* video output */ static AVFrame *picture, *tmp_picture; static uint8_t *video_outbuf; static int frame_count, video_outbuf_size; /* Add a video output stream. */ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) { AVCodecContext *c; AVStream *st; AVCodec *codec; /* find the video encoder */ codec = avcodec_find_encoder((AVCodecID)codec_id); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } st = avformat_new_stream(oc, codec); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(1); } c = st->codec; /* find the video encoder */ codec = avcodec_find_encoder((AVCodecID)codec_id); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } avcodec_get_context_defaults3(c, codec); c->codec_id = (AVCodecID)codec_id; /* Put sample parameters. */ c->bit_rate = 400000; /* Resolution must be a multiple of two. */ c->width = 352; c->height = 288; /* timebase: This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, * timebase should be 1/framerate and timestamp increments should be * identical to 1. */ c->time_base.den = STREAM_FRAME_RATE; c->time_base.num = 1; c->gop_size = 12; /* emit one intra frame every twelve frames at most */ c->pix_fmt = STREAM_PIX_FMT; if (c->codec_id == CODEC_ID_MPEG2VIDEO) { /* just for testing, we also add B frames */ c->max_b_frames = 2; } if (c->codec_id == CODEC_ID_MPEG1VIDEO) { /* Needed to avoid using macroblocks in which some coeffs overflow. * This does not happen with normal video, it just happens here as * the motion of the chroma plane does not match the luma plane. */ c->mb_decision = 2; } /* Some formats want stream headers to be separate. */ if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height) { AVFrame *picture; uint8_t *picture_buf; int size; picture = avcodec_alloc_frame(); if (!picture) return NULL; size = avpicture_get_size(pix_fmt, width, height); picture_buf = (uint8_t*)av_malloc(size); if (!picture_buf) { av_free(picture); return NULL; } avpicture_fill((AVPicture *)picture, picture_buf, pix_fmt, width, height); return picture; } static void open_video(AVFormatContext *oc, AVStream *st) { AVCodecContext *c; c = st->codec; c->codec = avcodec_find_encoder(c->codec_id); /* open the codec */ if (avcodec_open2(c, c->codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(201); } video_outbuf = NULL; if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) { /* Allocate output buffer. */ /* XXX: API change will be done. */ /* Buffers passed into lav* can be allocated any way you prefer, * as long as they're aligned enough for the architecture, and * they're freed appropriately (such as using av_free for buffers * allocated with av_malloc). */ video_outbuf_size = 200000; video_outbuf = (uint8_t*)av_malloc(video_outbuf_size); } /* Allocate the encoded raw picture. */ picture = alloc_picture(c->pix_fmt, c->width, c->height); if (!picture) { fprintf(stderr, "Could not allocate picture\n"); exit(1); } /* If the output format is not YUV420P, then a temporary YUV420P * picture is needed too. It is then converted to the required * output format. */ tmp_picture = NULL; if (c->pix_fmt != PIX_FMT_YUV420P) { tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height); if (!tmp_picture) { fprintf(stderr, "Could not allocate temporary picture\n"); exit(1); } } } /* Prepare a dummy image. */ static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height) { int x, y, i; i = frame_index; /* Y */ for (y = 0; y < height; y++) for (x = 0; x < width; x++) pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3; /* Cb and Cr */ for (y = 0; y < height / 2; y++) { for (x = 0; x < width / 2; x++) { pict->data[1][y * pict->linesize[1] + x] = 128 + y + i * 2; pict->data[2][y * pict->linesize[2] + x] = 64 + x + i * 5; } } } static void write_video_frame(AVFormatContext *oc, AVStream *st) { int out_size, ret; AVCodecContext *c; static struct SwsContext *img_convert_ctx; c = st->codec; if (frame_count >= STREAM_NB_FRAMES) { /* No more frames to compress. The codec has a latency of a few * frames if using B-frames, so we get the last frames by * passing the same picture again. */ } else { if (c->pix_fmt != PIX_FMT_YUV420P) { /* as we only generate a YUV420P picture, we must convert it * to the codec pixel format if needed */ if (img_convert_ctx == NULL) { img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_YUV420P, c->width, c->height, c->pix_fmt, sws_flags, NULL, NULL, NULL); if (img_convert_ctx == NULL) { fprintf(stderr, "Cannot initialize the conversion context\n"); exit(1); } } fill_yuv_image(tmp_picture, frame_count, c->width, c->height); sws_scale(img_convert_ctx, tmp_picture->data, tmp_picture->linesize, 0, c->height, picture->data, picture->linesize); } else { fill_yuv_image(picture, frame_count, c->width, c->height); } } if (oc->oformat->flags & AVFMT_RAWPICTURE) { /* Raw video case - the API will change slightly in the near * future for that. */ AVPacket pkt; av_init_packet(&pkt); pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; pkt.data = (uint8_t *)picture; pkt.size = sizeof(AVPicture); ret = av_interleaved_write_frame(oc, &pkt); } else { /* encode the image */ out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture); /* If size is zero, it means the image was buffered. */ if (out_size > 0) { AVPacket pkt; av_init_packet(&pkt); if (c->coded_frame->pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base); if (c->coded_frame->key_frame) pkt.flags |= AV_PKT_FLAG_KEY; pkt.stream_index = st->index; pkt.data = video_outbuf; pkt.size = out_size; /* Write the compressed frame to the media file. */ ret = av_interleaved_write_frame(oc, &pkt); } else { ret = 0; } } if (ret != 0) { fprintf(stderr, "Error while writing video frame\n"); exit(1); } frame_count++; } static void close_video(AVFormatContext *oc, AVStream *st) { avcodec_close(st->codec); av_free(picture->data[0]); av_free(picture); if (tmp_picture) { av_free(tmp_picture->data[0]); av_free(tmp_picture); } av_free(video_outbuf); } /**************************************************************/ /* media file output */ int main(int argc, char **argv) { AVOutputFormat *fmt; AVFormatContext *oc; AVStream *audio_st, *video_st; double audio_pts, video_pts; int i; /* Initialize libavcodec, and register all codecs and formats. */ av_register_all(); if (0==1) {//Deactivated, hardcoded printf("usage: %s output_file\n" "API example program to output a media file with libavformat.\n" "The output format is automatically guessed according to the file extension.\n" "Raw images can also be output by using '%%d' in the filename\n" "\n", argv[0]); return 1; } /* allocate the output media context */ avformat_alloc_output_context2(&oc, NULL, NULL, filename); if (!oc) { printf("Could not deduce output format from file extension: using MPEG.\n"); avformat_alloc_output_context2(&oc, NULL, "mpeg", filename); } if (!oc) { return 101; } fmt = oc->oformat; /* Add the audio and video streams using the default format codecs * and initialize the codecs. */ video_st = NULL; audio_st = NULL; if (fmt->video_codec != CODEC_ID_NONE) { video_st = add_video_stream(oc, (CodecID)fmt->video_codec); } if (fmt->audio_codec != CODEC_ID_NONE) { audio_st = add_audio_stream(oc, fmt->audio_codec); } /* Now that all the parameters are set, we can open the audio and * video codecs and allocate the necessary encode buffers. */ if (video_st) open_video(oc, video_st); if (audio_st) open_audio(oc, audio_st); av_dump_format(oc, 0, filename, 1); /* open the output file, if needed */ if (!(fmt->flags & AVFMT_NOFILE)) { if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); return 100; } } /* Write the stream header, if any. */ avformat_write_header(oc, NULL); picture->pts = 0; for (;;) { /* Compute current audio and video time. */ if (audio_st) audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; else audio_pts = 0.0; if (video_st) video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den; else video_pts = 0.0; if ((!audio_st || audio_pts >= STREAM_DURATION) && (!video_st || video_pts >= STREAM_DURATION)) break; /* write interleaved audio and video frames */ if (!video_st || (video_st && audio_st && audio_pts < video_pts)) { write_audio_frame(oc, audio_st); } else { write_video_frame(oc, video_st); picture->pts++; } } //flush video encoder int stillgotframes = 1; while(stillgotframes){ AVPacket pkt; av_init_packet(&pkt); int got_packet=0; int ret = -1; pkt.size = video_outbuf_size; //1000000 pkt.data = video_outbuf; // constant location in memory ret = avcodec_encode_video2(video_st->codec, &pkt, NULL, &got_packet); if (got_packet){ av_interleaved_write_frame(oc, &pkt); } stillgotframes = got_packet; } /* Write the trailer, if any. The trailer must be written before you * close the CodecContexts open when you wrote the header; otherwise * av_write_trailer() may try to use memory that was freed on * av_codec_close(). */ av_write_trailer(oc); /* Close each codec. */ if (video_st) close_video(oc, video_st); if (audio_st) close_audio(oc, audio_st); /* Free the streams. */ for (i = 0; i < oc->nb_streams; i++) { av_freep(&oc->streams[i]->codec); av_freep(&oc->streams[i]); } if (!(fmt->flags & AVFMT_NOFILE)) /* Close the output file. */ avio_close(oc->pb); /* free the stream */ av_free(oc); return 0; } Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Friday, February 08, 2013 8:26 PM An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 Tried your flushing method too but did not make a difference. The only way I can get this to work correctly is if I never flush frames until I know I'm at the end of the video stream. The problem is in my case I don't know when the video stream ends or changes into a different one (different width/height). I still don't get why MPEG2 encoder is fine with flushing after every encode but H264 is not. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 10:42 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 Hm, i really dont believe your problem is the flushing part itself. I wonder if the pkt you are sending to the encoder is initialized - at least i cannot see how. There is a huge number of issues in avcodec_encode_video2 that occur when you send it a pkt that it did not expect. Here is how I flush at the end of transcoding: int stillgotframes = 1; while(stillgotframes){ AVPacket pkt; av_init_packet(&pkt); int got_packet=0; int ret = -1; pkt.size = video_outbuf_size; //1000000 pkt.data = video_outbuf; // constant location in memory ret = avcodec_encode_video2(video_st->codec, &pkt, NULL, &got_packet); av_interleaved_write_frame(oc, &pkt); stillgotframes = got_packet; } Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Friday, February 08, 2013 7:22 PM An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 All those presets I tried but didn't help. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Friday, February 08, 2013 8:39 AM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 But the decoding_encoding example works for me without any changes. The problem is if you just want to encode two frames and flush them all out. With 25 there doesn't seem to be any issues. From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Harald Jordan Sent: Friday, February 08, 2013 12:53 AM To: 'This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.' Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 If you did not make any changes to the open_video and add_video functions of the decoding_encoding example, it cannot work. For H264 you need to manually define a set a of H264 private settings before opening the codec. http://stackoverflow.com/questions/3553003/encoding-h-264-with-libavcodec-x2 64 Harry Von: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] Im Auftrag von Ashwin Chandra - SISA Gesendet: Freitag, 08. Februar 2013 00:29 An: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Betreff: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 To be clearer, I modified the decoding_encoding.c example in ffmpeg to cause the problem. I basically changed the video_encode_example() to encode 1 second worth of video and then flush the delayed frame. The code below is exactly the same except 25 frames was replaced with 1 frame. Now if I take this code block and duplicate it again, so that it basically runs twice, the second avcodec_encode_video2() will hang. /* encode 1 second of video */ for(i=0;i<1;i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; fflush(stdout); /* prepare a dummy image */ /* Y */ for(y=0;yheight;y++) { for(x=0;xwidth;x++) { frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; } } /* Cb and Cr */ for(y=0;yheight/2;y++) { for(x=0;xwidth/2;x++) { frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; } } frame->pts = i; /* encode the image */ ret = avcodec_encode_video2(c, &pkt, frame, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } /* get the delayed frames */ for (got_output = 1; got_output; i++) { fflush(stdout); ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); if (ret < 0) { fprintf(stderr, "Error encoding frame\n"); exit(1); } if (got_output) { printf("Write frame %3d (size=%5d)\n", i, pkt.size); fwrite(pkt.data, 1, pkt.size, f); av_free_packet(&pkt); } } From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Ashwin Chandra - SISA Sent: Thursday, February 07, 2013 3:08 PM To: libav-user at ffmpeg.org Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 I have some code that takes a running stream of uncompressed video data and encodes it using AV_CODEC_ID_H264. The sequence I follow is 1. Call avcodec_encode_video2 on the AVFrame which contains my uncompressed frame. 2. Call avcodec_encode_video2 again passing NULL in the AVFrame parameter. 3. Repeat 2. Until a frame arrives from the encoder. This seems to work fine if the codec is MPEG2, but with H264, it hangs inside avcodec_encode_video2 at step 2) on the second frame. I don't have debug symbols and can't figure out why. Does there need to be a minimum set of uncompressed data in the encoder before trying to flush out an encoded frame for H264? If so, how do I know when it is safe to flush a frame? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: muxing.c_altered Type: application/octet-stream Size: 17756 bytes Desc: not available URL: From ashwin.c at sisa.samsung.com Sat Feb 9 21:24:46 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Sat, 9 Feb 2013 20:24:46 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> , Message-ID: <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Can you tell me the exact options for the preset you mentioned. I want I and P frames and not B frames to reduce latency but gain better h264 compression rather than mpeg 2. Sent from my iPhone On Feb 9, 2013, at 11:38 AM, "Alex Cohn" wrote: > On Fri, Feb 8, 2013 at 8:21 PM, Ashwin Chandra - SISA > wrote: >> All those presets I tried but didn?t help. > > You should try the zerolatency preset, and not allow any b-frames if > you want to flush so often. You can try to set max gop size to 1. Even > in this case, h264 is not optimized for this kind of flushing. What > were the motivations of choosing this codec? JPEG should suit you > best. > > BR, > Alex > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From alexcohn at netvision.net.il Sat Feb 9 21:45:45 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sat, 9 Feb 2013 22:45:45 +0200 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Message-ID: On Sat, Feb 9, 2013 at 10:24 PM, Ashwin Chandra - SISA wrote: > Can you tell me the exact options for the preset you mentioned. I want I and P frames and not B frames to reduce latency but gain better h264 compression rather than mpeg 2. > > On Feb 9, 2013, at 11:38 AM, "Alex Cohn" wrote: > >> On Fri, Feb 8, 2013 at 8:21 PM, Ashwin Chandra - SISA >> wrote: >>> All those presets I tried but didn?t help. >> >> You should try the zerolatency preset, and not allow any b-frames if >> you want to flush so often. You can try to set max gop size to 1. Even >> in this case, h264 is not optimized for this kind of flushing. What >> were the motivations of choosing this codec? JPEG should suit you >> best. >> >> BR, >> Alex You could find the answer on this list: http://libav-users.943685.n4.nabble.com/Libav-user-FFmpeg-x264-settings-for-zero-delay-encoding-tp4655209p4655212.html. I don't think you can get a significant improvement without using B-frames and requiring immediate flush, but it's up to you to test it with your input and choose the optimal parameters. Sincerely, Alex From rjvbertin at gmail.com Sat Feb 9 23:26:57 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Sat, 9 Feb 2013 23:26:57 +0100 Subject: [Libav-user] yuv420p mjp2 track misidentified as gray8 ? In-Reply-To: References: Message-ID: <0E87BC76-1806-4252-B1D7-2A97B45C6FFF@gmail.com> On Feb 09, 2013, at 17:12, Paul B Mahol wrote: >> reason. But if that is not the case, is there a way to interpret (or >> complete) the frame data returned by avcodec_decode_video2() to reconstruct >> a colour image? > > Negative I already thought so, and delving a bit into the code confirm it. Anyway, I managed to backport libopenjpegdec.c from the current FFmpeg codebase. Wasn't very hard, and it seems I even gained a bit in performance while doing so. R. From ashwin.c at sisa.samsung.com Sat Feb 9 23:38:36 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Sat, 9 Feb 2013 22:38:36 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Message-ID: 1. Just as a sanity check, to disable b-frames, I just set the max_bframes parameter to 0? 2. If GOP size is 1, wouldn't that always be I frames? No predictional ones?] -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Alex Cohn Sent: Saturday, February 09, 2013 12:46 PM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 On Sat, Feb 9, 2013 at 10:24 PM, Ashwin Chandra - SISA wrote: > Can you tell me the exact options for the preset you mentioned. I want I and P frames and not B frames to reduce latency but gain better h264 compression rather than mpeg 2. > > On Feb 9, 2013, at 11:38 AM, "Alex Cohn" wrote: > >> On Fri, Feb 8, 2013 at 8:21 PM, Ashwin Chandra - SISA >> wrote: >>> All those presets I tried but didn't help. >> >> You should try the zerolatency preset, and not allow any b-frames if >> you want to flush so often. You can try to set max gop size to 1. >> Even in this case, h264 is not optimized for this kind of flushing. >> What were the motivations of choosing this codec? JPEG should suit >> you best. >> >> BR, >> Alex You could find the answer on this list: http://libav-users.943685.n4.nabble.com/Libav-user-FFmpeg-x264-settings-for-zero-delay-encoding-tp4655209p4655212.html. I don't think you can get a significant improvement without using B-frames and requiring immediate flush, but it's up to you to test it with your input and choose the optimal parameters. Sincerely, Alex _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From alexcohn at netvision.net.il Sun Feb 10 08:23:36 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sun, 10 Feb 2013 09:23:36 +0200 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Message-ID: On Sun, Feb 10, 2013 at 12:38 AM, Ashwin Chandra - SISA wrote: > 1. Just as a sanity check, to disable b-frames, I just set the max_bframes parameter to 0? > 2. If GOP size is 1, wouldn't that always be I frames? No predictional ones?] You probably missed the link yesterday: http://libav-users.943685.n4.nabble.com/Libav-user-FFmpeg-x264-settings-for-zero-delay-encoding-tp4655209p4655212.html. There is "preset" and "tune" options in ffmpeg, you can set them that way: #include "opt.h" av_opt_set(codecContex->priv_data, "preset", "ultrafast", 0); av_opt_set(codecContex->priv_data, "tune", "zerolatency", 0); where codecContex is AVCodecContext. For other x264 options that isn't presented in ffmpeg you could use "x264opts" option: av_opt_set(codecContex->priv_data, "x264opts", "no-mbtree:sliced-threads:sync-lookahead=0", 0); Regarding P-frames, I thought you wanted to remove them, too. Sincerely, Alex From ashwin.c at sisa.samsung.com Sun Feb 10 08:32:57 2013 From: ashwin.c at sisa.samsung.com (Ashwin Chandra - SISA) Date: Sun, 10 Feb 2013 07:32:57 +0000 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Message-ID: No I got the link. I guess that preset will most likely remove B frames as they have latency. For the P-frames, I do want them to get better compression, just not the B frames. Does the zerolatency preset remove all P frames? -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Alex Cohn Sent: Saturday, February 09, 2013 11:24 PM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 On Sun, Feb 10, 2013 at 12:38 AM, Ashwin Chandra - SISA wrote: > 1. Just as a sanity check, to disable b-frames, I just set the max_bframes parameter to 0? > 2. If GOP size is 1, wouldn't that always be I frames? No predictional > ones?] You probably missed the link yesterday: http://libav-users.943685.n4.nabble.com/Libav-user-FFmpeg-x264-settings-for-zero-delay-encoding-tp4655209p4655212.html. There is "preset" and "tune" options in ffmpeg, you can set them that way: #include "opt.h" av_opt_set(codecContex->priv_data, "preset", "ultrafast", 0); av_opt_set(codecContex->priv_data, "tune", "zerolatency", 0); where codecContex is AVCodecContext. For other x264 options that isn't presented in ffmpeg you could use "x264opts" option: av_opt_set(codecContex->priv_data, "x264opts", "no-mbtree:sliced-threads:sync-lookahead=0", 0); Regarding P-frames, I thought you wanted to remove them, too. Sincerely, Alex _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From alexcohn at netvision.net.il Sun Feb 10 11:55:38 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sun, 10 Feb 2013 12:55:38 +0200 Subject: [Libav-user] Problem with using libavcodec with AV_CODEC_ID_H264 In-Reply-To: References: <001601ce05d9$c464b720$4d2e2560$@redstream.at> <5C8CE398-3381-4ACA-B6B5-FEEE148D9A4C@sisa.samsung.com> Message-ID: On Sun, Feb 10, 2013 at 9:32 AM, Ashwin Chandra - SISA wrote: > No I got the link. I guess that preset will most likely remove B frames as they have latency. > > For the P-frames, I do want them to get better compression, just not the B frames. Does the zerolatency preset remove all P frames? No, zerolatency does not remove P-frames. Alex From peper03 at yahoo.com Mon Feb 11 12:18:51 2013 From: peper03 at yahoo.com (peper03 at yahoo.com) Date: Mon, 11 Feb 2013 03:18:51 -0800 (PST) Subject: [Libav-user] Passing DVD NAV packets to demuxer Message-ID: <1360581531.11991.YahooMailClassic@web125603.mail.ne1.yahoo.com> Hi, Is there a 'correct' way to pass DVD NAV packets back to a demuxer? At the moment, we're calling 'av_read_frame', which eventually lands in a function which interfaces with libdvdnav to retrieve the DVD packets. The DVD NAV packets contain private streams (start code 0x1bf), which are explicitly filtered out by mpegps_read_pes_header. So is there a way to get these packets back to the demuxer keeping them in-sync with the 'normal' packets? Apologies if there is an obvious solution to this. I'm very new to this code. I've hunted round but not found an answer. Richard. From jerome.salayet at hymatom.fr Mon Feb 11 09:54:37 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Mon, 11 Feb 2013 09:54:37 +0100 Subject: [Libav-user] FFMPEG decoding H264 and Multithreading Message-ID: <79C91ED810DD8A49B375C899D0034D270993AF@mail.hymatom.fr> Hello, In fact, in can't do test with Multithreading enable because I still have the message ? The maximum value for lowres supported by the decoder is 0 ?, and I don't understand why (even if I set thread_count to 1). If someone could tell me if there's a mistake in my code, thanks a lot... Reagrds, Part of my class code (one class used by decompression): Define the lockmgr callback function: static int ff_lockmgr(void **mutex, enum AVLockOp op) // Callback { if (NULL == mutex) return -1; CRITICAL_SECTION **cSec = (CRITICAL_SECTION **)mutex; switch (op) { case AV_LOCK_CREATE: { *cSec = NULL; *cSec = new CRITICAL_SECTION(); if (*cSec == NULL) return 1; InitializeCriticalSection(*cSec); return 0; } case AV_LOCK_OBTAIN: { if (*cSec == NULL) return 1; EnterCriticalSection(*cSec); return 0; } case AV_LOCK_RELEASE: { if (*cSec == NULL) return 1; LeaveCriticalSection(*cSec); return 0; } case AV_LOCK_DESTROY: { if (*cSec == NULL) return 1; DeleteCriticalSection(*cSec); delete *cSec; *cSec = NULL; return 0; } } return 0; } At the class constructor : Just call once using a global check value : av_register_all(); av_lockmgr_register(ff_lockmgr); decoding part (call each once per frame): if (m_lpCodecCtx ==NULL) { m_lpCodecCtx = avcodec_alloc_context3(NULL); avcodec_get_context_defaults(m_lpCodecCtx); } // Init CodecContext if (m_lpCodecCtx->width == 0) { m_lpCodecCtx->pix_fmt = AV_PIX_FMT_YUV420P; m_lpCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO; m_lpCodecCtx->codec_id = CODEC_ID_H264; m_lpCodecCtx->coded_width = iImageWidth; // values I already got from my camera stream m_lpCodecCtx->coded_height = iImageHeight; // values I already got from my camera stream m_lpCodecCtx->width = iImageWidth; m_lpCodecCtx->height = iImageHeight; if (m_lpCodecCtx->codec_id == AV_CODEC_ID_H264) { m_lpCodecCtx->thread_count = 1; m_lpCodecCtx->thread_type = FF_THREAD_SLICE|FF_THREAD_FRAME; } if (m_lpCodec==NULL) { m_lpCodec = avcodec_find_decoder(m_lpCodecCtx->codec_id); if(m_lpCodec->capabilities&CODEC_CAP_TRUNCATED) m_lpCodecCtx->flags|= CODEC_FLAG_TRUNCATED; avcodec_open2(m_lpCodecCtx, m_lpCodec, NULL); m_lpFrame = lpfnavcodec_alloc_frame(); m_lpFrame->width = m_lpCodecCtx->width; m_lpFrame->height = m_lpCodecCtx->height; } // Prepare the packet to decode av_init_packet(&m_lpPacket); // Set the INPUT BUFFER PADDING if (m_lpFFMPEGBuffer == NULL) { m_lpFFMPEGBuffer = new BYTE[MAX_MPEG4VIDEO_FRAMESIZE+FF_INPUT_BUFFER_PADDING_SIZE]; } if (m_lpFFMPEGBuffer !=NULL) { ZeroMemory( m_lpFFMPEGBuffer, MAX_MPEG4VIDEO_FRAMESIZE+FF_INPUT_BUFFER_PADDING_SIZE); CopyMemory( m_lpFFMPEGBuffer, lpImageData, dwImageSize); // Set the buffer to packet data m_lpPacket.data = m_lpFFMPEGBuffer; // Set the size to packet size m_lpPacket.size = dwImageSize; } // Decode the frame do { iRes = avcodec_decode_video2( m_lpCodecCtx, m_lpFrame, &iFrameFinished, &m_lpPacket); if (iRes<0) { break; } if (iRes>0) { m_lpPacket.data+=iRes; m_lpPacket.size-=iRes; } } while (m_lpPacket.size>0); if (iFrameFinished) ... I display my decoded image using swscale ... // Free Packet av_free_packet(&m_lpPacket); When I finish my decompression work : // Close the codec context avcodec_close(m_lpCodecCtx); av_free(m_lpCodecCtx); avcodec_free_frame(&m_lpFrame); if (m_lpFFMPEGBuffer != NULL) { delete [] m_lpFFMPEGBuffer; } m_lpFrame = NULL; m_lpCodec = NULL; m_lpCodecCtx = NULL; m_lpFFMPEGBuffer = NULL; J?r?me SALAYET Ing?nieur Informatique T?l : 04 67 87 61 12 Fax : 04 67 70 85 44 Site web : www.hymatom.fr Email : jerome.salayet at hymatom.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 7598 bytes Desc: image003.png URL: From videomonkey at live.com Mon Feb 11 22:48:20 2013 From: videomonkey at live.com (Video Monkey) Date: Mon, 11 Feb 2013 15:48:20 -0600 Subject: [Libav-user] Complying with L-GPL license Message-ID: I realize I'm seeing legal advice on a technical forum, however I'm hoping there is an experienced hand willing to guide me. I'm reading the "License Compliance Checklist" at http://ffmpeg.org/legal.html and would appreciate clarification on point number 3 "Distribute the source code of FFmpeg, no matter if you modified it or not." Is the preferred method of distribution 1) instructions to the git repository, or 2) either a tarball or zip file? Thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: From philip at turmel.org Mon Feb 11 23:03:44 2013 From: philip at turmel.org (Phil Turmel) Date: Mon, 11 Feb 2013 17:03:44 -0500 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: References: Message-ID: <51196AC0.9090800@turmel.org> On 02/11/2013 04:48 PM, Video Monkey wrote: > I realize I'm seeing legal advice on a technical forum, however I'm > hoping there is an experienced hand willing to guide me. I'm reading > the "License Compliance Checklist" at http://ffmpeg.org/legal.html > and would appreciate clarification on point number 3 "Distribute the > source code of FFmpeg, no matter if you modified it or not." Is the > preferred method of distribution 1) instructions to the git > repository, or 2) either a tarball or zip file? When you distribute, you are responsible for ensuring your customers get the source *you* used. It's almost impossible to ensure that somebody else's git repo carries what *you* are responsible for, and you would be hijacking their bandwidth and server space for *your* project. That is often tolerated if your project is also completely open source, but is certainly frowned upon if you are a commercial operation. If you zip up the source and include it in your CD or download every time you publish, you have fulfilled that requirement without stepping on any toes. > Thank you! HTH, IANAL, etc., Phil From kalileo at universalx.net Tue Feb 12 12:07:44 2013 From: kalileo at universalx.net (Kalileo) Date: Tue, 12 Feb 2013 18:07:44 +0700 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: <51196AC0.9090800@turmel.org> References: <51196AC0.9090800@turmel.org> Message-ID: On Feb 12, 2013, at 05:03 , Phil Turmel wrote: > On 02/11/2013 04:48 PM, Video Monkey wrote: >> I realize I'm seeing legal advice on a technical forum, however I'm >> hoping there is an experienced hand willing to guide me. I'm reading >> the "License Compliance Checklist" at http://ffmpeg.org/legal.html >> and would appreciate clarification on point number 3 "Distribute the >> source code of FFmpeg, no matter if you modified it or not." Is the >> preferred method of distribution 1) instructions to the git >> repository, or 2) either a tarball or zip file? > > When you distribute, you are responsible for ensuring your customers get > the source *you* used. It's almost impossible to ensure that somebody > else's git repo carries what *you* are responsible for, and you would be > hijacking their bandwidth and server space for *your* project. That is > often tolerated if your project is also completely open source, but is > certainly frowned upon if you are a commercial operation. > > If you zip up the source and include it in your CD or download every > time you publish, you have fulfilled that requirement without stepping > on any toes. And if you would use the precompiled .dll files from http://ffmpeg.zeranoe.com/builds/ , how could you practically do that? From cehoyos at ag.or.at Tue Feb 12 13:55:22 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 12 Feb 2013 12:55:22 +0000 (UTC) Subject: [Libav-user] Complying with L-GPL license References: <51196AC0.9090800@turmel.org> Message-ID: Kalileo writes: > > If you zip up the source and include it in your CD or download every > > time you publish, you have fulfilled that requirement without stepping > > on any toes. > > And if you would use the precompiled .dll files from > http://ffmpeg.zeranoe.com/builds/ , how could you > practically do that? >From a quick look, this page contains (all!) the used source code, or do I misunderstand / miss something? Carl Eugen From philip at turmel.org Tue Feb 12 14:11:01 2013 From: philip at turmel.org (Phil Turmel) Date: Tue, 12 Feb 2013 08:11:01 -0500 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: References: <51196AC0.9090800@turmel.org> Message-ID: <511A3F65.90202@turmel.org> On 02/12/2013 06:07 AM, Kalileo wrote: > > On Feb 12, 2013, at 05:03 , Phil Turmel wrote: [trim /] >> If you zip up the source and include it in your CD or download >> every time you publish, you have fulfilled that requirement without >> stepping on any toes. > > > And if you would use the precompiled .dll files from > http://ffmpeg.zeranoe.com/builds/ , how could you practically do > that? If you can't comply with the terms of the license, you can't redistribute. It's that simple. Zeranoe is complying with the license by offering the corresponding source code with his builds. If you want to redistribute his build, you'd better grab the source he used each time you download. If you are redistributing his builds without corresponding source, and not offering that source to your customers (paid or not), you are violating the license. You can only avoid offering it if you included it in the package with each copy of your app that you distribute. If still in doubt, consult a lawyer. I am not a lawyer. HTH, Phil From kalileo at universalx.net Tue Feb 12 14:39:32 2013 From: kalileo at universalx.net (Kalileo) Date: Tue, 12 Feb 2013 20:39:32 +0700 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: <511A3F65.90202@turmel.org> References: <51196AC0.9090800@turmel.org> <511A3F65.90202@turmel.org> Message-ID: On Feb 12, 2013, at 20:11 , Phil Turmel wrote: > On 02/12/2013 06:07 AM, Kalileo wrote: >> >> On Feb 12, 2013, at 05:03 , Phil Turmel wrote: > > [trim /] > >>> If you zip up the source and include it in your CD or download >>> every time you publish, you have fulfilled that requirement without >>> stepping on any toes. >> >> >> And if you would use the precompiled .dll files from >> http://ffmpeg.zeranoe.com/builds/ , how could you practically do >> that? > > If you can't comply with the terms of the license, you can't > redistribute. It's that simple. > > Zeranoe is complying with the license by offering the corresponding > source code with his builds. If you want to redistribute his build, > you'd better grab the source he used each time you download. > > If you are redistributing his builds without corresponding source, and > not offering that source to your customers (paid or not), you are > violating the license. You can only avoid offering it if you included > it in the package with each copy of your app that you distribute. Thanks Phil and Carl Eugen, that makes it clear, and I hope it also helps the starter of this thread with the original question. From a practical point of view, I understand that the sources (even if unmodified) should be either - added to the software package (which gets distributed, and contains the .dll files) or - there should be an offer included in the software package with a download link to the sources pointing to server(s) of the creator or distributor of that software package (and not the servers of ffmpeg or Zerranoe). I'm pretty sure this is missed often, because it seems to be all available on the ffmpeg servers or the Zeranoe server already. From jerome.salayet at hymatom.fr Tue Feb 12 14:48:24 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Tue, 12 Feb 2013 14:48:24 +0100 Subject: [Libav-user] Using h264 dxva2 hwaccel to decrease CPU usage Message-ID: <79C91ED810DD8A49B375C899D0034D270993B0@mail.hymatom.fr> Hello, I have integrated FFMPEG to decode H264 videos streams. It works. Now, I'm trying to use AVHWAccel to decode H264 videos streaming. I compile FFMPEG 1.1.1 with --enable-dxva2 --enable-decoder=h264_dxva2 --enable-hwaccel=h264_dxva2. When I initialise my CodecContext, I use the method below to find the AVHWAccel if(h264_dxva2_hwaccel == NULL) { AVHWAccel* hwaccel = NULL; while(hwaccel = av_hwaccel_next(hwaccel)) { if((hwaccel->pix_fmt == AV_PIX_FMT_DXVA2_VLD) && (hwaccel->id == CODEC_ID_H264)) { h264_dxva2_hwaccel = hwaccel; av_register_hwaccel(h264_dxva2_hwaccel); printf("dxva2_hwaccel = %s\r\n",h264_dxva2_hwaccel->name); } break; } } And so affect it to my CodecContext if (h264_dxva2_hwaccel != NULL) { m_lpCodecCtx->hwaccel = h264_dxva2_hwaccel; } But it seems I have to set the m_lpCodecCtx->hwaccel_context and I don't find any documentations on this part. And also, after this, I just have to have the same code than before (using avcodec_decode_video2 and other ffmpeg functions), or the hardware decoding is really different ? If someone can explain me (or better have a simple sample to do this), Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From philip at turmel.org Tue Feb 12 15:15:38 2013 From: philip at turmel.org (Phil Turmel) Date: Tue, 12 Feb 2013 09:15:38 -0500 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: References: <51196AC0.9090800@turmel.org> <511A3F65.90202@turmel.org> Message-ID: <511A4E8A.5070607@turmel.org> On 02/12/2013 08:39 AM, Kalileo wrote: > > On Feb 12, 2013, at 20:11 , Phil Turmel wrote: > >> On 02/12/2013 06:07 AM, Kalileo wrote: >>> >>> On Feb 12, 2013, at 05:03 , Phil Turmel wrote: >> >> [trim /] >> >>>> If you zip up the source and include it in your CD or download >>>> every time you publish, you have fulfilled that requirement without >>>> stepping on any toes. >>> >>> >>> And if you would use the precompiled .dll files from >>> http://ffmpeg.zeranoe.com/builds/ , how could you practically do >>> that? >> >> If you can't comply with the terms of the license, you can't >> redistribute. It's that simple. >> >> Zeranoe is complying with the license by offering the corresponding >> source code with his builds. If you want to redistribute his build, >> you'd better grab the source he used each time you download. >> >> If you are redistributing his builds without corresponding source, and >> not offering that source to your customers (paid or not), you are >> violating the license. You can only avoid offering it if you included >> it in the package with each copy of your app that you distribute. > > Thanks Phil and Carl Eugen, > > that makes it clear, and I hope it also helps the starter of this thread with the original question. > > From a practical point of view, I understand that the sources (even if unmodified) should be either > - added to the software package (which gets distributed, and contains the .dll files) or > - there should be an offer included in the software package with a download link to the sources pointing to server(s) of the creator or distributor of that software package (and not the servers of ffmpeg or Zerranoe). > > I'm pretty sure this is missed often, because it seems to be all available on the ffmpeg servers or the Zeranoe server already. The latter approach is in the checklist as items #7 and #8. http://ffmpeg.org/legal.html Phil From cehoyos at ag.or.at Tue Feb 12 16:07:45 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 12 Feb 2013 15:07:45 +0000 (UTC) Subject: [Libav-user] Complying with L-GPL license References: <51196AC0.9090800@turmel.org> <511A3F65.90202@turmel.org> Message-ID: Kalileo writes: > From a practical point of view, I understand that the > sources (even if unmodified) should be either - added > to the software package (which gets distributed, and > contains the .dll files) or Iirc, the license uses the word "accompany", I believe no court has so far decided what this is means in this context, but making the source a part of the distribution certainly fulfills the requirement. If you read http://ffmpeg.org/legal.html you can see that the FFmpeg developers believe that providing the source code on the same server as the binary distribution and pointing to the source code in the same way as to the binary distribution also fulfills the requirement. > - there should be an offer included in the software > package with a download link to the sources pointing to > server(s) of the creator or distributor of that > software package (and not the servers of ffmpeg or Zerranoe). Your sentence is not entirely clear: If you talk about an "offer" for the source, it usually means that you offer in a legally binding way that you "ship" the source code to your customer on request. This certainly cannot be fulfilled with sources on a webserver which is outside of your control, but it imo does not make much sense today anyway because it is highly "unpractical". (Note that this "offer" that made a lot of sense at the time the license was written when disk space was expensive.) If you talk about links that point to the sources next to links that point to the binary distribution (to "accompany" your distribution with the sources), then it is of course your responsibility that the links actually work: An easy way to make sure they do is to host the source package on the same server as the binary distribution. A definite way - imo - to make clear that the distributor is not interested in fulfilling the license by offering source code is to link to an external server that is supposed to contain the source code (like for example "ffmpeg.org" - this for example happens very often). Carl Eugen From kalileo at universalx.net Tue Feb 12 17:41:22 2013 From: kalileo at universalx.net (Kalileo) Date: Tue, 12 Feb 2013 23:41:22 +0700 Subject: [Libav-user] Complying with L-GPL license In-Reply-To: References: <51196AC0.9090800@turmel.org> <511A3F65.90202@turmel.org> Message-ID: Thanks to Carl-Eugen and Phil for explaining this in words easy to understand for a non-lawyer like me :) - the first time I feel i know what to do to comply with the license. From cehoyos at ag.or.at Tue Feb 12 17:53:33 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 12 Feb 2013 16:53:33 +0000 (UTC) Subject: [Libav-user] Complying with L-GPL license References: <51196AC0.9090800@turmel.org> <511A3F65.90202@turmel.org> Message-ID: Kalileo writes: > Thanks to Carl-Eugen and Phil for explaining this in words > easy to understand for a non-lawyer like me :) - > the first time I feel i know what to do to comply with the > license. If you believe that anything on http://ffmpeg.org/legal.html (the license compliance checklist) can be improved, please let us know! Thank you, Carl Eugen From jarnor at atc.ugr.es Tue Feb 12 14:38:50 2013 From: jarnor at atc.ugr.es (jarno ralli) Date: Tue, 12 Feb 2013 15:38:50 +0200 Subject: [Libav-user] ffmpeg+libx264+broken ffmpeg default settings detected Message-ID: <511A45EA.6000007@atc.ugr.es> Dear all, This is the first time I post here, so please do forgive me if I'm posting to wrong place etc. In any case, I have the infamous "broken ffmpeg default settings detected" when using OpenCV+ffmpeg+libx264 in Kubuntu 12.10. I have the latest git:ted versions of everything (12 Feb 2013) and I have compiled ffmpeg, x264 etc. as per http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide. When trying to write video using H.264 in OpenCV it uses ffmpeg library for this purpose. However, when opening the stream I get the following: [libx264 @ 0x20f7d00] broken ffmpeg default settings detected [libx264 @ 0x20f7d00] use an encoding preset (e.g. -vpre medium) [libx264 @ 0x20f7d00] preset usage: -vpre -vpre [libx264 @ 0x20f7d00] speed presets are listed in x264 --help [libx264 @ 0x20f7d00] profile is optional; x264 defaults to high Could not open codec 'libx264': Unspecified error Which is caused by (x264/encoder/encoder.c): /* Detect default ffmpeg settings and terminate with an error. */ if( b_open ) { int score = 0; score += h->param.analyse.i_me_range == 0; score += h->param.rc.i_qp_step == 3; score += h->param.i_keyint_max == 12; score += h->param.rc.i_qp_min == 2; score += h->param.rc.i_qp_max == 31; score += h->param.rc.f_qcompress == 0.5; score += fabs(h->param.rc.f_ip_factor - 1.25) < 0.01; score += fabs(h->param.rc.f_pb_factor - 1.25) < 0.01; score += h->param.analyse.inter == 0 && h->param.analyse.i_subpel_refine == 8; if( score >= 5 ) { x264_log( h, X264_LOG_ERROR, "broken ffmpeg default settings detected\n" ); x264_log( h, X264_LOG_ERROR, "use an encoding preset (e.g. -vpre medium)\n" ); x264_log( h, X264_LOG_ERROR, "preset usage: -vpre -vpre \n" ); x264_log( h, X264_LOG_ERROR, "speed presets are listed in x264 --help\n" ); x264_log( h, X264_LOG_ERROR, "profile is optional; x264 defaults to high\n" ); return -1; } } Now, I have a question: where do these defaults came from...are these set in ffmpeg/libavcodecs/libx264.c: static const AVCodecDefault x264_defaults[] = { { "b", "0" }, { "bf", "-1" }, { "flags2", "0" }, { "g", "-1" }, { "qmin", "-1" }, { "qmax", "-1" }, { "qdiff", "-1" }, { "qblur", "-1" }, { "qcomp", "-1" }, // { "rc_lookahead", "-1" }, { "refs", "-1" }, { "sc_threshold", "-1" }, { "trellis", "-1" }, { "nr", "-1" }, { "me_range", "-1" }, { "me_method", "-1" }, { "subq", "-1" }, { "b_strategy", "-1" }, { "keyint_min", "-1" }, { "coder", "-1" }, { "cmp", "-1" }, { "threads", AV_STRINGIFY(X264_THREADS_AUTO) }, { "thread_type", "0" }, { "flags", "+cgop" }, { "rc_init_occupancy","-1" }, { NULL }, }; My ffmpeg gives the following information: ffmpeg version N-38355-ge2b703f Copyright (c) 2000-2013 the FFmpeg developers built on Feb 12 2013 14:31:31 with gcc 4.7 (Ubuntu/Linaro 4.7.2-2ubuntu1) configuration: --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3 --enable-shared libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.102 / 54. 91.102 libavformat 54. 62.100 / 54. 62.100 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 37.101 / 3. 37.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder I would be really grateful if someone could give me a hand here!!! All the best, Jarno From xuanyu.huang at gmail.com Wed Feb 13 00:47:54 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Wed, 13 Feb 2013 10:47:54 +1100 Subject: [Libav-user] How is bitrate determined when call ffmpeg executable without bitrate parameter Message-ID: Hi all, If run ffmpeg executable directly to convert a video file, for example ffmpeg -i file_in.mp4 file_out.mpg How will the output file bitrate be calculated? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 13 01:32:14 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 13 Feb 2013 00:32:14 +0000 (UTC) Subject: [Libav-user] How is bitrate determined when call ffmpeg executable without bitrate parameter References: Message-ID: ??? writes: > If run ffmpeg executable directly to convert a video file, > for example ffmpeg -i file_in.mp4 file_out.mpg (Complete, uncut console output missing.) > How will the output file bitrate be calculated? It is set to 200k for video. Carl Eugen From lars.hammarstrand at gmail.com Wed Feb 13 16:36:38 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 16:36:38 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? Message-ID: Hello, can someone please explain the reason (and how to cope with) that * ff_log2_tab* is defined multiple times with *#include "libavutil/log2_tab.c*" in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? This results in "duplicate symbols" while linking as listed below. To get ride of the problem we need to delete the duplicated entries by hand with "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth solution. Will this behavior change in the future or do weed need to automate a duplicate removal process while building the ffmpeg libraries for XBMC? -- Thanks in advance! Regards, Lars. "duplicate symbol _ff_log2_tab in: ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) ../xbmc-12/lib/ffmpeg/libavformat/libavformat.a(log2_tab.o) duplicate symbol _ff_log2_tab in: ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) ../xbmc-12/lib/ffmpeg/libavutil/libavutil.a(log2_tab.o) duplicate symbol _ff_log2_tab in: ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) ../xbmc-12/lib/ffmpeg/libswresample/libswresample.a(log2_tab.o) ld: 3 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)" -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Wed Feb 13 16:47:08 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 13 Feb 2013 17:47:08 +0200 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: Message-ID: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> > Hello, can someone please explain the reason (and how to cope with) that ff_log2_tab is defined multiple times with #include "libavutil/log2_tab.c" in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? > > This results in "duplicate symbols" while linking as listed below. To get ride of the problem we need to delete the duplicated entries by hand with "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth solution. Will this behavior change in the future or do weed need to automate a duplicate removal process while building the ffmpeg libraries for XBMC? > -- > > Thanks in advance! > Regards, Lars. > > > "duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libavformat/libavformat.a(log2_tab.o) > > duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libavutil/libavutil.a(log2_tab.o) > > duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libswresample/libswresample.a(log2_tab.o) > > ld: 3 duplicate symbols for architecture i386 > clang: error: linker command failed with exit code 1 (use -v to see invocation) The solution described in this article - http://www.tangentsoftworks.com/blog/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/. See comments. ar -dv libavcodec.a log2_tab.o -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Feb 13 17:17:23 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 17:17:23 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> References: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> Message-ID: Hello Alexey! Thank you very much for the pointer which of course is permanently book marked for some time ago ;-). I'm quite aware of the workaround but I'm rather looking for the root cause of this change and what long term solution we should use since the ffmpeg libraries for XBMC needs to work on several different platforms (win, osx, ios, linux, android, etc) . So the question unfortunately remains, will this behavior change in the future or do weed need to automate a duplicate removal process for all platforms while building the ffmpeg libraries for XBMC? Any ideas why this was changed or if this problem will remain? -- Regards, Lars. 2013/2/13 Alexey Belkevich > Hello, can someone please explain the reason (and how to cope with) that * > ff_log2_tab* is defined multiple times with *#include > "libavutil/log2_tab.c*" in the ffmpeg v1.1 libraries like libavcodec > 54.91.102 and companions ?? > > This results in "duplicate symbols" while linking as listed below. To get > ride of the problem we need to delete the duplicated entries by hand with > "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth > solution. Will this behavior change in the future or do weed need to > automate a duplicate removal process while building the ffmpeg libraries > for XBMC? > -- > > Thanks in advance! > Regards, Lars. > > > "duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libavformat/libavformat.a(log2_tab.o) > > duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libavutil/libavutil.a(log2_tab.o) > > duplicate symbol _ff_log2_tab in: > ../xbmc-12/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) > ../xbmc-12/lib/ffmpeg/libswresample/libswresample.a(log2_tab.o) > > ld: 3 duplicate symbols for architecture i386 > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > > The solution described in this article - > http://www.tangentsoftworks.com/blog/2012/11/12/how-to-prepare-your-mac-for-ios-development-with-ffmpeg-libraries/. > See comments. > > ar -dv libavcodec.a log2_tab.o > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Wed Feb 13 17:37:41 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Wed, 13 Feb 2013 18:37:41 +0200 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> Message-ID: <9F04296E4B83484EAE4317A06E5FDEF2@mlsdev.com> > Hello Alexey! > > Thank you very much for the pointer which of course is permanently book marked for some time ago ;-). I'm quite aware of the workaround but I'm rather looking for the root cause of this change and what long term solution we should use since the ffmpeg libraries for XBMC needs to work on several different platforms (win, osx, ios, linux, android, etc) . So the question unfortunately remains, will this behavior change in the future or do weed need to automate a duplicate removal process for all platforms while building the ffmpeg libraries for XBMC? > > Any ideas why this was changed or if this problem will remain? Hello Lars! I think that open source projects like ffmpeg don't give any guarantees at all =) So, I think it's better to use workaround for now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Feb 13 17:43:59 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 17:43:59 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <9F04296E4B83484EAE4317A06E5FDEF2@mlsdev.com> References: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> <9F04296E4B83484EAE4317A06E5FDEF2@mlsdev.com> Message-ID: Hi, that is of course very true ;-) But the intention of the question was more technical oriented. /Lars. 2013/2/13 Alexey Belkevich > Hello Alexey! > > Thank you very much for the pointer which of course is permanently book > marked for some time ago ;-). I'm quite aware of the workaround but I'm > rather looking for the root cause of this change and what long term > solution we should use since the ffmpeg libraries for XBMC needs to work on > several different platforms (win, osx, ios, linux, android, etc) . So > the question unfortunately remains, will this behavior change in the future > or do weed need to automate a duplicate removal process for all platforms > while building the ffmpeg libraries for XBMC? > > Any ideas why this was changed or if this problem will remain? > > Hello Lars! > > I think that open source projects like ffmpeg don't give any guarantees at > all =) > So, I think it's better to use workaround for now. > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 13 17:45:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 13 Feb 2013 16:45:05 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: Message-ID: Lars Hammarstrand writes: > Hello, can someone please explain?the reason (and?how to > cope with)?that?ff_log2_tab?is defined?multiple?times > with?#include "libavutil/log2_tab.c" in?the ffmpeg v1.1 > libraries like libavcodec 54.91.102 and?companions??? > > > This results in "duplicate symbols"?while linking as > listed below. Since this does not happen when linking ffplay, ffmpeg etc. could you explain how we can reproduce this problem? Please do not top-post here, Carl Eugen From rjvbertin at gmail.com Wed Feb 13 18:07:13 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 13 Feb 2013 18:07:13 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> References: <3CA3E3AAE3694F088BD52D6F9E81B44E@mlsdev.com> Message-ID: On Feb 13, 2013, at 16:47, Alexey Belkevich wrote: >> Hello, can someone please explain the reason (and how to cope with) that ff_log2_tab is defined multiple times with #include "libavutil/log2_tab.c" in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? You have identified the reason; ff_log2_tab is defined in libavutil/log2_tab.c, which is included in files of the same name from libavcodec, libavformat and libswresample. This may not be a problem when using dynamic libraries, but with static libraries it can become one if the linker is forced to link in those different log2_tab.o modules. And this will be the case even if the dependency is "intra-library" (i.e., a module from lavc accessing ff_log2_tab and another module from lavf also accessing ff_log2_tab). Do you by any chance use this array in your own code? Do you confirm that you do not get the error when linking ffmpeg in the same build environment? Either way, add a line V=1 to the ffmpeg toplevel Makefile so you get to follow the full build process, with the detailed invocations. It could be that you'll find that the option to suppress or ignore duplicate symbols is specified at the relevant linking stages. Anyway, it seems like a workaround shouldn't be too hard. Is there any reason to have ff_log2_tab be exported by 4 libraries, if at all (and if so, is there a reason not to have an inter-library dependency on libavutil)? If not, a macro could be defined in lib{avcodec,avformat,swresample}/*config.h to do a bit of C++-style name mangling on ff_log2_tab, such that each library includes it from the same single source but using a slightly different name. Or simpler, since the number of files using the variable isn't large (and the table itself isn't either), just declare it static in a header file and include that in each file that accesses the variable. From lars.hammarstrand at gmail.com Wed Feb 13 18:14:15 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 18:14:15 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: Message-ID: Hello Carl! Since I'm using the google mail "in-line" reply I'm not sure if it will produce top-posts or not, please let me know if that's the case. Regarding the link problem, I'm not sure how you manage to link ffplay without this problem but i'll have a look. In general doing "#include ../common/source.c" with global variables is probably a bad idea if you want to avoid duplicate symbols in "public" libraries. I can't locate this construction in older ffmpeg libraries and I've haven't seen any complaints about it in the past. Any idea why this thing was introduced in the first time? /Regards, Lars. But in the meantime, here is the link statement: Ld /Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Products/Debug/XBMC normal i386 cd /Users/lars/src/xbmc-12.0 setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -L/Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Products/Debug -L/Users/lars/src/xbmc-12.0 -L/Users/lars/src/xbmc-12.0/lib/libRTV -L/Users/lars/src/xbmc-12.0/lib/libXDAAP -L/Users/lars/src/xbmc-12.0/lib/cmyth/libcmyth -L/Users/lars/src/xbmc-12.0/lib/cmyth/librefmem -L/Users/lars/src/xbmc-12.0/lib/libsquish -L/Users/lars/src/xbmc-12.0/lib/SlingboxLib -L/Users/lars/src/xbmc-12.0/xbmc/interfaces/json-rpc -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libavcodec -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libavutil -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libavformat -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libavfilter -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libavdevice -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libswresample -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libpostproc -L/Users/lars/src/xbmc-12.0/lib/ffmpeg/libswscale -L/Users/lars/src/xbmc-12.0/xbmc/interfaces/python -L/Users/lars/src/xbmc-12.0/xbmc/interfaces/legacy -F/Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Products/Debug -filelist /Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Intermediates/XBMC.build/Debug/XBMC.build/Objects-normal/i386/XBMC.LinkFileList -mmacosx-version-min=10.6 -headerpad_max_install_names -all_load -L/Users/Shared/xbmc-depends/macosx10.8_i386/lib -lssh -llzo2 -lpcre -lpcrecpp -lfribidi -lcdio -lfreetype -lfontconfig -lsqlite3 -lsamplerate -ltinyxml -lmicrohttpd -lyajl -ljpeg -lcrypto -lgcrypt -lavdevice -lavfilter -lavcodec -lavformat -lpostproc -lavutil -lswresample -lswscale -lGLEW -lSDL -lSDL_mixer -lsmbclient -lpython2.6 -ltag -L/Users/Shared/xbmc-depends/macosx10.8_i386/lib/mysql -lmysqlclient -fobjc-link-runtime -lrtv -lxdaap -lsquish /Users/lars/src/xbmc-12.0/lib/SlingboxLib/SlingboxLib.a -lz -lm -lbz2 -lxml2 -liconv -lncurses -framework ApplicationServices -framework AudioUnit -framework AudioToolbox -framework Cocoa -framework CoreAudio -framework CoreVideo -framework CoreServices -framework DiskArbitration -framework IOKit -framework IOSurface -framework OpenGL -framework QuartzCore -framework CoreFoundation -framework SystemConfiguration -o /Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Products/Debug/XBMC duplicate symbol _ff_log2_tab in: /Users/lars/src/xbmc-12.0/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) /Users/lars/src/xbmc-12.0/lib/ffmpeg/libavformat/libavformat.a(log2_tab.o) duplicate symbol _ff_log2_tab in: /Users/lars/src/xbmc-12.0/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) /Users/lars/src/xbmc-12.0/lib/ffmpeg/libavutil/libavutil.a(log2_tab.o) duplicate symbol _ff_log2_tab in: /Users/lars/src/xbmc-12.0/lib/ffmpeg/libavcodec/libavcodec.a(log2_tab.o) /Users/lars/src/xbmc-12.0/lib/ffmpeg/libswresample/libswresample.a(log2_tab.o) ld: 3 duplicate symbols for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From eric.beuque at gmail.com Wed Feb 13 18:21:19 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Wed, 13 Feb 2013 18:21:19 +0100 Subject: [Libav-user] Using swcale to crop picture Message-ID: Hi, I'm using avcodec and swcale to to display a MPJEG stream in a Qt application. avcodec decode image as YUV image and swscale rescale it in a RGB32 image to fit in the windows. I would like to provide a zoom feature, i so i am wondering if any way exists with swscale to rescale only the selected region. For example, I got an original YUV image as 1280x800 pixels, the destination widget is 640x480 pixels, but i want only to display the region [0,0] to [320,240]. Is swscale able to to that? I have some difficulties to understand all variables in the documentation. Thank for your help -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Wed Feb 13 18:23:04 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 13 Feb 2013 18:23:04 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: Message-ID: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> On Feb 13, 2013, at 18:14, Lars Hammarstrand wrote: > In general doing "#include ../common/source.c" with global variables is probably a bad idea if you want to avoid duplicate symbols in "public" libraries. Agreed, hence my question if there's a reason for the duplicate definition. I'm guessing it just never tripped an error, though. > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -filelist /Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Intermediates/XBMC.build/Debug/XBMC.build/Objects-normal/i386/XBMC.LinkFileList -mmacosx-version-min=10.6 -headerpad_max_install_names -all_load ^^^^^^^^^ There's your explanation (from `man gcc`): -all_load Loads all members of static archive libraries. See man ld(1) for more information. Now the question is of course, do *you* need that option, linking what appears to be an executable? From onemda at gmail.com Wed Feb 13 18:35:39 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 13 Feb 2013 17:35:39 +0000 Subject: [Libav-user] Using swcale to crop picture In-Reply-To: References: Message-ID: On 2/13/13, Eric Beuque wrote: > Hi, > > I'm using avcodec and swcale to to display a MPJEG stream in a Qt > application. > > avcodec decode image as YUV image and swscale rescale it in a RGB32 image > to fit in the windows. > > I would like to provide a zoom feature, i so i am wondering if any way > exists with swscale to rescale only the selected region. For example, I got > an original YUV image as 1280x800 pixels, the destination widget is 640x480 > pixels, but i want only to display the region [0,0] to [320,240]. > > Is swscale able to to that? I have some difficulties to understand all > variables in the documentation. No, swscale is not supposed to do that. libavfilter have filters that do cropping, pading and etc... Also its not hard to do it manually. > Thank for your help > From lars.hammarstrand at gmail.com Wed Feb 13 18:55:36 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 18:55:36 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> References: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> Message-ID: > There's your explanation (from `man gcc`): > -all_load > Loads all members of static archive libraries. See man ld(1) for more information. Good eyes and a very observant mind, thank you very much ;-) I'll check the reason behind and if we can disable "-all_load" since this feels better than cleaning out duplicate objects from the ffmpeg libs. Thought I'm not sure how this will work on other platforms like win, osx, linux and android. If there are no obvious reasons to keep the current solution with "#include source" it would be nice if someone could implement an alternative solution for the long term. -- 2013/2/13 "Ren? J.V. Bertin" > > On Feb 13, 2013, at 18:14, Lars Hammarstrand wrote: > > > In general doing "#include ../common/source.c" with global variables is > probably a bad idea if you want to avoid duplicate symbols in "public" > libraries. > > Agreed, hence my question if there's a reason for the duplicate > definition. I'm guessing it just never tripped an error, though. > > > > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ > -arch i386 -filelist > /Users/lars/Library/Developer/Xcode/DerivedData/XBMC-cowrsziekmorhqejlbarbpswsqbh/Build/Intermediates/XBMC.build/Debug/XBMC.build/Objects-normal/i386/XBMC.LinkFileList > -mmacosx-version-min=10.6 -headerpad_max_install_names -all_load > > ^^^^^^^^^ > > There's your explanation (from `man gcc`): > -all_load > Loads all members of static archive libraries. See man ld(1) > for more information. > > Now the question is of course, do *you* need that option, linking what > appears to be an executable? > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Wed Feb 13 19:13:02 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 13 Feb 2013 19:13:02 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> Message-ID: On Feb 13, 2013, at 18:55, Lars Hammarstrand wrote: > > There's your explanation (from `man gcc`): > > -all_load > > Loads all members of static archive libraries. See man ld(1) for more information. > > Good eyes and a very observant mind, thank you very much ;-) Bah, who knows what font size I have in my mail reader? ;) IIRC, -all_load is mostly/only of interest when creating libraries from other (static) libraries, to ensure that all functions/modules get pulled in. I don't really see the interest when linking an application, unless of course you want to enable plugins to dlsym variables or functions that the app doesn't use itself. And I'm not sure if I find that better practice than defining global variables multiple times in public libraries ;) R. From lars.hammarstrand at gmail.com Wed Feb 13 19:36:44 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 19:36:44 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> Message-ID: Apparently there are some issues with ios 64-bit osx: " http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do ": *"Important:* For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags" 2013/2/13 "Ren? J.V. Bertin" > > On Feb 13, 2013, at 18:55, Lars Hammarstrand wrote: > > > > There's your explanation (from `man gcc`): > > > -all_load > > > Loads all members of static archive libraries. See man > ld(1) for more information. > > > > Good eyes and a very observant mind, thank you very much ;-) > > Bah, who knows what font size I have in my mail reader? ;) > > IIRC, -all_load is mostly/only of interest when creating libraries from > other (static) libraries, to ensure that all functions/modules get pulled > in. I don't really see the interest when linking an application, unless of > course you want to enable plugins to dlsym variables or functions that the > app doesn't use itself. And I'm not sure if I find that better practice > than defining global variables multiple times in public libraries ;) > > R. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Feb 13 19:39:56 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 19:39:56 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <10ED54E3-3D03-47EC-8E7A-EDE763088347@gmail.com> Message-ID: Btw, are there any ffmpeg-devs on this list? 2013/2/13 Lars Hammarstrand > Apparently there are some issues with ios 64-bit osx: " > http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do > ": > > *"Important:* For 64-bit and iPhone OS applications, there is a linker > bug that prevents -ObjC from loading objects files from static libraries > that contain only categories and no classes. The workaround is to use the > -all_load or -force_load flags" > > > > > > 2013/2/13 "Ren? J.V. Bertin" > >> >> On Feb 13, 2013, at 18:55, Lars Hammarstrand wrote: >> >> > > There's your explanation (from `man gcc`): >> > > -all_load >> > > Loads all members of static archive libraries. See man >> ld(1) for more information. >> > >> > Good eyes and a very observant mind, thank you very much ;-) >> >> Bah, who knows what font size I have in my mail reader? ;) >> >> IIRC, -all_load is mostly/only of interest when creating libraries from >> other (static) libraries, to ensure that all functions/modules get pulled >> in. I don't really see the interest when linking an application, unless of >> course you want to enable plugins to dlsym variables or functions that the >> app doesn't use itself. And I'm not sure if I find that better practice >> than defining global variables multiple times in public libraries ;) >> >> R. >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelni at gmx.at Wed Feb 13 20:01:06 2013 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 13 Feb 2013 20:01:06 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: Message-ID: <20130213190106.GZ5712@kiste2> Hi On Wed, Feb 13, 2013 at 04:36:38PM +0100, Lars Hammarstrand wrote: > Hello, can someone please explain the reason (and how to cope with) that * > ff_log2_tab* is defined multiple times with *#include "libavutil/log2_tab.c*" > in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? duplicating the tables causes a small performance increase in some linking configurations. > > This results in "duplicate symbols" while linking as listed below. To get > ride of the problem we need to delete the duplicated entries by hand with > "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth > solution. Will this behavior change in the future or do weed need to > automate a duplicate removal process while building the ffmpeg libraries > for XBMC? Ive posted a patch to ffmpeg-dev, which may fix this: 0213 19:51 To FFmpeg devel (3.0K) [FFmpeg-devel] [PATCH] buildsys: only include log2_tab per library for shared builds please test and comments welcome note, some linkers can also be configured to ignore duplicate symbols Thanks for the bug report [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From lars.hammarstrand at gmail.com Wed Feb 13 20:16:14 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 13 Feb 2013 20:16:14 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <20130213190106.GZ5712@kiste2> References: <20130213190106.GZ5712@kiste2> Message-ID: Hello Michael - great news, thank you very much !! Which branch and repo is this patch applied to? /Thanks in advance, Lars. 2013/2/13 Michael Niedermayer > Hi > > On Wed, Feb 13, 2013 at 04:36:38PM +0100, Lars Hammarstrand wrote: > > Hello, can someone please explain the reason (and how to cope with) that > * > > ff_log2_tab* is defined multiple times with *#include > "libavutil/log2_tab.c*" > > in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? > > duplicating the tables causes a small performance increase in some > linking configurations. > > > > > > This results in "duplicate symbols" while linking as listed below. To get > > ride of the problem we need to delete the duplicated entries by hand with > > "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth > > solution. Will this behavior change in the future or do weed need to > > automate a duplicate removal process while building the ffmpeg libraries > > for XBMC? > > Ive posted a patch to ffmpeg-dev, which may fix this: > 0213 19:51 To FFmpeg devel (3.0K) [FFmpeg-devel] [PATCH] buildsys: only > include log2_tab per library for shared builds > > please test and comments welcome > > note, some linkers can also be configured to ignore duplicate symbols > > Thanks for the bug report > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Concerning the gods, I have no means of knowing whether they exist or not > or of what sort they may be, because of the obscurity of the subject, and > the brevity of human life -- Protagoras > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Wed Feb 13 20:26:13 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 13 Feb 2013 20:26:13 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <20130213190106.GZ5712@kiste2> References: <20130213190106.GZ5712@kiste2> Message-ID: <7E8D1825-B6E7-4BC6-BBD4-10355BE44102@gmail.com> On Feb 13, 2013, at 20:01, Michael Niedermayer wrote: > > duplicating the tables causes a small performance increase in some > linking configurations. If that's the case, why not do something like this? in libavutil/log2_tab.c : #ifndef cdh_GLUE # define cdh_GLUE(a,b) a##b #endif #ifndef cdh_GLUE2 # define cdh_GLUE2(a,b) cdh_GLUE(a,b) #endif #define ADD_BASENAME(name) cdh_GLUE2(LIBRARY_BASENAME,name) #ifndef LIBRARY_BASENAME # define LIBRARY_BASENAME ff_ #endif const uint8_t ADD_BASENAME(log2_tab)[256]{ ... }; And then define LIBRARY_BASENAME to something relevant in each file outside of libavutil where (and before) you include log2_tab.c ... (with thank to Apple's QuickTime Component stuff ;) ) R. From michaelni at gmx.at Wed Feb 13 20:32:46 2013 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 13 Feb 2013 20:32:46 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> Message-ID: <20130213193246.GA5712@kiste2> On Wed, Feb 13, 2013 at 08:16:14PM +0100, Lars Hammarstrand wrote: > Hello Michael - great news, thank you very much !! Which branch and repo > is this patch applied to? /Thanks in advance, Lars. patch is based on master, its not applied yet [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB No human being will ever know the Truth, for even if they happen to say it by chance, they would not even known they had done so. -- Xenophanes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From cpsmusic at yahoo.com Thu Feb 14 01:41:39 2013 From: cpsmusic at yahoo.com (Chris Share) Date: Wed, 13 Feb 2013 16:41:39 -0800 (PST) Subject: [Libav-user] Encoding RGB Data to YUV420p Message-ID: <1360802499.42786.YahooMailNeo@web161403.mail.bf1.yahoo.com> Hi, I'm currently working on the open source animation application Pencil2D. I'd like to get file export working and I'm using the decoding_encoding.c example as a guide. At the moment, I'm developing a test application that imports a .png image and encodes it as a 1 second movie file (using the default output format). I've got the .png image data in a vector as RGB data (0-255 range). What I'm not clear about is how to convert this image data to YUV420p format as per the?decoding_encoding.c example. I posted a question on this topic on a general programming site and it was suggested that I should convert the RGB data to YUV444 and then convert this to YUV420p. Is that correct? A simple example of how to do this would be greatly appreciated. Cheers, Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Feb 14 02:11:20 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 01:11:20 +0000 (UTC) Subject: [Libav-user] Encoding RGB Data to YUV420p References: <1360802499.42786.YahooMailNeo@web161403.mail.bf1.yahoo.com> Message-ID: Chris Share writes: > I've got the .png image data in a vector as RGB data > (0-255 range). > > What I'm not clear about is how to convert this image > data to YUV420p format as per the?decoding_encoding.c > example. See the scaling_video.c and filtering_video.c examples: You can either use the scale filter or libswscale directly. > I posted a question on this topic on a general > programming site and it was suggested that I should > convert the RGB data to YUV444 and then convert this > to YUV420p. Is that correct? It does not sound correct (or at least not the easiest way) to me. Carl Eugen From cpsmusic at yahoo.com Thu Feb 14 02:48:47 2013 From: cpsmusic at yahoo.com (Chris Share) Date: Wed, 13 Feb 2013 17:48:47 -0800 (PST) Subject: [Libav-user] Encoding RGB Data to YUV420p In-Reply-To: References: <1360802499.42786.YahooMailNeo@web161403.mail.bf1.yahoo.com> Message-ID: <1360806527.82969.YahooMailNeo@web161401.mail.bf1.yahoo.com> I'm new to video programming (my background is audio programming). Could you expand on this please? ________________________________ From: Carl Eugen Hoyos To: libav-user at ffmpeg.org Sent: Thursday, 14 February 2013 12:11 PM Subject: Re: [Libav-user] Encoding RGB Data to YUV420p Chris Share writes: > I've got the .png image data in a vector as RGB data > (0-255 range). > > What I'm not clear about is how to convert this image > data to YUV420p format as per the?decoding_encoding.c > example. See the scaling_video.c and filtering_video.c examples: You can either use the scale filter or libswscale directly. > I posted a question on this topic on a general > programming site and it was suggested that I should > convert the RGB data to YUV444 and then convert this > to YUV420p. Is that correct? It does not sound correct (or at least not the easiest way) to me. Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From xuanyu.huang at gmail.com Thu Feb 14 03:57:45 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Thu, 14 Feb 2013 13:57:45 +1100 Subject: [Libav-user] ffmpeg converted swf can't play audio in flash player Message-ID: Hi All, I'm upgrading our application from old version of ffmpeg to latest version. Our application uses ffmpeg libraries to do format conversion. While current version of our application can successfully convert a mp4 file into a swf. After latest ffmpeg code is used, generated swf, when played in adobe flash player (installer here http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_sa_debug.exe ) there's no audio heard. But the same file when played in VLC player, can play audio correctly. I also tried ffmpeg executable of latest version, versions on Apr, May and Jun of 2012. None swf file generated by them can play audio in flash player. The command I used is the simplest form: ffmpeg -i input.mp4 output.swf Since current version of our application uses ffmpeg at about May 2012, and it can generate correct swf. I guess there are some settings our application set got deprecated or changed. Does anyone have an idea of this? Great thanks. source mp4 link here: https://dl.dropbox.com/u/7854771/big_buck_bunny.mp4and command line log attached. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- $ ffmpeg -i big_buck_bunny.mp4 big_buck_bunny.1.swf ffmpeg version N-49844-g1ac0fa5 Copyright (c) 2000-2013 the FFmpeg developers built on Feb 12 2013 17:42:46 with gcc 4.7.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.103 / 54. 91.103 libavformat 54. 63.100 / 54. 63.100 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 37.101 / 3. 37.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big_buck_bunny.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42avc1 creation_time : 2010-02-09 01:55:39 Duration: 00:01:00.10, start: 0.000000, bitrate: 733 kb/s Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 65 kb/s Metadata: creation_time : 2010-02-09 01:55:39 handler_name : Apple Sound Media Handler Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 612 kb/s, 23.96 fps, 24 tbr, 600 tbn, 1200 tbc Metadata: creation_time : 2010-02-09 01:55:39 handler_name : Apple Video Media Handler Stream #0:2(eng): Data: none (rtp / 0x20707472), 45 kb/s Metadata: creation_time : 2010-02-09 01:55:39 handler_name : hint media handler Stream #0:3(eng): Data: none (rtp / 0x20707472), 5 kb/s Metadata: creation_time : 2010-02-09 01:55:39 handler_name : hint media handler Output #0, swf, to 'big_buck_bunny.1.swf': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42avc1 encoder : Lavf54.63.100 Stream #0:0(eng): Video: flv1, yuv420p, 640x360, q=2-31, 200 kb/s, 90k tbn, 24 tbc Metadata: creation_time : 2010-02-09 01:55:39 handler_name : Apple Video Media Handler Stream #0:1(eng): Audio: mp3, 22050 Hz, stereo, fltp Metadata: creation_time : 2010-02-09 01:55:39 handler_name : Apple Sound Media Handler Stream mapping: Stream #0:1 -> #0:0 (h264 -> flv) Stream #0:0 -> #0:1 (aac -> libmp3lame) Press [q] to stop, [?] for help frame= 1440 fps=391 q=31.0 Lsize= 2469kB time=00:01:00.16 bitrate= 336.1kbits/s video:1959kB audio:470kB subtitle:0 global headers:0kB muxing overhead 1.622427% From cehoyos at ag.or.at Thu Feb 14 08:55:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 07:55:00 +0000 (UTC) Subject: [Libav-user] ffmpeg converted swf can't play audio in flash player References: Message-ID: ??? writes: > I also tried ffmpeg executable of latest version, > versions on Apr, May and Jun of 2012. None swf file? > generated by them can play audio in flash player. > The command I used is the simplest form: > ffmpeg -i input.mp4 output.swf > > > Since current version of our application uses ffmpeg > at about May 2012, and it can generate correct swf. This is very difficult to understand: Above, you write that "versions on Apr, May and Jun of 2012" do not work for you (iiuc). Now, "ffmpeg at about May 2012" works fine. Could you elaborate? Or, even better: If you compile yourself, use git bisect to find the change introducing the regression, if you are using Zeranoe builds use http://ffmpeg.zeranoe.com/builds/win32/static/ to find the first version not working (and the last one working). Carl Eugen From cpsmusic at yahoo.com Thu Feb 14 10:00:32 2013 From: cpsmusic at yahoo.com (Chris Share) Date: Thu, 14 Feb 2013 01:00:32 -0800 (PST) Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P Message-ID: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> Hi, I'm currently trying to implement file export for the open source animation program Pencil2D. This involves converting RGB (0 - 255) image data to a suitable movie format. The examples in the source tree have been very helpful however I still have some questions: The?scaling_video.c is close to what I need however the conversion is the opposite of what I want. What I'm not clear about is how to change the "fill_yuv_image" function to something like "fill_rgb_image". How does the RGB data get written into the "uint8_t *data[4]"? Is it written consecutively (all R values get written to data[0], all G values to data[1], etc.)? Cheers, Chris From cehoyos at ag.or.at Thu Feb 14 10:52:46 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 09:52:46 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?How_to_Convert_AV=5FPIX=5FFMT=5FRGB24_to_A?= =?utf-8?q?V=5FPIX=5FFMT=5FYUV420P?= References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: Chris Share writes: > The?scaling_video.c is close to what I need however the > conversion is the opposite of what I want. What I'm > not clear about is how to change the "fill_yuv_image" > function to something like "fill_rgb_image". The function is used to provide an artificial source image. You don't need it since you already have an input image. > How does the RGB data get written into the > "uint8_t *data[4]"? Is it written consecutively (all R > values get written to data[0], all G values to data[1], etc.)? That would be planar RGB, see PIX_FMT_GBR. RGB is a packed format, see libavutil/pixfmt.h Note that all this has limited relevance for you if you don't rescale yourself but use the scale filter (or libswscale directly). Carl Eugen From eric.beuque at gmail.com Thu Feb 14 11:13:24 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Thu, 14 Feb 2013 11:13:24 +0100 Subject: [Libav-user] Using swcale to crop picture In-Reply-To: References: Message-ID: Thank you for your answser! I'm going to try libavfilter. I saw it seems to provide a filter algorithm, so i guess libavfilter can replace libswscale? So what is the benefits to use libswcale instead of libavfilter? On Wed, Feb 13, 2013 at 6:35 PM, Paul B Mahol wrote: > On 2/13/13, Eric Beuque wrote: > > Hi, > > > > I'm using avcodec and swcale to to display a MPJEG stream in a Qt > > application. > > > > avcodec decode image as YUV image and swscale rescale it in a RGB32 image > > to fit in the windows. > > > > I would like to provide a zoom feature, i so i am wondering if any way > > exists with swscale to rescale only the selected region. For example, I > got > > an original YUV image as 1280x800 pixels, the destination widget is > 640x480 > > pixels, but i want only to display the region [0,0] to [320,240]. > > > > Is swscale able to to that? I have some difficulties to understand all > > variables in the documentation. > > No, swscale is not supposed to do that. > > libavfilter have filters that do cropping, pading and etc... > Also its not hard to do it manually. > > > Thank for your help > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Feb 14 11:28:14 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 10:28:14 +0000 (UTC) Subject: [Libav-user] Using swcale to crop picture References: Message-ID: Eric Beuque writes: > Thank you for your answser!I'm going to try libavfilter. > I saw it seems to provide a filter algorithm, so i > guess libavfilter can replace libswscale? The scale filter uses / depends on libswscale. (Note that I believe since you control the data pointers, the width and the linesize arguments, it may be possible to "crop" with libswscale alone, but using the crop filter should be the better solution.) Carl Eugen From eric.beuque at gmail.com Thu Feb 14 11:40:28 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Thu, 14 Feb 2013 11:40:28 +0100 Subject: [Libav-user] Using swcale to crop picture In-Reply-To: References: Message-ID: Sorry i forgot a word in my sentence: "I'm going to try libavfilter. I saw it seems to provide a ***scale*** filter algorithm, so i guess libavfilter can replace libswscale?" What I means is libavfilter can totally replace libswcale? Or they should be combined? On Thu, Feb 14, 2013 at 11:28 AM, Carl Eugen Hoyos wrote: > Eric Beuque writes: > > > Thank you for your answser!I'm going to try libavfilter. > > I saw it seems to provide a filter algorithm, so i > > guess libavfilter can replace libswscale? > > The scale filter uses / depends on libswscale. > > (Note that I believe since you control the data pointers, > the width and the linesize arguments, it may be possible > to "crop" with libswscale alone, but using the crop > filter should be the better solution.) > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jerome.salayet at hymatom.fr Thu Feb 14 11:50:34 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Thu, 14 Feb 2013 11:50:34 +0100 Subject: [Libav-user] Pb use av_new_packet Message-ID: <79C91ED810DD8A49B375C899D0034D270993B2@mail.hymatom.fr> Hello, I use av_init_packet in my code to decompress H264 streaming. http://pastebin.com/sNpcpHjf But it seems better for me to use av_new_packet because I don't have to use my lpFFMPEGBuffer. But When I try to replace in my code: av_init_packet(&m_lpPacket); if (m_lpFFMPEGBuffer == NULL) { m_lpFFMPEGBuffer = new BYTE[MAX_MPEG4VIDEO_FRAMESIZE+FF_INPUT_BUFFER_PADDING_SIZE]; } if (m_lpFFMPEGBuffer !=NULL) { ZeroMemory( m_lpFFMPEGBuffer, MAX_MPEG4VIDEO_FRAMESIZE+FF_INPUT_BUFFER_PADDING_SIZE); CopyMemory( m_lpFFMPEGBuffer, lpImageData, dwImageSize); // Set the buffer to packet data m_lpPacket.data = m_lpFFMPEGBuffer; // Set the size to packet size m_lpPacket.size = dwImageSize; } By av_new_packet(&m_lpPacket, dwFrameSize) CopyMemory( m_lpPacket.data , lpImageData, dwImageSize); m_lpPacket.size = dwImageSize; I have a crash when calling av_free_packet(&m_lpPacket). It seem the crash is in the av_destruct_packet. If I don't call the avcodec_decode_video2 function, I don't have the crash. But if I use avcodec_decode_video2 and don't use the av_free_packet, I have a memory leak. If someone can explain me, Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From cpsmusic at yahoo.com Thu Feb 14 12:46:42 2013 From: cpsmusic at yahoo.com (Chris Share) Date: Thu, 14 Feb 2013 03:46:42 -0800 (PST) Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P In-Reply-To: References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: <1360842402.61556.YahooMailNeo@web161406.mail.bf1.yahoo.com> Chris Share writes: >> The?scaling_video.c is close to what I need however the >>?conversion is the opposite of what I want. What I'm >> not clear about is how to change the "fill_yuv_image" >> function to something like "fill_rgb_image". >The function is used to provide an artificial source image. >You don't need it since you already have an input image. >> How does the RGB data get written into the >> "uint8_t *data[4]"? Is it written consecutively (all R >> values get written to data[0], all G values to data[1], etc.)? >That would be planar RGB, see PIX_FMT_GBR. >RGB is a packed format, see libavutil/pixfmt.h Does that mean I should use?AV_PIX_FMT_GBRP as the input format?? In pixfmt.h it mentions the following: "///< planar GBR 4:4:4 24bpp". Does this mean that each color value needs to be set to a 24-bit data type? Also, I'm still not clear about how to get the RGB data into the "uint8_t *src_data[4]" - how do I actually do this? >Note that all this has limited relevance for you if you >don't rescale yourself but use the scale filter (or >libswscale directly). Sorry, but I'm not sure what you mean. From cehoyos at ag.or.at Thu Feb 14 13:22:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 12:22:05 +0000 (UTC) Subject: [Libav-user] Using swcale to crop picture References: Message-ID: Eric Beuque writes: > Sorry i forgot a word in my sentence: "I'm going to > try libavfilter. I saw it seems to provide a > ***scale*** filter algorithm, so i guess libavfilter > can replace libswscale? The scale filter uses / depends on libswscale. > "What I means is libavfilter can totally replace libswcale? No. (Actually yes, but not the way you seem to believe.) Please do not top-post here, it is considered rude, Carl Eugen From cehoyos at ag.or.at Thu Feb 14 13:28:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 12:28:43 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?How_to_Convert_AV=5FPIX=5FFMT=5FRGB24_to_A?= =?utf-8?q?V=5FPIX=5FFMT=5FYUV420P?= References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> <1360842402.61556.YahooMailNeo@web161406.mail.bf1.yahoo.com> Message-ID: Chris Share writes: > Chris Share writes: > > >> The?scaling_video.c is close to what I need however the > >>?conversion is the opposite of what I want. What I'm > >> not clear about is how to change the "fill_yuv_image" > >> function to something like "fill_rgb_image". > > >The function is used to provide an artificial source image. > >You don't need it since you already have an input image. > > >> How does the RGB data get written into the > >> "uint8_t *data[4]"? Is it written consecutively (all R > >> values get written to data[0], all G values to data[1], etc.)? > > >That would be planar RGB, see PIX_FMT_GBR. > >RGB is a packed format, see libavutil/pixfmt.h > > Does that mean I should use?AV_PIX_FMT_GBRP as the input format? It does not mean that. You should use the input format that your "RGB (0 - 255) image data" input uses. > In pixfmt.h it mentions the following: "///< planar > GBR 4:4:4 24bpp". Does this mean that each color > value needs to be set to a 24-bit data type? No, please read the cited line again (carefully). > Also, I'm still not clear about how to get the RGB data > into the "uint8_t *src_data[4]" - how do I actually do > this? You shouldn't. You set src_data[4] to your input data. > >Note that all this has limited relevance for you if you > >don't rescale yourself but use the scale filter (or > >libswscale directly). > > Sorry, but I'm not sure what you mean. You don't have to do anything with your input data (assuming it really is in RGB format), you only have to tell the scale filter / libswscale which format your data has. Or in other words: The reason you should understand pixfmt.h is not that you have to change your input format into something else but that you find the corresponding FFmpeg pixel format. Carl Eugen From joris.valette at gmail.com Thu Feb 14 13:42:33 2013 From: joris.valette at gmail.com (Joris VALETTE) Date: Thu, 14 Feb 2013 13:42:33 +0100 Subject: [Libav-user] Maybe about an MVC decoder Message-ID: Hello libav-users/devs ! I have several question related to an hypothetical MVC decoder. 1? Can you tell me whether this 3D video (00001.MTS) is indeed encoded with H.264/MVC ? => http://dept-info.labri.fr/~charton/pdp/Videos/ If so, how do you get this information ? I'm trying to understand the concept behind stereoscopic videos and how they are stored. For now, with the littlesoftware "mediainfo" I can see that there are 4 streams, of which 2 are video streams (1st and 4th). Can you confirm that the 1st stream is solely for the left eye, and the 4th solely for the right eye ? 2? If that is the case, I guess the right stream is fully predicted based on the left one. Is there a decoder which performs the decompression of the right stream ? I have looked and it doesn't seem to be the case, if so, why isn't it implemented yet ? Too hard, too costly, lack of interest for now ? Kind regards, Joris Valette -------------- next part -------------- An HTML attachment was scrubbed... URL: From xuanyu.huang at gmail.com Thu Feb 14 13:58:08 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Thu, 14 Feb 2013 23:58:08 +1100 Subject: [Libav-user] Fwd: ffmpeg converted swf can't play audio in flash player In-Reply-To: References: Message-ID: Hi Carl For 'versions on Apr, May and Jun of 2012 do not work', I mean I downloaded executable, and run those executable directly with command line option "-i input.mp4 out.swf". For "ffmpeg at about May 2012 works" I mean our application uses ffmpeg libraries compiled on code released at about May 2012. Our application uses ffmpeg API to do conversion, and it works. It failed on latest Zeranoe build, and today I also compiled on Ubuntu with latest code, and converted swf still has problem. Thanks ---------- Forwarded message ---------- From: Carl Eugen Hoyos Date: 2013/2/14 Subject: Re: [Libav-user] ffmpeg converted swf can't play audio in flash player To: libav-user at ffmpeg.org ??? writes: > I also tried ffmpeg executable of latest version, > versions on Apr, May and Jun of 2012. None swf file > generated by them can play audio in flash player. > The command I used is the simplest form: > ffmpeg -i input.mp4 output.swf > > > Since current version of our application uses ffmpeg > at about May 2012, and it can generate correct swf. This is very difficult to understand: Above, you write that "versions on Apr, May and Jun of 2012" do not work for you (iiuc). Now, "ffmpeg at about May 2012" works fine. Could you elaborate? Or, even better: If you compile yourself, use git bisect to find the change introducing the regression, if you are using Zeranoe builds use http://ffmpeg.zeranoe.com/builds/win32/static/ to find the first version not working (and the last one working). Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Feb 14 14:46:07 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Feb 2013 13:46:07 +0000 (UTC) Subject: [Libav-user] Maybe about an MVC decoder References: Message-ID: Joris VALETTE writes: > 1? Can you tell me whether this 3D video (00001.MTS) > is indeed encoded with H.264/MVC ? > =>?http://dept-info.labri.fr/~charton/pdp/Videos/ Yes, ffmpeg -i 00001.MTS indicates a mvc stream (not explicitly, but it looks like a mvc stream). [...] > I have looked and it doesn't seem to be the case, > if so, why isn't it implemented yet ? Because you did not send a patch yet. Carl Eugen From mjs5450 at rit.edu Thu Feb 14 15:33:46 2013 From: mjs5450 at rit.edu (Marty Sullivan) Date: Thu, 14 Feb 2013 09:33:46 -0500 Subject: [Libav-user] Encoding RGB Data to YUV420p In-Reply-To: <1360806527.82969.YahooMailNeo@web161401.mail.bf1.yahoo.com> References: <1360802499.42786.YahooMailNeo@web161403.mail.bf1.yahoo.com> <1360806527.82969.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: There are additional libraries in libav named libavfilter and libswscale. Use one of these libraries to convert your images, I recommend swscale as it can be done in a few lines. Read up on the sws_getContext and sws_scale functions. You will have to make your RGBA vector into an AVPicture too, also not difficult. As the poster above mentioned, those C programs will have in depth examples. Marty On Wed, Feb 13, 2013 at 8:48 PM, Chris Share wrote: > I'm new to video programming (my background is audio programming). Could > you expand on this please? > > ------------------------------ > *From:* Carl Eugen Hoyos > *To:* libav-user at ffmpeg.org > *Sent:* Thursday, 14 February 2013 12:11 PM > *Subject:* Re: [Libav-user] Encoding RGB Data to YUV420p > > Chris Share writes: > > > I've got the .png image data in a vector as RGB data > > (0-255 range). > > > > What I'm not clear about is how to convert this image > > data to YUV420p format as per the decoding_encoding.c > > example. > > See the scaling_video.c and filtering_video.c examples: > You can either use the scale filter or libswscale directly. > > > I posted a question on this topic on a general > > programming site and it was suggested that I should > > convert the RGB data to YUV444 and then convert this > > to YUV420p. Is that correct? > > It does not sound correct (or at least not the easiest way) > to me. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From halonso at vpod.tv Thu Feb 14 10:38:56 2013 From: halonso at vpod.tv (Hector Alonso) Date: Thu, 14 Feb 2013 10:38:56 +0100 Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P In-Reply-To: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: Hi Chris, You can implement some kind of function like: // dependencies into C++ extern "C" { #include #include #include #include #include } /** * This function converts an image (uncompressed buffer) from an input * specified pixel format to an output specified pixel format and buffer. * dependencies LibAV. * @param [in] eInFormat input image Pixel format @see LibaAV PixelFormat enum type. * @param [in] iInWidth input image width * @param [in] iInHeight input image height * @param [in] ptInData input image buffer * @param [in] eOutFormat output image Pixel format @see LibaAV PixelFormat enum type. * @param [in] iOutWidth output image width * @param [in] iOutHeight output image height * @param [out] src output image buffer * @return true if everything was correct, false otherwise) **/ bool ConvertImage1(PixelFormat eInFormat, int iInWidth, int iInHeight, void* ptInData, PixelFormat eOutFormat, int iOutWidth, int iOutHeight, AVPicture* src) { SwsContext* ptImgConvertCtx; // Frame conversion context AVPicture ptPictureIn; uint8_t * ptBufferIn; //Initialize convert context //------------------ ptImgConvertCtx = sws_getContext(iInWidth, iInHeight, eInFormat, // (source format) iOutWidth, iOutHeight, eOutFormat, // (dest format) SWS_BICUBIC, NULL, NULL, NULL); // Init input frame: //------------------ // Allocate an AVFrame structure // Determine required buffer size and allocate buffer // int iNumBytesIn=avpicture_get_size(eInFormat, iInWidth,iInHeight); ptBufferIn=(uint8_t*)(ptInData); // Assign appropriate parts of buffer to image planes in pFrameOut avpicture_fill(&ptPictureIn, ptBufferIn, eInFormat, iInWidth, iInHeight); // Do conversion: //------------------ int iRes = sws_scale(ptImgConvertCtx, ptPictureIn.data, //src ptPictureIn.linesize, 0, iInHeight, src->data,//dst src->linesize); //Free memory sws_freeContext(ptImgConvertCtx); //Check result: if (iRes == iOutHeight) return true; return false; } And use it like this (in this example is used to downscale, but you can use it for rescaling and or pixel format conversions) // Downscale AVPicture src; int iWidth = m_ptCurrentVideoMode->getWidth() / DL_LOW_DEFINITION_DEN; int iHeight = (m_ptCurrentVideoMode->getHeight() * iWidth) / m_ptCurrentVideoMode->getWidth(); iWidth = (floor(iWidth / 2)) * 2; iHeight = (floor(iHeight / 2)) * 2; avpicture_alloc(&src, AV_PIX_FMT_UYVY422, iWidth, iHeight); if(!ConvertImage1(AV_PIX_FMT_UYVY422, m_ptCurrentVideoMode->getWidth(), m_ptCurrentVideoMode->getHeight(), (void *)ptBuffer, AV_PIX_FMT_UYVY422, iWidth, iHeight, &src)) { avpicture_free(&src); return; } // ... whatever ... // Free aux frame avpicture_free(&src); I hope it helps! On Thu, Feb 14, 2013 at 10:00 AM, Chris Share wrote: > Hi, > > I'm currently trying to implement file export for the open source > animation program Pencil2D. This involves converting RGB (0 - 255) image > data to a suitable movie format. > > The examples in the source tree have been very helpful however I still > have some questions: > > The scaling_video.c is close to what I need however the conversion is the > opposite of what I want. What I'm not clear about is how to change the > "fill_yuv_image" function to something like "fill_rgb_image". How does the > RGB data get written into the "uint8_t *data[4]"? Is it written > consecutively (all R values get written to data[0], all G values to > data[1], etc.)? > > Cheers, > > Chris > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Thu Feb 14 22:53:08 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 14 Feb 2013 22:53:08 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: Hello folks! I found the original patch: avutil: Duplicate ff_log2_tab instead of sharing it across libs . The objectives for this patch was: "*The table is so small that the space gain is not worth the performance overhead of cross-library access*" (:uhu:). I have never heard of such a thing as "*cross-library access*" that "auto-magic" gives you a performance gain when you allocate the exact same object file to different link libraries in the same distribution package. Looking forward to have this "unpatched" ... -- 2013/2/13 Michael Niedermayer > Hi > > On Wed, Feb 13, 2013 at 04:36:38PM +0100, Lars Hammarstrand wrote: > > Hello, can someone please explain the reason (and how to cope with) that > * > > ff_log2_tab* is defined multiple times with *#include > "libavutil/log2_tab.c*" > > in the ffmpeg v1.1 libraries like libavcodec 54.91.102 and companions ?? > > duplicating the tables causes a small performance increase in some > linking configurations. > > > > > > This results in "duplicate symbols" while linking as listed below. To get > > ride of the problem we need to delete the duplicated entries by hand with > > "ar -d libxxx.a log2_tab.o" for all libraries but one, not a very smooth > > solution. Will this behavior change in the future or do weed need to > > automate a duplicate removal process while building the ffmpeg libraries > > for XBMC? > > Ive posted a patch to ffmpeg-dev, which may fix this: > 0213 19:51 To FFmpeg devel (3.0K) [FFmpeg-devel] [PATCH] buildsys: only > include log2_tab per library for shared builds > > please test and comments welcome > > note, some linkers can also be configured to ignore duplicate symbols > > Thanks for the bug report > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Concerning the gods, I have no means of knowing whether they exist or not > or of what sort they may be, because of the obscurity of the subject, and > the brevity of human life -- Protagoras > -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Thu Feb 14 22:56:14 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Thu, 14 Feb 2013 22:56:14 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: <9A96C2D2-2571-48F5-9EB6-7AD612D393B7@gmail.com> On Feb 14, 2013, at 22:53, Lars Hammarstrand wrote: > The objectives for this patch was: "The table is so small that the space gain is not worth the performance overhead of cross-library access" (:uhu:). I have never heard of such a thing as "cross-library access" that "auto-magic" gives you a performance gain when you allocate the exact same object file to different link libraries in the same distribution package. Well, there *used* to be (a difference between) near and far pointers ... R. From alexcohn at netvision.net.il Thu Feb 14 23:13:37 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 15 Feb 2013 00:13:37 +0200 Subject: [Libav-user] Pb use av_new_packet In-Reply-To: <79C91ED810DD8A49B375C899D0034D270993B2@mail.hymatom.fr> References: <79C91ED810DD8A49B375C899D0034D270993B2@mail.hymatom.fr> Message-ID: On Thu, Feb 14, 2013 at 12:50 PM, J?r?me SALAYET wrote: > Hello, I use av_init_packet in my code to decompress H264 streaming. > > But it seems better for me to use av_new_packet because I don?t have to use > my lpFFMPEGBuffer. But When I try to replace in my code: Yes, it's not clear why you need that extra buffer, or CopyMemory() at all. If you can guarantee that lpImageData points to a chunk of memory big enough, you can simply // Set the buffer to packet data m_lpPacket.data = lpImageData; BR, Alex From h.leppkes at gmail.com Thu Feb 14 23:19:13 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 14 Feb 2013 23:19:13 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: On Thu, Feb 14, 2013 at 10:53 PM, Lars Hammarstrand wrote: > Hello folks! > > I found the original patch: avutil: Duplicate ff_log2_tab instead of sharing > it across libs. > > The objectives for this patch was: "The table is so small that the space > gain is not worth the performance overhead of cross-library access" (:uhu:). > I have never heard of such a thing as "cross-library access" that > "auto-magic" gives you a performance gain when you allocate the exact same > object file to different link libraries in the same distribution package. > > Looking forward to have this "unpatched" ... Please don't top post on this mailing list. In any case, this patch was focused on shared library builds, and importing data symbols from shared libraries does add an extra level of indirection. However, not only that, it would also require exporting a ff* private symbol from avutil, and adds a lot of complexity when dealing with shared library builds on some systems (eg. MSVC) It may not do anything for static builds, but it also didn't cause any issues in sane build environments (all the ffmpeg applications still build fine for example), so it may as well be a problem on your end. From rjvbertin at gmail.com Thu Feb 14 23:50:51 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Thu, 14 Feb 2013 23:50:51 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: <1B3EAC00-DE5A-433C-86E1-0D00615F169B@gmail.com> Lars, Since you clearly have the your-ended problem of working in a context where multiple ff_log2_tabs bite, I suggest the open libavutil/intmath.h , and on line 53 or so you replace extern const uint8_t ff_log2_tab[256]; by static const uint8_t ff_log2_tab[256]={ 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 }; and of course you comment out the identical definition in log2_tab.c . I'm guessing that having the symbol local to each module might even speed up things by half a pixel per movie or so ;) R. From cpsmusic at yahoo.com Fri Feb 15 00:16:59 2013 From: cpsmusic at yahoo.com (Chris Share) Date: Thu, 14 Feb 2013 15:16:59 -0800 (PST) Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P In-Reply-To: References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: <1360883819.97816.YahooMailNeo@web161401.mail.bf1.yahoo.com> Thanks for the sample code. I have a couple of further questions: 1. If the input data is in a vector of unsigned chars (RGBRGB...), what is the best pixel format to use? 2. The input data is represented by the following method parameter: void* ptInData - I'm not clear as to how the vector is converted to an appropriate type - should it be an array of chars (RGBRGB...) or does the data need to be arranged differently (RRR...GGG...BBB...)? Cheers, Chris ________________________________ From: Hector Alonso To: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." Sent: Thursday, 14 February 2013 8:38 PM Subject: Re: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P Hi Chris, You can implement some kind of function like: // dependencies into C++? extern"C"{ #include #include #include #include #include } /** *Thisfunctionconvertsanimage(uncompressedbuffer)fromaninput *specifiedpixelformattoanoutputspecifiedpixelformatandbuffer. *dependenciesLibAV. *@param[in]eInFormatinputimagePixelformat at seeLibaAVPixelFormatenumtype. *@param[in]iInWidthinputimagewidth *@param[in]iInHeightinputimageheight *@param[in]ptInDatainputimagebuffer *@param[in]eOutFormatoutputimagePixelformat at seeLibaAVPixelFormatenumtype. *@param[in]iOutWidthoutputimagewidth *@param[in]iOutHeightoutputimageheight *@param[out]srcoutputimagebuffer *@returntrueifeverythingwascorrect,falseotherwise) **/ boolConvertImage1(PixelFormateInFormat,intiInWidth,intiInHeight,void*ptInData,PixelFormateOutFormat,intiOutWidth,intiOutHeight,AVPicture*src) { SwsContext*ptImgConvertCtx;// Frame conversion context AVPictureptPictureIn; uint8_t*ptBufferIn; //Initialize convert context //------------------ ptImgConvertCtx=sws_getContext(iInWidth,iInHeight,eInFormat,// (source format) iOutWidth,iOutHeight,eOutFormat,// (dest format) SWS_BICUBIC,NULL,NULL,NULL); // Init input frame: //------------------ // Allocate an AVFrame structure // Determine required buffer size and allocate buffer // int iNumBytesIn=avpicture_get_size(eInFormat, iInWidth,iInHeight); ptBufferIn=(uint8_t*)(ptInData); // Assign appropriate parts of buffer to image planes in pFrameOut avpicture_fill(&ptPictureIn,ptBufferIn,eInFormat,iInWidth,iInHeight); // Do conversion: //------------------ intiRes=sws_scale(ptImgConvertCtx, ptPictureIn.data,//src ptPictureIn.linesize, 0, iInHeight, src->data,//dst src->linesize); //Free memory sws_freeContext(ptImgConvertCtx); //Check result: if(iRes==iOutHeight) returntrue; returnfalse; } And use it like this (in this example is used to downscale, but you can use it for rescaling and or pixel format conversions) // Downscale AVPicturesrc; intiWidth=m_ptCurrentVideoMode->getWidth()/DL_LOW_DEFINITION_DEN; intiHeight=(m_ptCurrentVideoMode->getHeight()*iWidth)/m_ptCurrentVideoMode->getWidth(); iWidth=(floor(iWidth/2))*2; iHeight=(floor(iHeight/2))*2; avpicture_alloc(&src,AV_PIX_FMT_UYVY422,iWidth,iHeight); if(!ConvertImage1(AV_PIX_FMT_UYVY422, m_ptCurrentVideoMode->getWidth(), m_ptCurrentVideoMode->getHeight(), (void*)ptBuffer, AV_PIX_FMT_UYVY422, iWidth,iHeight, &src)) { avpicture_free(&src); return; } // ... whatever ... // Free aux frame avpicture_free(&src); I hope it helps! On Thu, Feb 14, 2013 at 10:00 AM, Chris Share wrote: Hi, > >I'm currently trying to implement file export for the open source animation program Pencil2D. This involves converting RGB (0 - 255) image data to a suitable movie format. > >The examples in the source tree have been very helpful however I still have some questions: > >The?scaling_video.c is close to what I need however the conversion is the opposite of what I want. What I'm not clear about is how to change the "fill_yuv_image" function to something like "fill_rgb_image". How does the RGB data get written into the "uint8_t *data[4]"? Is it written consecutively (all R values get written to data[0], all G values to data[1], etc.)? > >Cheers, > >Chris >_______________________________________________ >Libav-user mailing list >Libav-user at ffmpeg.org >http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From lars.hammarstrand at gmail.com Fri Feb 15 01:27:24 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 15 Feb 2013 01:27:24 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: 2013/2/14 Hendrik Leppkes > In any case, this patch was focused on shared library builds, and > importing data symbols from shared libraries does add an extra level > of indirection. > This problem is new to me, please tell me what os and run-time loader you are referring to that has this issue. This may once have been a problem at the time they started to use 16/32-bits MMU's (with segment programming aka near and far pointers) like 15-20 years ago but this is absolutely not an issue today. Bear in mind that the extra level of indirection you mention is only "a single bit in the big binary cosmos" (:-) compared to what the run-time loader is performing during normal work. Trying to optimized things this way is what I would call sub optimization... However, not only that, it would also require exporting a ff* private > symbol from avutil, and adds a lot of complexity when dealing with > shared library builds on some systems (eg. MSVC) > This is one part that I don't understand, what problem does MSVC have that requires multiple definitions of the same global variable? Btw, what do you mean by "private" symbol in this case, private like in a class definition or "static global in c" like Linkages of identifiers ? Anyhow, there was an another case with exactly the same problem in libavcodec v53.61.100 The global variable ff_inverse[257] in libavutil/inverse.c was included by libavcodec/inverse.c but has now moved into mathtables.c and is declared in mathops.h (see below). AFAIK there has been no problem so far with for MSVS. libavcodec/mathops.h: extern const uint32_t ff_inverse[257]; libavcodec/mathtables.c: const uint32_t ff_inverse[257]={ > It may not do anything for static builds, but it also didn't cause any > issues in sane build environments (all the ffmpeg applications still > build fine for example), so it may as well be a problem on your end. > Nope, it's bad practice and you are only begging Murphy for problems ;-) But we really don't have to argue about it since there will soon be a patch that will fix the problem according to Michael Niedermayer. Regards, Lars. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Fri Feb 15 09:15:16 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Fri, 15 Feb 2013 09:15:16 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: On Fri, Feb 15, 2013 at 1:27 AM, Lars Hammarstrand wrote: > >> However, not only that, it would also require exporting a ff* private >> symbol from avutil, and adds a lot of complexity when dealing with >> shared library builds on some systems (eg. MSVC) > > > This is one part that I don't understand, what problem does MSVC have that > requires multiple definitions of the same global variable? Btw, what do you > mean by "private" symbol in this case, private like in a class definition or > "static global in c" like Linkages of identifiers ? Everything prefixed with ff are private symbols in ffmpeg, and as such are not supposed to be exposed in link libraries, because they are not part of the public API/ABI. There are already too many exceptions to this, and this avoided even more. > > Anyhow, there was an another case with exactly the same problem in > libavcodec v53.61.100 The global variable ff_inverse[257] in > libavutil/inverse.c was included by libavcodec/inverse.c but has now moved > into mathtables.c and is declared in mathops.h (see below). AFAIK there has > been no problem so far with for MSVS. > > libavcodec/mathops.h: extern const uint32_t ff_inverse[257]; > libavcodec/mathtables.c: const uint32_t ff_inverse[257]={ > This is the exact reason it was moved from libavutil to libavcodec. Its only used in libavcodec, and to avoid loading the table from another library, it was moved into the library which actually uses it. From jerome.salayet at hymatom.fr Fri Feb 15 10:17:39 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Fri, 15 Feb 2013 10:17:39 +0100 Subject: [Libav-user] Pb use av_new_packet Message-ID: <79C91ED810DD8A49B375C899D0034D270993B4@mail.hymatom.fr> I need to do this because in the documentation of FFMPEG, for the avcodec_decode_video2, there's a Warning: The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. The end of the input buffer buf should be set to 0 to ensure that no overreading happens for damaged MPEG streams. This is why I need the need that extra buffer and do the CopyMemory (my H264 packet isn't padded with FF_INPUT_BUFFER_PADDING_SIZE). -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Fri Feb 15 10:37:06 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Fri, 15 Feb 2013 10:37:06 +0100 Subject: [Libav-user] a little performance/optimisation headbreaker :) Message-ID: 'Morning! I guess there are a number of people on here who are experts at writing optimised code exploiting every bit of a processor's instruction set. The code I recently isolated from the Perian project also attempts this, and I just came across something that got flabbergasted me. Perian is a Mac-only project, so it can make a number of safe assumptions about the CPUs it'll run on. Not so the split-off I created, which is Mac + Win32, likely to run on (lowly) AMD CPUs as well as high-end Intel ones. So I looked at the actual performance of a few of the SSE-optimised functions, knowing from experience that using SIMD also introduces overhead and that a good compiler is likely to create better assembly than a hand-coding non-expert tinkerer. So I have this little benchmark comparing 2 routines that convert yuv420 to yuv422, running them on data that's allocated only once and should contain random bits, counting the number of calls made during a 5 second period (using tested, high resolution, low-latency timing functions): AVPicture pict; uint8_t *baseAddr = NULL; int width = 720, height = 576, outRB = 1440; double t; unsigned long N = 0; memset( &pict.data, 0, sizeof(pict.data) ); pict.linesize[0] = 752, pict.linesize[1] = 376; init_HRTime(); if( (pict.data[0] = (uint8_t*) malloc( width * height * 2 * sizeof(uint8_t) )) && (pict.data[1] = (uint8_t*) malloc( width * height * 2 * sizeof(uint8_t) )) && (pict.data[2] = (uint8_t*) malloc( width * height * 2 * sizeof(uint8_t) )) && (baseAddr = (uint8_t*) malloc( width * height * 4 * 2 * sizeof(uint8_t) )) ){ double startT = HRTime_Time(); do{ Y420toY422_sse2( &pict, baseAddr, outRB, width, height, &N ); } while( (t = HRTime_Time() - startT) < 5 ); fprintf( stderr, "%lu Y420toY422_sse2(outRB=%d,width=%d,height=%d) conversions in %gs; %gHz\n", N, outRB, width, height, t, N / t ); startT = HRTime_Time(); N = 0; do{ Y420toY422_x86_scalar( &pict, baseAddr, outRB, width, height, &N ); N += 1; } while( (t = HRTime_Time() - startT) < 5 ); fprintf( stderr, "%lu Y420toY422_x86_scalar(outRB=%d,width=%d,height=%d) conversions in %gs; %gHz\n", N, outRB, width, height, t, N / t ); } On my 2.7Ghz dual-core i7 MBP, I get about 10000Hz for the SSE version, and roughly half that for the generic, scalar function, using gcc-4.2 as well as using MSVC 2010 Express running under WinXP in VirtualBox. The factor 2 speed gain for SSE code also applies on 2 AMD machines (mid-end laptop and C62 netbook). Then I installed a new mingw32 cross-compiler based on gcc 4.7 and for the heck of it compiled my benchmark with it ... and found same factor 2 ... but in favour of the scalar code, on my i7 . It's more like a factor 2.5, actually. Same thing after installing the native OS X gcc 4.7 version. The question: is gcc-4.7 clever enough to do a better optimisation of the 2nd benchmark loop than the 1st loop, or does it really generate so much better assembly from the scalar function? NB, -fno-inline-functions has no effect here. Not that it matters much, as even on the C62 netbook the SSE function runs at almost 700Hz. The functions: //Handles the last row for Y420 videos with an odd number of luma rows //FIXME: odd number of luma columns is not handled and they will be lost static void Y420toY422_lastrow(uint8_t *o, uint8_t *yc, uint8_t *uc, uint8_t *vc, int halfWidth) { int x; for(x=0; x < halfWidth; x++) { int x4 = x*4, x2 = x*2; o[x4] = uc[x]; o[++x4] = yc[x2]; o[++x4] = vc[x]; o[++x4] = yc[++x2]; } } #define HandleLastRow(o, yc, uc, vc, halfWidth, height) if (unlikely(height & 1)) Y420toY422_lastrow(o, yc, uc, vc, halfWidth) #include #ifdef _MSCVER # define FASTCALL __fastcall #elif defined(__i386__) && !defined(__llvm__) && !defined(_MSC_VER) # define FASTCALL __attribute__((fastcall)) #else # define FASTCALL #endif static FASTCALL void Y420toY422_sse2(AVPicture *picture, uint8_t *o, int outRB, int width, int height, unsigned long *N) { uint8_t *yc = picture->data[0], *uc = picture->data[1], *vc = picture->data[2]; int rY = picture->linesize[0], rUV = picture->linesize[1]; int y, x, halfwidth = width >> 1, halfheight = height >> 1; int vWidth = width >> 5; for (y = 0; y < halfheight; y++) { uint8_t *o2 = o + outRB, *yc2 = yc + rY; __m128i *ov = (__m128i*)o, *ov2 = (__m128i*)o2, *yv = (__m128i*)yc, *yv2 = (__m128i*)yc2; __m128i *uv = (__m128i*)uc,*vv = (__m128i*)vc; #if defined(__i386__) && !defined(_MSC_VER) //FIXMERJVB int vWidth_ = vWidth; asm volatile( "\n0: \n\t" "movdqa (%2), %%xmm0 \n\t" "movdqa 16(%2), %%xmm2 \n\t" "movdqa (%3), %%xmm1 \n\t" "movdqa 16(%3), %%xmm3 \n\t" "movdqu (%4), %%xmm4 \n\t" "movdqu (%5), %%xmm5 \n\t" "addl $32, %2 \n\t" "addl $32, %3 \n\t" "addl $16, %4 \n\t" "addl $16, %5 \n\t" "movdqa %%xmm4, %%xmm6 \n\t" "punpcklbw %%xmm5, %%xmm4 \n\t" /*chroma_l*/ "punpckhbw %%xmm5, %%xmm6 \n\t" /*chroma_h*/ "movdqa %%xmm4, %%xmm5 \n\t" "punpcklbw %%xmm0, %%xmm5 \n\t" "movntdq %%xmm5, (%0) \n\t" /*ov[x4]*/ "movdqa %%xmm4, %%xmm5 \n\t" "punpckhbw %%xmm0, %%xmm5 \n\t" "movntdq %%xmm5, 16(%0) \n\t" /*ov[x4+1]*/ "movdqa %%xmm6, %%xmm5 \n\t" "punpcklbw %%xmm2, %%xmm5 \n\t" "movntdq %%xmm5, 32(%0) \n\t" /*ov[x4+2]*/ "movdqa %%xmm6, %%xmm5 \n\t" "punpckhbw %%xmm2, %%xmm5 \n\t" "movntdq %%xmm5, 48(%0) \n\t" /*ov[x4+3]*/ "addl $64, %0 \n\t" "movdqa %%xmm4, %%xmm5 \n\t" "punpcklbw %%xmm1, %%xmm5 \n\t" "movntdq %%xmm5, (%1) \n\t" /*ov2[x4]*/ "punpckhbw %%xmm1, %%xmm4 \n\t" "movntdq %%xmm4, 16(%1) \n\t" /*ov2[x4+1]*/ "movdqa %%xmm6, %%xmm5 \n\t" "punpcklbw %%xmm3, %%xmm5 \n\t" "movntdq %%xmm5, 32(%1) \n\t" /*ov2[x4+2]*/ "punpckhbw %%xmm3, %%xmm6 \n\t" "movntdq %%xmm6, 48(%1) \n\t" /*ov2[x4+3]*/ "addl $64, %1 \n\t" "decl %6 \n\t" "jnz 0b \n\t" : "+r" (ov), "+r" (ov2), "+r" (yv), "+r" (yv2), "+r" (uv), "+r" (vv), "+m"(vWidth_) : : "memory", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6" ); #else for (x = 0; x < vWidth; x++) { int x2 = x*2, x4 = x*4; __m128i tmp_y = yv[x2], tmp_y3 = yv[x2+1], tmp_y2 = yv2[x2], tmp_y4 = yv2[x2+1], tmp_u = _mm_loadu_si128(&uv[x]), tmp_v = _mm_loadu_si128(&vv[x]), chroma_l = _mm_unpacklo_epi8(tmp_u, tmp_v), chroma_h = _mm_unpackhi_epi8(tmp_u, tmp_v); _mm_stream_si128(&ov[x4], _mm_unpacklo_epi8(chroma_l, tmp_y)); _mm_stream_si128(&ov[x4+1], _mm_unpackhi_epi8(chroma_l, tmp_y)); _mm_stream_si128(&ov[x4+2], _mm_unpacklo_epi8(chroma_h, tmp_y3)); _mm_stream_si128(&ov[x4+3], _mm_unpackhi_epi8(chroma_h, tmp_y3)); _mm_stream_si128(&ov2[x4], _mm_unpacklo_epi8(chroma_l, tmp_y2)); _mm_stream_si128(&ov2[x4+1],_mm_unpackhi_epi8(chroma_l, tmp_y2)); _mm_stream_si128(&ov2[x4+2],_mm_unpacklo_epi8(chroma_h, tmp_y4)); _mm_stream_si128(&ov2[x4+3],_mm_unpackhi_epi8(chroma_h, tmp_y4)); } #endif for (x=vWidth * 16; x < halfwidth; x++) { int x4 = x*4, x2 = x*2; o2[x4] = o[x4] = uc[x]; x4++; o [x4] = yc[x2], o2[x4] = yc2[x2]; x4++; o2[x4] = o[x4] = vc[x]; x4++, x2++; o [x4] = yc[x2], o2[x4] = yc2[x2]; } o += outRB*2; yc += rY*2; uc += rUV; vc += rUV; } HandleLastRow(o, yc, uc, vc, halfwidth, height); *N += 1; } static FASTCALL void Y420toY422_x86_scalar(AVPicture *picture, uint8_t *o, int outRB, int width, int height, unsigned long *N) { uint8_t *yc = picture->data[0], *u = picture->data[1], *v = picture->data[2]; int rY = picture->linesize[0], rUV = picture->linesize[1]; int halfheight = height >> 1, halfwidth = width >> 1; int y, x; for (y = 0; y < halfheight; y ++) { uint8_t *o2 = o + outRB, *yc2 = yc + rY; for (x = 0; x < halfwidth; x++) { int x4 = x*4, x2 = x*2; o2[x4] = o[x4] = u[x]; o [++x4] = yc[x2]; o2[x4] = yc2[x2]; x4++; o2[x4] = o[x4] = v[x]; o [++x4] = yc[++x2]; o2[x4] = yc2[x2]; } o += outRB*2; yc += rY*2; u += rUV; v += rUV; } HandleLastRow(o, yc, u, v, halfwidth, height); *N += 1; } From rjvbertin at gmail.com Fri Feb 15 11:37:41 2013 From: rjvbertin at gmail.com (=?ISO-8859-1?Q?Ren=E9_J=2EV=2E_Bertin?=) Date: Fri, 15 Feb 2013 11:37:41 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: <6c7553e4-625c-453e-999a-efe3a3e23d57@email.android.com> >Everything prefixed with ff are private symbols in ffmpeg, and as such >are not supposed to be exposed in link libraries, because they are not >part of the public API/ABI. >There are already too many exceptions to this, and this avoided even >more. This pleads for static local copies. BTW, would there be much overhead in declaring ff_log2_tab locally in each function that uses it, with current day compilers? R From rjvbertin at gmail.com Fri Feb 15 11:41:58 2013 From: rjvbertin at gmail.com (=?ISO-8859-1?Q?Ren=E9_J=2EV=2E_Bertin?=) Date: Fri, 15 Feb 2013 11:41:58 +0100 Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P In-Reply-To: <1360883819.97816.YahooMailNeo@web161401.mail.bf1.yahoo.com> References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> <1360883819.97816.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: Chris Share wrote: >Thanks for the sample code. > >I have a couple of further questions: > >1. If the input data is in a vector of unsigned chars (RGBRGB...), what >is the best pixel format to use? I think that'd by FMT_RGB24 . R From lars.hammarstrand at gmail.com Fri Feb 15 11:54:50 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 15 Feb 2013 11:54:50 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <6c7553e4-625c-453e-999a-efe3a3e23d57@email.android.com> References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> <6c7553e4-625c-453e-999a-efe3a3e23d57@email.android.com> Message-ID: 2013/2/15 Ren? J.V. Bertin > > This pleads for static local copies. > > Yeah, this is what I would suggest too. If the objective is to have portable static libraries, don't define global symbol multiple times, it's just the wrong way of working. This is especially true for static libraries in runtime environments like 64 bit OSX and iOS that requires the -all_load flag. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Fri Feb 15 12:21:12 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 15 Feb 2013 12:21:12 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: <1B3EAC00-DE5A-433C-86E1-0D00615F169B@gmail.com> References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> <1B3EAC00-DE5A-433C-86E1-0D00615F169B@gmail.com> Message-ID: 2013/2/14 "Ren? J.V. Bertin" > Since you clearly have the your-ended problem of working in a context > where multiple ff_log2_tabs bite, I suggest the open libavutil/intmath.h , > and on line 53 or so you replace > > extern const uint8_t ff_log2_tab[256]; > > by > > static const uint8_t ff_log2_tab[256]={ ... > > and of course you comment out the identical definition in log2_tab.c . > > Thanks, great work! i'll try that in the next build! /Regards, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From klaussfreire at gmail.com Fri Feb 15 16:33:48 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Fri, 15 Feb 2013 12:33:48 -0300 Subject: [Libav-user] a little performance/optimisation headbreaker :) In-Reply-To: References: Message-ID: On Fri, Feb 15, 2013 at 6:37 AM, "Ren? J.V. Bertin" wrote: > On my 2.7Ghz dual-core i7 MBP, I get about 10000Hz for the SSE version, and roughly half that for the generic, scalar function, using gcc-4.2 as well as using MSVC 2010 Express running under WinXP in VirtualBox. The factor 2 speed gain for SSE code also applies on 2 AMD machines (mid-end laptop and C62 netbook). > > Then I installed a new mingw32 cross-compiler based on gcc 4.7 and for the heck of it compiled my benchmark with it ... and found same factor 2 ... but in favour of the scalar code, on my i7 . It's more like a factor 2.5, actually. Same thing after installing the native OS X gcc 4.7 version. > > The question: is gcc-4.7 clever enough to do a better optimisation of the 2nd benchmark loop than the 1st loop, or does it really generate so much better assembly from the scalar function? NB, -fno-inline-functions has no effect here. gcc 4.7 is clever enough to generate SSE code by itself. Maybe that's what you're experiencing. I guess compiler flags do matter too. Have you inspected the generated assembly code? gcc -S should tell you exactly the difference between the two loops, and I found it a very informative exercise to inspect it when something goes hinky performance-wise. Especially since you've used inline assembler for gcc, which tends to inhibit many of its other optimizations. Why don't you try gcc's vector primitives instead? From rjvbertin at gmail.com Fri Feb 15 16:48:13 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Fri, 15 Feb 2013 16:48:13 +0100 Subject: [Libav-user] a little performance/optimisation headbreaker :) In-Reply-To: References: Message-ID: <65AC6FC3-0F52-4F63-A72F-C54C3F607140@gmail.com> Thanks, Claudio! On Feb 15, 2013, at 16:33, Claudio Freire wrote: > gcc 4.7 is clever enough to generate SSE code by itself. Maybe that's > what you're experiencing. I guess compiler flags do matter too. I haven't compiled with -ftree-vectorize (rather, I tried with and without, made no difference), but you're right ... -fno-tree-vectorize gets me back to the 2x faster performance of the hand-coded SSE version. Amazing, I never really saw a lot of benefit to the tree-vectoriser before! If it wasn't clear, I didn't hand code the SSE version myself, so comparing the versions will be like looking for the relative differences between the works of 2 post-modern art schools ;) I've run the code through Shark, though, and that showed a clear load difference in disfavour of the SSE version. > gcc, which tends to inhibit many of its other optimizations. Why don't > you try gcc's vector primitives instead? Which ones? As in the few lines with intrinsics for MSVC, which also compile under gcc but shows no speed dis/advantage with gcc ? BTW, this does beg the question why ffmpeg's build process uses -fno-tree-vectorize ... maybe that's no longer required for today's compilers? R. From klaussfreire at gmail.com Fri Feb 15 17:08:24 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Fri, 15 Feb 2013 13:08:24 -0300 Subject: [Libav-user] a little performance/optimisation headbreaker :) In-Reply-To: <65AC6FC3-0F52-4F63-A72F-C54C3F607140@gmail.com> References: <65AC6FC3-0F52-4F63-A72F-C54C3F607140@gmail.com> Message-ID: On Fri, Feb 15, 2013 at 12:48 PM, "Ren? J.V. Bertin" wrote: > On Feb 15, 2013, at 16:33, Claudio Freire wrote: > >> gcc, which tends to inhibit many of its other optimizations. Why don't >> you try gcc's vector primitives instead? > > Which ones? Well, you specify "memory" so it will inhibit all redundant load optimizations, and probably play havoc with aliasing too, so it will hurt code performance all around it most certainly. > As in the few lines with intrinsics for MSVC, which also compile under gcc but shows no speed dis/advantage with gcc ? SSE intrinsics (and automatic vectorization in fact) perform a lot more poorly if you don't use __builtin_assume_aligned[0] [0] http://gcc.gnu.org/projects/tree-ssa/vectorization.html#assume-aligned From rjvbertin at gmail.com Fri Feb 15 17:12:17 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Fri, 15 Feb 2013 17:12:17 +0100 Subject: [Libav-user] a little performance/optimisation headbreaker :) In-Reply-To: References: <65AC6FC3-0F52-4F63-A72F-C54C3F607140@gmail.com> Message-ID: <5AE65D8C-4DA4-4704-87AD-03D6AC42CA86@gmail.com> On Feb 15, 2013, at 17:08, Claudio Freire wrote: > > SSE intrinsics (and automatic vectorization in fact) perform a lot > more poorly if you don't use __builtin_assume_aligned[0] > > > [0] http://gcc.gnu.org/projects/tree-ssa/vectorization.html#assume-aligned Ah, of course ... but OS X memory allocators are guaranteed to return pointers that are aligned properly for SSE intrinsics, IIRC. And I presume that since FFmpeg uses intrinsics quite extensively, its allocators also do this (on platforms where it's not already the case)... Thanks for the link! R. From lars.hammarstrand at gmail.com Fri Feb 15 17:26:05 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 15 Feb 2013 17:26:05 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> <1B3EAC00-DE5A-433C-86E1-0D00615F169B@gmail.com> Message-ID: 2013/2/15 Lars Hammarstrand > 2013/2/14 "Ren? J.V. Bertin" > >> Since you clearly have the your-ended problem of working in a context >> where multiple ff_log2_tabs bite, I suggest the open libavutil/intmath.h , >> and on line 53 or so you replace >> >> I'm kind of lazy so I used a slightly different solution. First I placed ff_log2_tab in libavutil/intmath.c and then I added "extern const uint8_t ff_log2_tab[256]" to libavutil/log2_tab.c, which meant I only had to change two files ;-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From peper03 at yahoo.com Fri Feb 15 22:17:50 2013 From: peper03 at yahoo.com (Richard) Date: Fri, 15 Feb 2013 22:17:50 +0100 Subject: [Libav-user] Passing DVD NAV packets to demuxer In-Reply-To: <1360581531.11991.YahooMailClassic@web125603.mail.ne1.yahoo.com> References: <1360581531.11991.YahooMailClassic@web125603.mail.ne1.yahoo.com> Message-ID: <511EA5FE.5020301@yahoo.com> On 11/02/13 12:18, peper03 at yahoo.com wrote: > Hi, > > Is there a 'correct' way to pass DVD NAV packets back to a demuxer? At the moment, we're calling 'av_read_frame', which eventually lands in a function which interfaces with libdvdnav to retrieve the DVD packets. The DVD NAV packets contain private streams (start code 0x1bf), which are explicitly filtered out by mpegps_read_pes_header. > > So is there a way to get these packets back to the demuxer keeping them in-sync with the 'normal' packets? > > Apologies if there is an obvious solution to this. I'm very new to this code. I've hunted round but not found an answer. In case it makes it any clearer, I'm talking about packets with start code 0x1bf (PRIVATE_STREAM_2). These packets are explicitly skipped in mpegps_read_pes_header() but I don't really understand why as they are chock-full of metadata and can always be ignored by the caller if they're really not interested. I'd be very grateful for any information on this subject as it's incredibly difficult to pass these packets back via any other route and re-sync them with the other packets. Richard. From cmst at live.com Fri Feb 15 01:53:07 2013 From: cmst at live.com (Dolevo Jay) Date: Fri, 15 Feb 2013 00:53:07 +0000 Subject: [Libav-user] inttypes.h confusion Message-ID: Hi all, I am currently using avcodec to decode my stream. As you all know, you need to point to the right inttypes.h in order avcodec to be working well. Therefore, I have put the inttypes.h under /include folder and include this folder in my project. This works great on Windows. However, I need to build my code in linux now. When I try to compile my code as it is in Windows, it gives an error about "_inline". When I comment the include path, meaning that no include inttypes.h, the code compiles but crashes when opening the codec. I guess, when I comment the include path, the compiler takes the inttypes.h in the system folder which is causing the crash. Could you please guide me how I can set this perfectly? How can I separate the inttypes.h in the system and the inttypes.h that I want to include. Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From halonso at vpod.tv Fri Feb 15 09:26:49 2013 From: halonso at vpod.tv (Hector Alonso) Date: Fri, 15 Feb 2013 09:26:49 +0100 Subject: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to AV_PIX_FMT_YUV420P In-Reply-To: <1360883819.97816.YahooMailNeo@web161401.mail.bf1.yahoo.com> References: <1360832432.21428.YahooMailNeo@web161401.mail.bf1.yahoo.com> <1360883819.97816.YahooMailNeo@web161401.mail.bf1.yahoo.com> Message-ID: There's not a better type, it depends on the whole system. For instance, that's a part of a video capture utility. I recieve the "ptBuffer", or the source image, in YUV422 (which is a very common pixel format in capture cards and video cameras). I do the rescale as well as the pixel format conversion (using pixel shaders) in the GPU, this was a quick test I made... You have to identify your pixel format and your data structure and convert it to the desired one. A part from the pixel format (RGB, BGR, RGBA, ...) you need to know whether it's planar (RRR....GGGG....BBBB) or linear (RGBRGBRGB....). The pixel format descriptors also include this information (represented as a "P" at the end), you should check the documentation. In your case: AV_PIX_FMT_RGB24 ---> RGBRGBRGB... AV_PIX_FMT_YUV420P ----> YYYYYY.....UUUUUUUU........VVVVVVVVV....... If you use my function to make the conversion it allocates the structure for you. Check the linesizes of the resulting picture for a better understanding of what's going on. On Fri, Feb 15, 2013 at 12:16 AM, Chris Share wrote: > Thanks for the sample code. > > I have a couple of further questions: > > 1. If the input data is in a vector of unsigned chars (RGBRGB...), what is > the best pixel format to use? > > 2. The input data is represented by the following method parameter: void* > ptInData - I'm not clear as to how the vector is converted to an > appropriate type - should it be an array of chars (RGBRGB...) or does the > data need to be arranged differently (RRR...GGG...BBB...)? > > Cheers, > > Chris > > ________________________________ > From: Hector Alonso > To: "This list is about using libavcodec, libavformat, libavutil, > libavdevice and libavfilter." > Sent: Thursday, 14 February 2013 8:38 PM > Subject: Re: [Libav-user] How to Convert AV_PIX_FMT_RGB24 to > AV_PIX_FMT_YUV420P > > > Hi Chris, > > You can implement some kind of function like: > > // dependencies into C++ > extern"C"{ > #include > #include > #include > #include > #include > } > > /** > *Thisfunctionconvertsanimage(uncompressedbuffer)fromaninput > *specifiedpixelformattoanoutputspecifiedpixelformatandbuffer. > *dependenciesLibAV. > *@param[in]eInFormatinputimagePixelformat at seeLibaAVPixelFormatenumtype. > *@param[in]iInWidthinputimagewidth > *@param[in]iInHeightinputimageheight > *@param[in]ptInDatainputimagebuffer > *@param[in]eOutFormatoutputimagePixelformat at seeLibaAVPixelFormatenumtype. > *@param[in]iOutWidthoutputimagewidth > *@param[in]iOutHeightoutputimageheight > *@param[out]srcoutputimagebuffer > *@returntrueifeverythingwascorrect,falseotherwise) > **/ > > boolConvertImage1(PixelFormateInFormat,intiInWidth,intiInHeight,void*ptInData,PixelFormateOutFormat,intiOutWidth,intiOutHeight,AVPicture*src) > { > SwsContext*ptImgConvertCtx;// Frame conversion context > > AVPictureptPictureIn; > uint8_t*ptBufferIn; > > //Initialize convert context > //------------------ > ptImgConvertCtx=sws_getContext(iInWidth,iInHeight,eInFormat,// (source > format) > iOutWidth,iOutHeight,eOutFormat,// (dest format) > SWS_BICUBIC,NULL,NULL,NULL); > > // Init input frame: > //------------------ > // Allocate an AVFrame structure > > > // Determine required buffer size and allocate buffer > // int iNumBytesIn=avpicture_get_size(eInFormat, iInWidth,iInHeight); > > ptBufferIn=(uint8_t*)(ptInData); > > // Assign appropriate parts of buffer to image planes in pFrameOut > avpicture_fill(&ptPictureIn,ptBufferIn,eInFormat,iInWidth,iInHeight); > > // Do conversion: > //------------------ > intiRes=sws_scale(ptImgConvertCtx, > ptPictureIn.data,//src > ptPictureIn.linesize, > 0, > iInHeight, > src->data,//dst > src->linesize); > > > //Free memory > sws_freeContext(ptImgConvertCtx); > > //Check result: > if(iRes==iOutHeight) > returntrue; > > returnfalse; > } > > And use it like this (in this example is used to downscale, but you can > use it for rescaling and or pixel format conversions) > > // Downscale > AVPicturesrc; > intiWidth=m_ptCurrentVideoMode->getWidth()/DL_LOW_DEFINITION_DEN; > > intiHeight=(m_ptCurrentVideoMode->getHeight()*iWidth)/m_ptCurrentVideoMode->getWidth(); > iWidth=(floor(iWidth/2))*2; > iHeight=(floor(iHeight/2))*2; > > avpicture_alloc(&src,AV_PIX_FMT_UYVY422,iWidth,iHeight); > > if(!ConvertImage1(AV_PIX_FMT_UYVY422, > m_ptCurrentVideoMode->getWidth(), > m_ptCurrentVideoMode->getHeight(), > (void*)ptBuffer, > AV_PIX_FMT_UYVY422, > iWidth,iHeight, > &src)) > { > avpicture_free(&src); > return; > } > > // ... whatever ... > > // Free aux frame > avpicture_free(&src); > I hope it helps! > > > On Thu, Feb 14, 2013 at 10:00 AM, Chris Share wrote: > > Hi, > > > >I'm currently trying to implement file export for the open source > animation program Pencil2D. This involves converting RGB (0 - 255) image > data to a suitable movie format. > > > >The examples in the source tree have been very helpful however I still > have some questions: > > > >The scaling_video.c is close to what I need however the conversion is the > opposite of what I want. What I'm not clear about is how to change the > "fill_yuv_image" function to something like "fill_rgb_image". How does the > RGB data get written into the "uint8_t *data[4]"? Is it written > consecutively (all R values get written to data[0], all G values to > data[1], etc.)? > > > >Cheers, > > > >Chris > >_______________________________________________ > >Libav-user mailing list > >Libav-user at ffmpeg.org > >http://ffmpeg.org/mailman/listinfo/libav-user > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shashi580 at gmail.com Sat Feb 16 07:07:17 2013 From: shashi580 at gmail.com (Shashi Bhushan) Date: Sat, 16 Feb 2013 11:37:17 +0530 Subject: [Libav-user] Need Help for convert Audio output with video processing using ffmpeg vc++2010 Message-ID: Hello Friends, Good Morning. Trust doing fine. I am developing a application that convert one video to another including sound (means in source file has video as well as sound) with the help of FFMPEG Library I have created a video. But sound is not available in converted video. so please help me how can i fix this issue. I am sending You link . FFmpeg not honoring bitrate for different containers? i have used this code for doing my work but sound is not available so please help my how can we handle this situation. If any one has sample please share it. I am using vc++2010. Thanks for your cooperation Waiting your response. Regards Shashi Bhushan -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.george at normalesup.org Sat Feb 16 10:35:28 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Sat, 16 Feb 2013 10:35:28 +0100 Subject: [Libav-user] inttypes.h confusion In-Reply-To: References: Message-ID: <20130216093528.GA4932@phare.normalesup.org> Le septidi 27 pluvi?se, an CCXXI, Dolevo Jay a ?crit?: > I am currently using avcodec to decode my stream. As you all > know, you need to point to the right inttypes.h in order avcodec to be > working well. What? I do not who "all know" this, but it does not include many active ffmpeg developers. inttypes.h is a standard C header, it is supposed to come with your compiler and you are not expected to do anything with it. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From jmorgie at yahoo.com Sat Feb 16 22:50:59 2013 From: jmorgie at yahoo.com (jim morgenstern) Date: Sat, 16 Feb 2013 16:50:59 -0500 Subject: [Libav-user] Ordinal 139 could not be located in swscale-2.dll Message-ID: <00bf01ce0c8f$b5343fc0$1f9cbf40$@yahoo.com> Running Win 7, VS2010; just upgraded ffmpeg library to ffmpeg-1.1.1 win 32 dev for libraries and win32-shared for dlls. Ran my program under debug mode and it runs fine. Changed to Release mode, recompiled all and tried to run. Immediately I get the error message Ordinal 139 could not be located in swscale-2.dll Using same dlls [well, I copied them over from Debug folder to Release folder. Twice] as when I ran in Debug mode. Any clues? This one has me stumped. Jim Morgenstern Image Mining LLC 248-252-2626 -------------- next part -------------- An HTML attachment was scrubbed... URL: From phpdev at ehrhardt.nl Sun Feb 17 01:02:18 2013 From: phpdev at ehrhardt.nl (Jan Ehrhardt) Date: Sun, 17 Feb 2013 01:02:18 +0100 Subject: [Libav-user] Ordinal 139 could not be located in swscale-2.dll References: <00bf01ce0c8f$b5343fc0$1f9cbf40$@yahoo.com> Message-ID: jim morgenstern in gmane.comp.video.ffmpeg.libav.user (Sat, 16 Feb 2013 16:50:59 -0500): >Running Win 7, VS2010; just upgraded ffmpeg library to ffmpeg-1.1.1 win 32 >dev for libraries and win32-shared for dlls. > >Ran my program under debug mode and it runs fine. Changed to Release mode, >recompiled all and tried to run. Immediately I get the error message >Ordinal 139 could not be located in swscale-2.dll > >Using same dlls [well, I copied them over from Debug folder to Release >folder. Twice] as when I ran in Debug mode. Did you recompile with shared libraries? Then you should use the newly created dll's and not those from the debug release. Jan From joris.valette at gmail.com Sun Feb 17 15:24:49 2013 From: joris.valette at gmail.com (Joris VALETTE) Date: Sun, 17 Feb 2013 15:24:49 +0100 Subject: [Libav-user] Maybe about an MVC decoder In-Reply-To: References: Message-ID: >Because you did not send a patch yet. Well I'd love to, but I'm a newbie with h.264 at the moment, and I'm discovering the decoder implementation step by step. You didn't answer my question, why hasn't MVC been done yet ? Is it because no one has really been interested in doing it ? Is it too hard ? Is it because stereo player aren't mainstream as for today ? Don't take it agressively, these are naive questions from a novice user of libav. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sun Feb 17 16:52:20 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 17 Feb 2013 15:52:20 +0000 (UTC) Subject: [Libav-user] Need Help for convert Audio output with video processing using ffmpeg vc++2010 References: Message-ID: Shashi Bhushan writes: > I am?developing?a application that convert one > video to another including sound (means in source > file has video as well as sound) with the help of > FFMPEG?Library? I have created a video. But sound > is not?available?in converted video. so please > help me how can i fix this issue. Is the problem you see also reproducible with ffmpeg (the application) or only with your own application? Carl Eugen From cehoyos at ag.or.at Sun Feb 17 19:13:48 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 17 Feb 2013 18:13:48 +0000 (UTC) Subject: [Libav-user] Maybe about an MVC decoder References: Message-ID: Joris VALETTE writes: > >Because you did not send a patch yet. > > Well I'd love to, but I'm a newbie with h.264 at the moment, > and I'm discovering the decoder implementation step by step. > You didn't answer my question, why hasn't MVC been done yet ? Please don't take it aggressively (either), but above is the answer. I suspect you don't know exactly how open-source works, an important factor (at least in the case of FFmpeg) is that people see a missing feature (or bug), they implement it and send a patch to ffmpeg-devel. (It should of course be mentioned that in the case of MVC, there are some issues that probably make implementing it more difficult that let's say VP7, so it is probably a very bad idea to start working on FFmpeg with MVC...) [...] > Is it because stereo player aren't mainstream as for today ? MPlayer should support stereo streams (but you may need an extremely expensive Nvidia graphic card). Carl Eugen From cehoyos at ag.or.at Sun Feb 17 19:16:36 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 17 Feb 2013 18:16:36 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: Lars Hammarstrand writes: > Ive posted a patch to ffmpeg-dev, which may fix this: > 0213 19:51 To FFmpeg devel (3.0K) [FFmpeg-devel] > [PATCH] buildsys: only include log2_tab per library for shared builds > please test and comments welcome Could one of you (who is affected by the problem, remember that it cannot be reproduced on same environments) please test mentioned patch? Your problem unfortunately will not be fixed as long as you don't comment on the patch;-( Carl Eugen From danchami at hotmail.com Mon Feb 18 07:11:25 2013 From: danchami at hotmail.com (Danny Chami) Date: Mon, 18 Feb 2013 17:11:25 +1100 Subject: [Libav-user] MPEG-TS Container with 1 Elementary Stream In-Reply-To: References: Message-ID: Hi, I am trying to pack a single audio (AAC) elementary stream into an MPEG-TS stream over UDP. I used the muxing.c example (http://ffmpeg.org/doxygen/1.0/muxing_8c-source.html) as a starting point, and I have managed to get H264 and AAC ES streams packed into an MPEGTS and transported over UDP and picked up by VLC / FFMPEG on the other end without any issues. However, when I tried to pack only 1 single Audio stream (AAC) with no Video, I am struggling to make it to work. Done some research and I saw that I still need to add the video stream to the output context (even if I don't write any video frames) and that I need to change av_interleaved_write_frame to av_write_frame so audio frames are not waiting for video frame timestamps.. still no luck. Does anyone have sample code that can help me get started with MPEGTS with only 1 audio ES? Thanks, Danny -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Mon Feb 18 11:37:53 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 18 Feb 2013 11:37:53 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: On Feb 17, 2013, at 19:16, Carl Eugen Hoyos wrote: > > Could one of you (who is affected by the problem, > remember that it cannot be reproduced on same > environments) please test mentioned patch? > > Your problem unfortunately will not be fixed as > long as you don't comment on the patch;-( I'm not sure if you counted me among the affected people, but in fact I'm not. The static libraries I'm using for one of my projects are from an old FFmpeg version which predated the 'hack' that's biting Lars. And I've already commented on the patch. Myself I'd treat ff_log2_tab as its ff_ prefix imposes: have a static copy per library (or even module). It's small enough for that, and at least that approach doesn't introduce (another) dependency on the library in which the symbol is defined (libavutil I presume). It also does not increase the complexity of the configure process, nor add yet more conditional code. Simply replace log2_tab.c by log2_tab.h in which ff_log2_tab is declared as a static array, and include that header in every file where the constant is used. I must say that I'm a little bit surprised by the "we can't reproduce it here" attitude. Of course you can't validate the code on all hardware/software combinations, but I'd hope that you do check the shared libraries on a number of scenarios outside linking to ffmpeg, ffprobe etc. Anyway, I'm pretty sure that you're likely to encounter the same problem creating a monolithic shared library from the static libraries of, say, lavc, lavf and lavu . Because in doing that, the linker has to pull in every member of those static libraries (exactly as does the -all_load argument), and thus encounter the multiple definitions of ff_log2_tab . Ren? From cehoyos at ag.or.at Mon Feb 18 11:53:57 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Feb 2013 10:53:57 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: Ren? J.V. Bertin writes: > On Feb 17, 2013, at 19:16, Carl Eugen Hoyos wrote: > > > > Could one of you (who is affected by the problem, > > remember that it cannot be reproduced on same (this should have been "sane") > > environments) please test mentioned patch? [...] > I'm not sure if you counted me among the affected > people, but in fact I'm not. Then I did not count you - of course only people who are affected by the problem can tell if the patch works for them or not. (Or in other words: If nobody wants to test the patch, the developers will assume that there is nobody for whom this problem is important and the developers will move on to other problems.) Carl Eugen From rjvbertin at gmail.com Mon Feb 18 13:53:52 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 18 Feb 2013 13:53:52 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: <7A2046D7-4A4E-4096-9DDA-1E49CAFDB759@gmail.com> On Feb 18, 2013, at 11:53, Carl Eugen Hoyos wrote: > (Or in other words: If nobody wants to test the > patch, the developers will assume that there is > nobody for whom this problem is important and the > developers will move on to other problems.) Which is understandable, though on the other hand it's no less an error. I'd hope the devs would correct the use of free() instead of av_free() in one of the example applications even if the person reporting the (latent) error is running linux or some other unix him/herself, and even if the probably majority of people getting a crash because they work on an OS like Win7 where this actually matters correct the error without giving feedback? ;) R. From lars.hammarstrand at gmail.com Mon Feb 18 21:03:43 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 18 Feb 2013 21:03:43 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: 2013/2/17 Carl Eugen Hoyos > > Could one of you (who is affected by the problem, > remember that it cannot be reproduced on same > environments) please test mentioned patch? > > Your problem unfortunately will not be fixed as > long as you don't comment on the patch;-( > > Hi, it's for 64-bit OSX and iOS that is requiring the -all_load or -force_load linker flag to function with static libraries: "Apparently there are some issues with ios 64-bit osx: " http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do ": *Important:* For 64-bit and iPhone OS applications, there is a linker bug that prevents -ObjC from loading objects files from static libraries that contain only categories and no classes. The workaround is to use the -all_load or -force_load flags" -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Mon Feb 18 21:10:27 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 18 Feb 2013 21:10:27 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: 2013/2/18 Lars Hammarstrand > 2013/2/17 Carl Eugen Hoyos > >> >> Could one of you (who is affected by the problem, >> remember that it cannot be reproduced on same >> environments) please test mentioned patch? >> >> Your problem unfortunately will not be fixed as >> long as you don't comment on the patch;-( >> >> > Hi, it's for 64-bit OSX and iOS that is requiring the -all_load or > -force_load linker flag to function with static libraries: > > "Apparently there are some issues with ios 64-bit osx: " > http://stackoverflow.com/questions/2906147/what-does-the-all-load-linker-flag-do > ": > > *Important:* For 64-bit and iPhone OS applications, there is a linker bug > that prevents -ObjC from loading objects files from static libraries that > contain only categories and no classes. The workaround is to use the > -all_load or -force_load flags" > Sorry, I forgot: thank you very much for taking care of this! /Regards, Lars. -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Mon Feb 18 23:22:14 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 18 Feb 2013 15:22:14 -0700 Subject: [Libav-user] Converting audio sample buffer format Message-ID: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> Hello, I am trying to stream (publish) flv video/audio from a client capturing video/audio on their machine using QTKit on Mac, using libavformat and libavcodec. I have the video streaming working, and actually the audio frames are streaming too, albeit the sound is distorted pretty much to white-noise on the other end. This is due to a mismatch between the format being output from QTKit when captured, and the format needed by libavcodec for flv. QTKit's QTSampleBuffer info: Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz Sample buffers being received from QTKit contain 512 samples, and have a buffer of 4096 in length. The libavcodec flv audio codec: audioCodecCtx->bit_rate = 64000; audioCodecCtx->sample_rate = 44100; audioCodecCtx->channels = 2; audioCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16; audioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO; Note that the flv codec doesn't seem to like changing the sammple format to AV_SAMPLE_FMT_S32 -- apparently isn't supported. So I think it is pretty clear that data coming in needs to be converted to the format expected by the codec. Can someone assist me in how to go about converting the QT data received into a format that can be used in flv encoding? Your guidance is appreciated. Thanks, Brad From cehoyos at ag.or.at Mon Feb 18 23:50:11 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Feb 2013 22:50:11 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > Note that the flv codec While I have _no_ idea what the "flv audio codec" could be, please use either the aconvert filter or libswresample directly to convert from one audio format to another. Carl Eugen From brado at bighillsoftware.com Tue Feb 19 00:12:54 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 18 Feb 2013 16:12:54 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> Message-ID: <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: >> Note that the flv codec > > While I have _no_ idea what the "flv audio codec" could > be, please use either the aconvert filter or libswresample > directly to convert from one audio format to another. Perhaps this was a misuse of terms, but my intent in specifying that was to indicate the audio codec which is either tethered to or influenced by the flv video codec or stream. When creating an output context to address flv format as such: const char *cFileNameExt = [@"flv" UTF8String]; const char *cMimeType = [@"video/x-flv" UTF8String]; _avOutputFormat = av_guess_format(cStreamName, cFileNameExt, cMimeType); If I then create an audio stream on the associated output format (context), any attempt to open an audio codec with a sample format other than AV_SAMPLE_FMT_S16 fails. That would lead me to believe that something about having an FLV output format is restricting the audio codec to that sample format -- otherwise, I would think that any sample format could be used. That may or may not be true, but that is what my meaning was when saying "flv audio codec"...I should have probably said the "sample format compatible with flv". That said, thank you for your recommendation. I have found the resampling_audio.c in the FFmpeg source examples which appear to address libswresample, and I have found the filter_audio.c -- it would appear to be an aconvert example -- but if there's more doc somewhere on aconvert, I'd be interested in knowing where....that would be great. One final question -- what essentially is the difference in approach between aconvert filter and libswresample, and why would I want to use one over the other? Does it matter? Thanks, Brad From cehoyos at ag.or.at Tue Feb 19 00:43:08 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 18 Feb 2013 23:43:08 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > I have found the resampling_audio.c in the FFmpeg > source examples which appear to address libswresample, > and I have found the filter_audio.c -- it would appear > to be an aconvert example -- but if there's more doc > somewhere on aconvert, I'd be interested in knowing > where....that would be great. The relevant sample code for the filter is in doc/examples/filtering_audio.c > One final question -- what essentially is the > difference in approach between aconvert filter > and libswresample The aconvert audio filter uses libswresample for conversions, it may depend on your use case if you prefer the filter or the library. Carl Eugen From valentinoffner at free.fr Tue Feb 19 09:22:09 2013 From: valentinoffner at free.fr (valentinoffner at free.fr) Date: Tue, 19 Feb 2013 09:22:09 +0100 (CET) Subject: [Libav-user] Demuxers and probing In-Reply-To: <2145950743.138494701.1361262125563.JavaMail.root@zimbra62-e11.priv.proxad.net> Message-ID: <1013275021.138494878.1361262129159.JavaMail.root@zimbra62-e11.priv.proxad.net> Hi, I'm actually working on Libavformat for an internship and i have one question. I'd to integrate 2 specific-demuxers (audio et video) in libavformat, i didn't have to code them so I did it without any problem. But now, if i try to open a specific audio file, both demuxers send AVPROBE_SCORE_MAX and probing fails : Command line: "d:\\Projet\\ffmpeg\\ffprobe.exe" ../audiofile.00 -report ffprobe version 1.1.git Copyright (c) 2007-2013 the FFmpeg developers built on Feb 18 2013 15:44:34 with gcc 4.7.1 (tdm-1) configuration: --prefix=buildCCC libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.102 / 54. 91.102 libavformat 54. 62.100 / 54. 62.100 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 37.101 / 3. 37.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 audio probe: recognized NG format. -- v1.1.1.4 video probe: recognized NG format. -- v1.1.1.4 ? (8 times) audio probe: recognized NG format. -- v1.1.1.4 video probe: recognized NG format. -- v1.1.1.4 [AVIOContext @ 003f2e20] Statistics: 1048576 bytes read, 0 seeks ../audiofile.00: Invalid data found when processing input So, my questions are : -my problem can come from other thing that this 2 demuxers ? -what happen if 2 demuxers get same score ? I've to recode demuxers to get 2 different scores or ffprobe can choose one of them ? Thank you for the answer ! From cehoyos at ag.or.at Tue Feb 19 10:44:50 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 19 Feb 2013 09:44:50 +0000 (UTC) Subject: [Libav-user] Demuxers and probing References: <2145950743.138494701.1361262125563.JavaMail.root@zimbra62-e11.priv.proxad.net> <1013275021.138494878.1361262129159.JavaMail.root@zimbra62-e11.priv.proxad.net> Message-ID: writes: > But now, if i try to open a specific audio file, > both demuxers send AVPROBE_SCORE_MAX I believe this indicates that your probing functions are broken (ie: This should not happen). [...] > So, my questions are : > -my problem can come from other thing that this 2 demuxers ? > -what happen if 2 demuxers get same score ? Same score is not necessarily a problem, but if one demuxer returns MAX on probing, probing stops afair (so the other demuxer that would also return MAX is never probed). > I've to recode demuxers to get 2 different scores > or ffprobe can choose one of them ? You can force a demuxer from the command line. Carl Eugen From valentinoffner at free.fr Tue Feb 19 11:16:38 2013 From: valentinoffner at free.fr (valentinoffner at free.fr) Date: Tue, 19 Feb 2013 11:16:38 +0100 (CET) Subject: [Libav-user] Demuxers and probing In-Reply-To: Message-ID: <1325581653.138850984.1361268998663.JavaMail.root@zimbra62-e11.priv.proxad.net> ----- Mail original ----- De: "Carl Eugen Hoyos" > writes: > >> But now, if i try to open a specific audio file, >> both demuxers send AVPROBE_SCORE_MAX > >I believe this indicates that your probing functions >are broken (ie: This should not happen). > >[...] > >> So, my questions are : >> -my problem can come from other thing that this 2 demuxers ? > >> -what happen if 2 demuxers get same score ? > >Same score is not necessarily a problem, but if >one demuxer returns MAX on probing, probing stops >afair (so the other demuxer that would also return >MAX is never probed). > >> I've to recode demuxers to get 2 different scores >> or ffprobe can choose one of them ? > >You can force a demuxer from the command line. > >Carl Eugen Thanks for the answer ! I solved my problem in reading probe functions of both demuxers. First checked the 4x2 first Bytes and second only 4 first Bytes. So, i corrected this with good conditions and now : Audio demuxer answer for Audio, and Video for Video, and ffprobe/ffplay work fine. Thank you again. -- Valentin OFFNER From ferenc.mozes at integrasoft.ro Tue Feb 19 13:06:32 2013 From: ferenc.mozes at integrasoft.ro (Ferenc Mozes) Date: Tue, 19 Feb 2013 14:06:32 +0200 Subject: [Libav-user] Audio delay problem Message-ID: <51236AC8.9010403@integrasoft.ro> Hi all! I am relatively new to ffmpeg libraries and I ran into the following problem: as I am getting audio and video frames through two different streams, I am trying to write them into a container (mkv in my case) but I cannot identify when the audio stream has dropped some frames or when the frames are arriving correctly again. In the case of the video frames I had an information regarding the frame rate so I could easily repeat a key frame, in order to have a video that has a predefined length, in case of video frame loss. However, there is no information about "frame rate" in audio streams, as I understand. My question would be: is there any kind of mechanism or API function to figure this out and put the audio in sync with the video? I am using ffmpeg 0.8.12 and functions from the libavformat.h and libavcodec.h header files. Any solutions or ideas would be greatly appreciated! Kind regards, Ferenc Mozes From krueger at lesspain.de Tue Feb 19 15:33:21 2013 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Tue, 19 Feb 2013 15:33:21 +0100 Subject: [Libav-user] Processing packed YUV422 10 bit data (v210) with libav*/swscale Message-ID: Hi, I have to convert buffers that have been decoded using apple libraries that contain packed YUV422 10 bit data (v210) using libswscale. As I see it, there are no suitable packed pixel formats for that purpose or am I misreading pixfmt.h? Is there a workaround for that or is support for this pixel format planned? Thanks, Robert From onemda at gmail.com Tue Feb 19 15:49:26 2013 From: onemda at gmail.com (Paul B Mahol) Date: Tue, 19 Feb 2013 14:49:26 +0000 Subject: [Libav-user] Processing packed YUV422 10 bit data (v210) with libav*/swscale In-Reply-To: References: Message-ID: On 2/19/13, Robert Krueger wrote: > Hi, > > I have to convert buffers that have been decoded using apple libraries > that contain packed YUV422 10 bit data (v210) using libswscale. As I > see it, there are no suitable packed pixel formats for that purpose or > am I misreading pixfmt.h? Is there a workaround for that or is support > for this pixel format planned? It is available as decoder and works fine in containers. > > Thanks, > > Robert > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From krueger at lesspain.de Tue Feb 19 16:49:51 2013 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Tue, 19 Feb 2013 16:49:51 +0100 Subject: [Libav-user] Processing packed YUV422 10 bit data (v210) with libav*/swscale In-Reply-To: References: Message-ID: On Tue, Feb 19, 2013 at 3:49 PM, Paul B Mahol wrote: > On 2/19/13, Robert Krueger wrote: >> Hi, >> >> I have to convert buffers that have been decoded using apple libraries >> that contain packed YUV422 10 bit data (v210) using libswscale. As I >> see it, there are no suitable packed pixel formats for that purpose or >> am I misreading pixfmt.h? Is there a workaround for that or is support >> for this pixel format planned? > > It is available as decoder and works fine in containers. > OK, so if I wanted to process this further with swscale I would first use the decoder to decode it to AV_PIX_FMT_YUV422P10 and then use swscale if I wanted another format. Thanks for the quick reply! From cmst at live.com Tue Feb 19 13:06:21 2013 From: cmst at live.com (Dolevo Jay) Date: Tue, 19 Feb 2013 12:06:21 +0000 Subject: [Libav-user] Error in compilation Message-ID: Hi all, I am trying to build the libav with the following configuration: --disable-doc --disable-avserver --disable-avprobe --disable-avplay --disable-avconv --disable-encoders --disable-decoders --enable-decoder=h264 --disable-muxers --disable-demuxers --disable-parsers --disable-bsfs --disable-filters I am getting the following errors: | libavcodec/x86/h264_deblock.asm:818: error: (call_internal:3) `%ifdef' expects macro identifiers | libavcodec/x86/h264_deblock.asm:838: error: (call_internal:3) `%ifdef' expects macro identifiers | libavcodec/x86/h264_deblock.asm:878: error: (call_internal:3) `%ifdef' expects macro identifiers | libavcodec/x86/h264_deblock.asm:889: error: (call_internal:3) `%ifdef' expects macro identifiers | make: *** [libavcodec/x86/h264_deblock.o] Error 1 | libavcodec/x86/h264_deblock_10bit.asm:421: error: invalid combination of opcode and operands | libavcodec/x86/h264_deblock_10bit.asm:421: error: invalid combination of opcode and operands Could you please help about these errors? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From phamsyquybk at gmail.com Wed Feb 20 05:43:44 2013 From: phamsyquybk at gmail.com (Quy Pham Sy) Date: Wed, 20 Feb 2013 13:43:44 +0900 Subject: [Libav-user] How to get time stamp of closet k-frame before a given timestamp with ffmpeg? Message-ID: I want a ffmpeg seeking command that fast and accurate. I found this The solution is that we apply -ss for both input (fast seeking) and output (accurate seeking). The question is that if the input seeking is not accurate how can we be sure that the seeking position is accurate. For example: as the example used in the link, if we want to seek to 00:03:00, the command is something likes ffmpeg -ss 00:02:30 -i ... -ss 00:00:30 As said, the first seeking will seek to somewhere else not 00:02:30, say 00:02:31. and after applying second seek, the final result would be 00:03:01- NOT what we want. Is that correct? Where does fist seeking seek to? Does it seek to k-frame that closet to 00:02:30? If so, here is my thought, correct me if i'm wrong: after first seeking, we get the timestamp of the result (in this example: 00:02:31), then we apply second seeking with appropriate time, in this case 00:00:29. Question is how do we get time stamp of first seeking's result? Jack -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 20 09:59:37 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 20 Feb 2013 08:59:37 +0000 (UTC) Subject: [Libav-user] Error in compilation References: Message-ID: Dolevo Jay writes: > Hi all,I am trying to build the libav Please don't! avconv is known to contains hundreds of known bugs not present in FFmpeg, some of them security relevant, please understand that we cannot support it here. Please see http://ffmpeg.org/download.html for supported versions of FFmpeg. Carl Eugen From imrank at cdac.in Wed Feb 20 14:59:27 2013 From: imrank at cdac.in (Imran Khan) Date: Wed, 20 Feb 2013 19:29:27 +0530 (IST) Subject: [Libav-user] Using zeranoe libavcodec build in visual studio 2008 Message-ID: Hello All I am trying to use libavcoded shared build from zeranoe in visual studio 2008. I have tested my application using libavcodec in debug mode and it is running fine. but when i am trying to build the application through release version then it compiles fine but while running it is showing error as "The procedure entry point CoCreateInstance could not be located in the dynaminc link library avcodec-54.dll" Can any one please help me to solve this issue. -- Thanks and Regards Imran Khan Project Engineer CDAC Hyderabad ------------------------------------------------------------------------------------------------------------------------------- This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. ------------------------------------------------------------------------------------------------------------------------------- From shashi580 at gmail.com Wed Feb 20 15:21:14 2013 From: shashi580 at gmail.com (Shashi Bhushan) Date: Wed, 20 Feb 2013 19:51:14 +0530 Subject: [Libav-user] Using zeranoe libavcodec build in visual studio 2008 In-Reply-To: References: Message-ID: Hi, Good Evening. Trust doing fine. please send the code. i will try to solve it. Regards Shashi Bhushan On Wed, Feb 20, 2013 at 7:29 PM, Imran Khan wrote: > Hello All > > I am trying to use libavcoded shared build from zeranoe in visual studio > 2008. I have tested my application using libavcodec in debug mode and it > is running fine. but when i am trying to build the application through > release version then it compiles fine but while running it is showing > error as "The procedure entry point CoCreateInstance could not be located > in the dynaminc link library avcodec-54.dll" Can any one please help me to > solve this issue. > -- > Thanks and Regards > Imran Khan > Project Engineer > CDAC Hyderabad > > > > ------------------------------------------------------------------------------------------------------------------------------- > > This e-mail is for the sole use of the intended recipient(s) and may > contain confidential and privileged information. If you are not the > intended recipient, please contact the sender by reply e-mail and destroy > all copies and the original message. Any unauthorized review, use, > disclosure, dissemination, forwarding, printing or copying of this email > is strictly prohibited and appropriate legal action will be taken. > > ------------------------------------------------------------------------------------------------------------------------------- > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Feb 20 18:05:59 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 20 Feb 2013 17:05:59 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: Lars Hammarstrand writes: > 2013/2/17 Carl Eugen Hoyos > > Could one of you (who is affected by the problem, > remember that it cannot be reproduced on same > environments) please test mentioned patch? > Your problem unfortunately will not be fixed as > long as you don't comment on the patch;-( It appears that this mail was unclear, I am sorry about it, I am not a native speaker! Let me try again: You reported a bug [1] that cannot easily be reproduced - a buggy toolchain appears to be necessary. Less than four hours after your report, a patch was posted that is intended to fix this bug and a message was sent to this mailing list to ask if the patch fixes your compilation problem: [2]. Four days later, I asked again for a test: [3] Please understand that it is neither necessary to report this problem on another mailing list (it is actually not a good idea, reporting bugs here is 100% ok), nor is it necessary to explain why you have to use this toolchain (we do try to support slightly broken environments, but please understand that we need some help on these). Is it also not really a good idea to explain to the FFmpeg developers about performance issues and non-issues, it is safe to assume that there are not many projects that are more performance-driven than FFmpeg. As said, what is needed is somebody to test if the patch fixes the reported problem. Please disregard this email if you are not interested anymore in fixing this bug. Thank you for your support, Carl Eugen 1: http://article.gmane.org/gmane.comp.video.ffmpeg.libav.user/9926 2: http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/9941 3: http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/9964/focus=9993 From rjvbertin at gmail.com Wed Feb 20 18:43:31 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 20 Feb 2013 18:43:31 +0100 Subject: [Libav-user] FFmpeg.framework Message-ID: Hello FYI More or less as a result of the discussion about the ff_log2_tab multiply defined issue, I started toying with the possibility to pull in all members of static archives ... and ended up creating an Xcode project that generates an OS X FFmpeg framework this way. Initially I've done this in a normal build directory created inside the main FFmpeg source tree; I made a 2nd project which gets the files from a MacPorts installation. A few quick tests suggest the framework is a fully functional replacement for the standard shared libraries; ffplay links against it (and a number of external dependencies) and appears to run perfectly fine. The MacPorts-based framework builds in universal 32/64 bit, the framework based on the regular build has been tested in 32bit mode only (i.e. the project will have to be adapted to support universal builds) If there's any interest in this kind of build, I can polish the Xcode project a bit, and post it somewhere. Ren? From cyrilapan at yahoo.fr Wed Feb 20 19:14:58 2013 From: cyrilapan at yahoo.fr (cyril apan) Date: Wed, 20 Feb 2013 18:14:58 +0000 (GMT) Subject: [Libav-user] FFmpeg.framework In-Reply-To: References: Message-ID: <1361384098.75997.YahooMailNeo@web28804.mail.ir2.yahoo.com> Hi Ren?, I'm quite interested into your Xcode project. I have myself thought about doing such a venture but still didn't find any free time to complete the task. Please post it somewhere, I'm sure I'm not the only interested into this kind of project. Regards, Cyril APAN. ________________________________ De?: ""Ren? J.V. Bertin"" ??: libavdevice and libavfilter. This list is about using libavcodec libavformat libavutil Envoy? le : Mercredi 20 f?vrier 2013 18h43 Objet?: [Libav-user] FFmpeg.framework Hello FYI More or less as a result of the discussion about the ff_log2_tab multiply defined issue, I started toying with the possibility to pull in all members of static archives ... and ended up creating an Xcode project that generates an OS X FFmpeg framework this way. Initially I've done this in a normal build directory created inside the main FFmpeg source tree; I made a 2nd project which gets the files from a MacPorts installation. A few quick tests suggest the framework is a fully functional replacement for the standard shared libraries; ffplay links against it (and a number of external dependencies) and appears to run perfectly fine. The MacPorts-based framework builds in universal 32/64 bit, the framework based on the regular build has been tested in 32bit mode only (i.e. the project will have to be adapted to support universal builds) If there's any interest in this kind of build, I can polish the Xcode project a bit, and post it somewhere. Ren? _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Wed Feb 20 19:31:43 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 20 Feb 2013 19:31:43 +0100 Subject: [Libav-user] Using zeranoe libavcodec build in visual studio 2008 In-Reply-To: References: Message-ID: On Feb 20, 2013, at 14:59, Imran Khan wrote: > release version then it compiles fine but while running it is showing > error as "The procedure entry point CoCreateInstance could not be located > in the dynaminc link library avcodec-54.dll" Can any one please help me to > solve this issue. > -- Have you read the docs on ffmpeg.org on how to use the libraries from MSVC? If your code builds in Debug mode but not in Release mode, you most likely have the use of linker references activated. Go over the linker settings for your Release configuration, you'll find it as the 1st option, I think on the Advanced page (well, it's the 1st line in MSVC 2010). Deactivate it, and you'll probably be fine. (I'm a bit surprised though, I simply had inexplicable crashes...) R. From imrank at cdac.in Wed Feb 20 19:52:55 2013 From: imrank at cdac.in (Imran Khan) Date: Thu, 21 Feb 2013 00:22:55 +0530 (IST) Subject: [Libav-user] Using zeranoe libavcodec build in visual studio 2008 In-Reply-To: References: , Message-ID: Hi R Thank you! got it working..thanxs again. On Thu, Feb 21, 2013, "Ren??? J.V. Bertin" said: > > On Feb 20, 2013, at 14:59, Imran Khan wrote: > >> release version then it compiles fine but while running it is showing >> error as "The procedure entry point CoCreateInstance could not be located >> in the dynaminc link library avcodec-54.dll" Can any one please help me to >> solve this issue. >> -- > > Have you read the docs on ffmpeg.org on how to use the libraries from MSVC? If your code builds in Debug mode but not in Release mode, you most likely have the use of linker references activated. Go over the linker settings for your Release configuration, you'll find it as the 1st option, I think on the Advanced page (well, it's the 1st line in MSVC 2010). Deactivate it, and you'll probably be fine. > (I'm a bit surprised though, I simply had inexplicable crashes...) > > R. > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Thanks and Regards Imran Khan Project Engineer CDAC Hyderabad ------------------------------------------------------------------------------------------------------------------------------- This e-mail is for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email is strictly prohibited and appropriate legal action will be taken. ------------------------------------------------------------------------------------------------------------------------------- From rjvbertin at gmail.com Wed Feb 20 20:48:03 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 20 Feb 2013 20:48:03 +0100 Subject: [Libav-user] FFmpeg.framework In-Reply-To: <1361384098.75997.YahooMailNeo@web28804.mail.ir2.yahoo.com> References: <1361384098.75997.YahooMailNeo@web28804.mail.ir2.yahoo.com> Message-ID: <0429B64F-FBB0-4B42-B58F-45DFB80B1F0C@gmail.com> On Feb 20, 2013, at 19:14, cyril apan wrote: > Hi Ren?, > > I'm quite interested into your Xcode project. I have myself thought about doing such a venture but still didn't find any free time to complete the task. > Please post it somewhere, I'm sure I'm not the only interested into this kind of project. > > Regards, > > Cyril APAN. Salut Cyril Here's my framework: https://github.com/RJVB/FFmpeg.framework I've installed it in a subdirectory (my build directory) of the FFmpeg source tree, but of course it uses none of those files for simply building a framework out of an MacPorts installation. Except for the license file, that is. Let me know if there are problems with the project, Regards, Ren? From francesco at bltitalia.com Thu Feb 21 08:55:36 2013 From: francesco at bltitalia.com (francesco at bltitalia.com) Date: Thu, 21 Feb 2013 08:55:36 +0100 (added by postmaster@virgilio.it) Subject: [Libav-user] FFmpeg.framework Message-ID: <50ED77C804415FA2@vsmtp21.tin.it> (added by postmaster@virgilio.it) Great Ren?, Great ! ! ! I'm interested. Thanks At 18.43 20/02/2013 +0100, you wrote: >Hello > >FYI > >More or less as a result of the discussion about the ff_log2_tab multiply defined issue, I started toying with the possibility to pull in all members of static archives ... and ended up creating an Xcode project that generates an OS X FFmpeg framework this way. >Initially I've done this in a normal build directory created inside the main FFmpeg source tree; I made a 2nd project which gets the files from a MacPorts installation. >A few quick tests suggest the framework is a fully functional replacement for the standard shared libraries; ffplay links against it (and a number of external dependencies) and appears to run perfectly fine. The MacPorts-based framework builds in universal 32/64 bit, the framework based on the regular build has been tested in 32bit mode only (i.e. the project will have to be adapted to support universal builds) > >If there's any interest in this kind of build, I can polish the Xcode project a bit, and post it somewhere. > >Ren? >_______________________________________________ >Libav-user mailing list >Libav-user at ffmpeg.org >http://ffmpeg.org/mailman/listinfo/libav-user > >__________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 8015 (20130215) __________ > >Il messaggio ? stato controllato da ESET NOD32 Antivirus. > >www.nod32.it > > > > From jerome.salayet at hymatom.fr Thu Feb 21 12:25:40 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Thu, 21 Feb 2013 12:25:40 +0100 Subject: [Libav-user] CodecContext Optimization to Decode H264 Message-ID: <79C91ED810DD8A49B375C899D0034D270993BA@mail.hymatom.fr> Hello, I use the last released FFMPEG library to decode H264 video streams (each frame send to the avcodec_decode_video2 function is a full video frame). When I look several code sources samples, it seems that everyone set differents options for the CodecContext and the Codec flags. I someone can tell me if I use the better ones to decode H264 : m_lpCodecCtx->skip_frame = AVDISCARD_NONREF; m_lpCodecCtx->skip_loop_filter = AVDISCARD_ALL; m_lpCodecCtx->skip_idct = AVDISCARD_ALL; m_lpCodecCtx->idct_algo = 1; m_lpCodecCtx->has_b_frames = 0; m_lpCodecCtx->refs = 1; av_opt_set(m_lpCodecCtx->priv_data, "preset", "ultrafast", 0); av_opt_set(m_lpCodecCtx->priv_data, "tune", "zerolatency", 0); I also set the codec flags like this : if(m_lpCodec->capabilities&CODEC_CAP_TRUNCATED) m_lpCodecCtx->flags|= CODEC_FLAG_TRUNCATED; // Enable faster H264 decode. m_lpCodec->capabilities |= CODEC_CAP_FRAME_THREADS; m_lpCodecCtx->flags |= CODEC_FLAG_LOW_DELAY; m_lpCodecCtx->flags2 |= CODEC_FLAG2_FAST; Regards, J?r?me SALAYET Ing?nieur Informatique T?l : 04 67 87 61 12 Fax : 04 67 70 85 44 Site web : www.hymatom.fr Email : jerome.salayet at hymatom.fr -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/png Size: 7598 bytes Desc: image001.png URL: From cehoyos at ag.or.at Thu Feb 21 17:08:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 21 Feb 2013 16:08:05 +0000 (UTC) Subject: [Libav-user] CodecContext Optimization to Decode H264 References: <79C91ED810DD8A49B375C899D0034D270993BA@mail.hymatom.fr> Message-ID: J?r?me SALAYET writes: > I someone can tell me if I use the better ones to decode H264?: > ? > m_lpCodecCtx->skip_frame?????? = ?AVDISCARD_NONREF; > m_lpCodecCtx->skip_loop_filter = ?AVDISCARD_ALL; Do you know what these two are doing? I consider them extremely useful but if you don't know what they exactly do, it is very bad to set them. > m_lpCodecCtx->skip_idct??????? =? AVDISCARD_ALL; > m_lpCodecCtx->idct_algo??????? =? 1; I suspect they have no effect on H264 decoding, generally I don't think you would use them if they would work. > m_lpCodecCtx->has_b_frames???? =? 0; > m_lpCodecCtx->refs = 1; Documentation says "decoding: Set by libavcodec", so you should definitely not set them. > av_opt_set(m_lpCodecCtx->priv_data, "preset", "ultrafast", 0); > av_opt_set(m_lpCodecCtx->priv_data, "tune", "zerolatency", 0); I may absolutely miss something, but these look like encoding parameters. > I also set the codec flags like this?: > ? > if(m_lpCodec->capabilities&CODEC_CAP_TRUNCATED) > ?m_lpCodecCtx->flags|= CODEC_FLAG_TRUNCATED; I would expect that this has a performance hit, only use it if you know why. > // Enable faster H264 decode. > m_lpCodec->capabilities |= CODEC_CAP_FRAME_THREADS; I don't think you can set codec capabilities. > m_lpCodecCtx->flags???? |= CODEC_FLAG_LOW_DELAY; (I am not convinced you should always set this flag, but I probably don't know enough to really say this.) > m_lpCodecCtx->flags2??? |= CODEC_FLAG2_FAST; This is the only dangerous flag, it means: "I know that my input is 100% error free, I don't mind if libavcodec crashes on invalid input." (Depending on your use-case this may or may not be what you want, note that the performance impact is very, very small, so you probably don't want it.) Carl Eugen From jerome.salayet at hymatom.fr Thu Feb 21 17:38:14 2013 From: jerome.salayet at hymatom.fr (=?iso-8859-1?Q?J=E9r=F4me_SALAYET?=) Date: Thu, 21 Feb 2013 17:38:14 +0100 Subject: [Libav-user] CodecContext Optimization to Decode H264 Message-ID: <79C91ED810DD8A49B375C899D0034D270993BC@mail.hymatom.fr> Thanks for your help. Regards, -------------- next part -------------- An HTML attachment was scrubbed... URL: From joe.flowers at nofreewill.com Fri Feb 22 00:26:43 2013 From: joe.flowers at nofreewill.com (Joe Flowers) Date: Thu, 21 Feb 2013 18:26:43 -0500 Subject: [Libav-user] Sample code for encoding s16le PCM file to (u-law, a-law, gsm, or etc.) file? Message-ID: Hello Everyone, I have been looking in the ...\ffmpeg-1.1.2\doc\examples\ folder for sample code for encoding a s16le PCM file to (u-law, a-law, gsm, or etc.) but have not been able to find one. The examples seem to all start from a synthetically encoded sample within the code, but I need to start with reading the data from a file that is just s16le PCM encoded audio file. Does anyone have C sample/example code for this please? Thanks!!! Joe ----------------- From lars.hammarstrand at gmail.com Fri Feb 22 15:41:38 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 22 Feb 2013 15:41:38 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: 2013/2/20 Carl Eugen Hoyos > You reported a bug [1] that cannot easily be reproduced a buggy toolchain > appears to be necessary. Less than four hours after your report, a patch > was posted that is intended to fix this bug and a message was sent to > this mailing list to ask if the patch fixes your compilation > Hi Carl! Sorry about that but I've totally missed the fact there was already a fix available for test. Can you please provide a link to where I can find it? -- Thanks in advance! Regards, Lars. Ps.. I will soon be gone for a winter sports holiday, thus all ffmpeg activities be put on hold until next weekend. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Feb 22 16:35:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Feb 2013 15:35:43 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: Lars Hammarstrand writes: > > 2013/2/20 Carl Eugen Hoyos > > > > You reported a bug [1] that cannot easily be reproduced a > > buggy toolchain appears to be necessary. Less than four?hours > > after your report, a patch was posted that is?intended to fix > > this bug and a message was sent to this?mailing list to ask > > if the patch fixes your compilation > > Hi Carl! Sorry about that but I've totally missed the fact > there was already a fix available for test. Can you please > provide a link to where I can find it? (You did answer the mail where it was mentioned and you were asked for a test...) You have cut the relevant part of my message: ;-( http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/9941 (You have to google the subject mentioned in this mail to find the patch.) Please fix your quoting, Carl Eugen From rjvbertin at gmail.com Fri Feb 22 16:48:52 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Fri, 22 Feb 2013 16:48:52 +0100 Subject: [Libav-user] ff_log2_tab defined multiple times in the fmpeg 1.1 libraries, bug or feature ?? In-Reply-To: References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> Message-ID: <7D1E044F-87D1-44EB-BE56-F7A9DEDAF48D@gmail.com> On Feb 22, 2013, at 16:35, Carl Eugen Hoyos wrote: > > Please fix your quoting, Carl Eugen Works here. Please fix your MUA.... :P R. From cehoyos at ag.or.at Fri Feb 22 17:19:58 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Feb 2013 16:19:58 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?ff=5Flog2=5Ftab_defined_multiple_times_in_?= =?utf-8?q?the_fmpeg_1=2E1_libraries=2C_bug_or_feature_=3F=3F?= References: <20130213190106.GZ5712@kiste2> <20130213193246.GA5712@kiste2> <7D1E044F-87D1-44EB-BE56-F7A9DEDAF48D@gmail.com> Message-ID: Ren? J.V. Bertin writes: > On Feb 22, 2013, at 16:35, Carl Eugen Hoyos wrote: > > > > Please fix your quoting, Carl Eugen > > Works here. Please fix your MUA.... :P Should have been: "Please set your mailer to plain-text." Sorry, Carl Eugen From brado at bighillsoftware.com Fri Feb 22 21:03:30 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 22 Feb 2013 13:03:30 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> Message-ID: <332FADB9-1CC5-4F4B-98DE-1E29DED38DC7@bighillsoftware.com> On Feb 18, 2013, at 4:43 PM, Carl Eugen Hoyos wrote: > The aconvert audio filter uses libswresample for > conversions, it may depend on your use case if > you prefer the filter or the library. > In reading through FFmpeg source, it would appear that the libswresample/swresample.h and libavresample/avresample.h are very similar. Are these libraries interchangeable -- is there any reason to use one over the other? What is the difference between them? Thanks, Brad From cehoyos at ag.or.at Sat Feb 23 00:00:48 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Feb 2013 23:00:48 +0000 (UTC) Subject: [Libav-user] Decoding an AAC-LATM 5.1 audio returns errors and only 1 channel with data References: Message-ID: Nicol?s Dato writes: > Then, I tested it by upgrading to FFMPEG 1.0, everything looks the > same as with 0.10.5 untill the error "channel element > 0.2.." appears, after this happens the data is different, the > channel 1, 2, 4, 5 and 6 are always in 0 (silence), and the channel 3 > has the information (and it looks OK). This should be fixed in current git head, thank you for the report! Carl Eugen From cehoyos at ag.or.at Sat Feb 23 00:27:56 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Feb 2013 23:27:56 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> <332FADB9-1CC5-4F4B-98DE-1E29DED38DC7@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > On Feb 18, 2013, at 4:43 PM, Carl Eugen Hoyos wrote: > > > The aconvert audio filter uses libswresample for > > conversions, it may depend on your use case if > > you prefer the filter or the library. > > In reading through FFmpeg source, it would appear > that the libswresample/swresample.h and > libavresample/avresample.h are very similar. > Are these libraries interchangeable No, I don't think so (libavresample was written to be not interchangeable with libswresample so I would at least be surprised). > -- is there any reason to use one over the other? Yes, only libswresample is supported, libavresample is not even built by default. Please read this article if you need more information: http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html Carl Eugen From brado at bighillsoftware.com Sat Feb 23 02:11:40 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 22 Feb 2013 18:11:40 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> <332FADB9-1CC5-4F4B-98DE-1E29DED38DC7@bighillsoftware.com> Message-ID: <0BC388F0-7EAA-41AE-A8CA-A374011700B9@bighillsoftware.com> On Feb 22, 2013, at 4:27 PM, Carl Eugen Hoyos wrote: > Please read this article if you need more information: > http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html Wow, now that's a read for a Friday, make no mistake. Its like the programmer version of Game of Thrones. Well anyway, I have no idea which clan I'm now communicating with, or with the mailing list being "Libav-user" but having arrived here via FFmpeg where in the terrain that places me, but suffice to say I'm both ignorant of and ambivalent to all of it -- please consider me one of the unimportant masses as far as those matters go -- I'm just a simple mechanic trying to assemble nuts and bolts. I'm having intermittent flashbacks of wanting to resample an audio frame from one format to another, so I'm going to try to get back to the island (LOST reference) ;-) Thanks for the tip on libswresample, I'll proceed with it. Brad From ubitux at gmail.com Sat Feb 23 02:14:57 2013 From: ubitux at gmail.com (=?utf-8?B?Q2zDqW1lbnQgQsWTc2No?=) Date: Sat, 23 Feb 2013 02:14:57 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <0BC388F0-7EAA-41AE-A8CA-A374011700B9@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> <332FADB9-1CC5-4F4B-98DE-1E29DED38DC7@bighillsoftware.com> <0BC388F0-7EAA-41AE-A8CA-A374011700B9@bighillsoftware.com> Message-ID: <20130223011457.GC20847@leki> On Fri, Feb 22, 2013 at 06:11:40PM -0700, Brad O'Hearne wrote: > > On Feb 22, 2013, at 4:27 PM, Carl Eugen Hoyos wrote: > > > Please read this article if you need more information: > > http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html > > Wow, now that's a read for a Friday, make no mistake. Its like the programmer version of Game of Thrones. Well anyway, I have no idea which clan I'm now communicating with, or with the mailing list being "Libav-user" but having arrived here via FFmpeg where in the terrain that places me, but suffice to say I'm both ignorant of and ambivalent to all of it -- please consider me one of the unimportant masses as far as those matters go -- I'm just a simple mechanic trying to assemble nuts and bolts. > You are on one of the mailing list of the FFmpeg project. It's called "Libav-user" because it's the one of the libav* libraries. The fork took a confusing name on purpose. -- Cl?ment B. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 490 bytes Desc: not available URL: From brado at bighillsoftware.com Sat Feb 23 02:19:17 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 22 Feb 2013 18:19:17 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <20130223011457.GC20847@leki> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <9AEAC951-46C2-4390-9507-E12212EAB4AC@bighillsoftware.com> <332FADB9-1CC5-4F4B-98DE-1E29DED38DC7@bighillsoftware.com> <0BC388F0-7EAA-41AE-A8CA-A374011700B9@bighillsoftware.com> <20130223011457.GC20847@leki> Message-ID: <7DC14A99-16A0-456B-B4F4-91EAA93ED8D0@bighillsoftware.com> On Feb 22, 2013, at 6:14 PM, Cl?ment B?sch wrote: > > You are on one of the mailing list of the FFmpeg project. It's called > "Libav-user" because it's the one of the libav* libraries. The fork took a > confusing name on purpose. > Thanks for the clarification. That helps to know. Brad From haridassagarn at tataelxsi.co.in Sun Feb 24 14:39:25 2013 From: haridassagarn at tataelxsi.co.in (Haridas Sagar N) Date: Sun, 24 Feb 2013 13:39:25 +0000 Subject: [Libav-user] Converting audio sample format from s32le to f32le using libswresample/av_convert Message-ID: <5773415B74E79546B5E12D008F2014B11015971B@SIXPRD0410MB396.apcprd04.prod.outlook.com> Hello Everyone, I am new to ffmpeg and I am working on AAC encoder, I tried encoding the pcm sample having f32le sample format but whatever the pcm sample format i am having is s32le so i need to convert it to f32le,I tried with ffmpeg's resampling_audio.c example and i have modified the code to take pcm file as input.. but the output file size is always ~=11000 bytes and it is not playing Also i tried with very the following code but swr_convert() is returning -22 and i am not sure what ever code i got/written is correct... Here is the sample code i am trying currently int main(int argc, char **argv) { uint8_t *dst,*dstp; uint8_t *outbuf; int ret; size_t bufsize; FILE *fp=NULL; FILE *fout=NULL; struct SwrContext *ctx = NULL; char *filename=argv[1]; fp = fopen("FLTP1.pcm","rb"); fout = fopen(filename,"wb"); if (fseek(fp, 0L, SEEK_END) == 0) bufsize=ftell(fp); fseek(fp, 0L, SEEK_SET); printf(" buf size is %d\n",bufsize); dstp=( uint8_t *)malloc(sizeof(uint8_t) * (bufsize + 1)); outbuf=( uint8_t *)malloc(sizeof(uint32_t) * (bufsize*1000 + 1)); dstp=dst; while(!feof(fp)) { printf(" reading samples from file\n"); ret=fread(&dstp,1,4,fp); dst++; printf(" return value is %d\n",ret); } //dst=dstp; ctx = swr_alloc_set_opts(ctx,AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_S32,48000, AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_FLTP,44100,0,0); if(swr_init(ctx) < 0) return -1; printf(" converting\n"); int resample_samples = swr_convert(ctx,(uint8_t**)&outbuf,bufsize*1000, (const uint8_t**)&dst,bufsize); printf(" return value is %d\n",resample_samples); printf(" writing to file\n"); fwrite(outbuf,resample_samples,1,fout); printf(" wrote to file\n"); //free(&outbuf); //free(&dstp); swr_free(&ctx); return 0; } It will be of great help to me if you provide me with any suggestions/help Thanks in advance Best regards Haridas Sagar N Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Mon Feb 25 07:39:10 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 24 Feb 2013 23:39:10 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> Message-ID: <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: > While I have _no_ idea what the "flv audio codec" could > be, please use either the aconvert filter or libswresample > directly to convert from one audio format to another. This has turned out to be much more difficult than expected. To review, I'm trying to take samples captured from QTKit (Apple's QuickTime library) and resample them to an appropriate format for streaming with FFmpeg. The audio data received from QTKit capture is a data structured contained within QTSampleBuffer, which has the following description: Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz After reading various ffmpeg source, it appears that this maps to the AV_SAMPLE_FMT_FLT sample format (though note I've also tried AV_SAMPLE_FMT_FLTP -- with the same result). The output sample format that I need to resample to is AV_SAMPLE_FMT_S16. I have successfully created the resample context, allocated both source and destination data arrays, and filled the source array with the QTSampleBuffer data. But the actual conversion is failing, specifically the line: // convert to destination format returnVal = swr_convert(resamplerCtx, &destinationData, destinationNumberOfSamples, (const uint8_t **)&sourceData, sourceNumberOfSamples); is completely crashing the app with an EXC_ARITHMETIC error, which is generally an indication of a divide by zero error. I have attached a more extensive code snippet so that you can see how I've gone about this. Note I've changed sample formats, changed between default (0) and no alignment (1) on the data array allocations, with no change -- the conversion still fails. In the call above, both the destination and source number of samples are 512, the same number of samples that are coming over on the QTSampleBuffer object. Does anyone have any idea what might be causing this? The app is just outright crashing inside the swr_convert function, giving me almost no clue what the problem is. Help is greatly appreciated! Thanks, Brad -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: AudioProcessingSnippet.txt URL: From onemda at gmail.com Mon Feb 25 09:30:48 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 25 Feb 2013 08:30:48 +0000 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> Message-ID: On 2/25/13, Brad O'Hearne wrote: > > On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: > >> While I have _no_ idea what the "flv audio codec" could >> be, please use either the aconvert filter or libswresample >> directly to convert from one audio format to another. > > This has turned out to be much more difficult than expected. To review, I'm > trying to take samples captured from QTKit (Apple's QuickTime library) and > resample them to an appropriate format for streaming with FFmpeg. The audio > data received from QTKit capture is a data structured contained within > QTSampleBuffer, which has the following description: > > Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz > > After reading various ffmpeg source, it appears that this maps to the > AV_SAMPLE_FMT_FLT sample format (though note I've also tried > AV_SAMPLE_FMT_FLTP -- with the same result). The output sample format that I > need to resample to is AV_SAMPLE_FMT_S16. > > I have successfully created the resample context, allocated both source and > destination data arrays, and filled the source array with the QTSampleBuffer > data. But the actual conversion is failing, specifically the line: > > // convert to destination format > returnVal = swr_convert(resamplerCtx, > &destinationData, > destinationNumberOfSamples, > (const uint8_t **)&sourceData, > sourceNumberOfSamples); > > is completely crashing the app with an EXC_ARITHMETIC error, which is > generally an indication of a divide by zero error. I have attached a more > extensive code snippet so that you can see how I've gone about this. Note > I've changed sample formats, changed between default (0) and no alignment > (1) on the data array allocations, with no change -- the conversion still > fails. In the call above, both the destination and source number of samples > are 512, the same number of samples that are coming over on the > QTSampleBuffer object. > > Does anyone have any idea what might be causing this? The app is just > outright crashing inside the swr_convert function, giving me almost no clue > what the problem is. Without looking at exact code I'm playing lottery here. > > Help is greatly appreciated! > > Thanks, > > Brad > > From cehoyos at ag.or.at Mon Feb 25 10:29:33 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Feb 2013 09:29:33 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: > > > While I have _no_ idea what the "flv audio codec" could > > be, please use either the aconvert filter or libswresample > > directly to convert from one audio format to another. > > This has turned out to be much more difficult than expected. Before you start debugging (the cast to sourceData looks suspicious): Did you look at doc/examples/filtering_audio.c and doc/examples/resampling_audio.c ? I suspect using the aconvert filter has the advantage that you can do other changes to the audio without additional code (and bugs). In any case, using gdb should quickly show you were the problem lies. Carl Eugen From rjvbertin at gmail.com Mon Feb 25 10:44:00 2013 From: rjvbertin at gmail.com (=?ISO-8859-1?Q?Ren=E9_J=2EV=2E_Bertin?=) Date: Mon, 25 Feb 2013 10:44:00 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> Message-ID: <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Carl Eugen Hoyos wrote: >Brad O'Hearne writes: > >> On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: >> >> > While I have _no_ idea what the "flv audio codec" could >> > be, please use either the aconvert filter or libswresample >> > directly to convert from one audio format to another. >> >> This has turned out to be much more difficult than expected. > >Before you start debugging (the cast to sourceData looks >suspicious): Did you look at doc/examples/filtering_audio.c >and doc/examples/resampling_audio.c ? >I suspect using the aconvert filter has the advantage that >you can do other changes to the audio without additional >code (and bugs). > >In any case, using gdb should quickly show you were the >problem lies. > >Carl Eugen > >_______________________________________________ >Libav-user mailing list >Libav-user at ffmpeg.org >http://ffmpeg.org/mailman/listinfo/libav-user Exactly, but you'd need to build the libav libs yourself, with debugging info. There's another thing that's nagging me. IIUC, the goal here is to convert a buffer of (C) floats into signed shorts. I have some difficulty believing that doing this through a generic workhouse function can be more efficient than writing a simple loop and let a good optimising compiler create the best assembly out of it ... R. From onemda at gmail.com Mon Feb 25 10:50:33 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 25 Feb 2013 09:50:33 +0000 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On 2/25/13, Rene J.V. Bertin wrote: > > > Carl Eugen Hoyos wrote: > >>Brad O'Hearne writes: >> >>> On Feb 18, 2013, at 3:50 PM, Carl Eugen Hoyos wrote: >>> >>> > While I have _no_ idea what the "flv audio codec" could >>> > be, please use either the aconvert filter or libswresample >>> > directly to convert from one audio format to another. >>> >>> This has turned out to be much more difficult than expected. >> >>Before you start debugging (the cast to sourceData looks >>suspicious): Did you look at doc/examples/filtering_audio.c >>and doc/examples/resampling_audio.c ? >>I suspect using the aconvert filter has the advantage that >>you can do other changes to the audio without additional >>code (and bugs). >> >>In any case, using gdb should quickly show you were the >>problem lies. >> >>Carl Eugen >> >>_______________________________________________ >>Libav-user mailing list >>Libav-user at ffmpeg.org >>http://ffmpeg.org/mailman/listinfo/libav-user > > > Exactly, but you'd need to build the libav libs yourself, with debugging > info. > > There's another thing that's nagging me. IIUC, the goal here is to convert a > buffer of (C) floats into signed shorts. I have some difficulty believing > that doing this through a generic workhouse function can be more efficient > than writing a simple loop and let a good optimising compiler create the > best assembly out of it ... Why not do it? And than compare speed. You will learn a lot. > > R. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Mon Feb 25 11:39:27 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Feb 2013 10:39:27 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: Ren? J.V. Bertin writes: > >In any case, using gdb should quickly show you were the > >problem lies. > > Exactly, but you'd need to build the libav libs yourself, > with debugging info. One could argue that on this mailing list, only self-compiled FFmpeg is supported (because you should get support wherever you download your binaries). > There's another thing that's nagging me. IIUC, the goal here > is to convert a buffer of (C) floats into signed shorts. I > have some difficulty believing that doing this through a > generic workhouse function can be more efficient than > writing a simple loop and let a good optimising compiler > create the best assembly out of it ... Such a very implausible claim definitely needs some performance numbers. (Or in other words: No, current compilers are unable to optimize code the way you expect them.) Please fix your quotes, Carl Eugen From rjvbertin at gmail.com Mon Feb 25 11:47:46 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 11:47:46 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On Feb 25, 2013, at 10:50, Paul B Mahol wrote: >> There's another thing that's nagging me. IIUC, the goal here is to convert a >> buffer of (C) floats into signed shorts. I have some difficulty believing >> that doing this through a generic workhouse function can be more efficient >> than writing a simple loop and let a good optimising compiler create the >> best assembly out of it ... > > Why not do it? And then compare speed. You will learn a lot. ^ there Carl, I fixed a quote as you requested O:-) I would if the particular problem was relevant to me, right now I have a bit too much of a hunch that I'd find very little gain of the one over the other. Which would mean that if, for a one-time requirement, you need to spend significant time figuring out how to present your data the right way (and then try to understand where you're going wrong), you'd just as well jot something down yourself. That said, as reported earlier, I did compare performance of a hand-coded SIMD version of a yuv conversion routine (from the Perian project) to the generic scalar version. The SIMD version ran twice as fast as the scalar version until I used gcc 4.7, which has auto-vectorisation capable enough to reverse the picture and make the "scalar" version more than twice as fast as the SIMD version. I should add that working on OS X I have nothing extra to do to ensure that memory is allocated with the proper alignment. > One could argue that on this mailing list, only self-compiled > FFmpeg is supported One could, but that argument would not be supported by the mailing list's own title: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. " The concept "using libav*" doesn't imply anything about how you obtained the libraries, and indeed, who built the libraries you're using (as opposed to which and how) should be irrelevant. It does however constitute a clear invitation to post questions like "how do I convert an audio format". R. From cehoyos at ag.or.at Mon Feb 25 12:00:26 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Feb 2013 11:00:26 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: Ren? J.V. Bertin writes: > The SIMD version ran twice as fast as the scalar version > until I used gcc 4.7, which has auto-vectorisation Unfortunately, turning auto-vectorisation on triggers bugs in gcc and is therefore no option;-( [...] > > One could argue that on this mailing list, only self-compiled > > FFmpeg is supported > > One could, but that argument would not be supported by > the mailing list's own title: > "This list is about using libavcodec, libavformat, > libavutil, libavdevice and libavfilter. " > > The concept "using libav*" doesn't imply anything about > how you obtained the libraries We only provide sources and therefore only support self-compiled versions. And since this is a mailing list for developers, it makes absolutely no sense to argue "compilation is so difficult", especially as it is only a question of doing "./configure && make" if you are not cross- compiling. > and indeed, who built the libraries you're using > (as opposed to which and how) should be irrelevant. > It does however constitute a clear invitation to > post questions like "how do I convert an audio format". And such questions are welcome here! As said, I think a cast should not be necessary when calling swr_convert(), so this is a good start, but gdb will probably tell you more exactly. Carl Eugen From rjvbertin at gmail.com Mon Feb 25 12:37:20 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 12:37:20 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On Feb 25, 2013, at 12:00, Carl Eugen Hoyos wrote: > Unfortunately, turning auto-vectorisation on triggers > bugs in gcc and is therefore no option;-( Maybe in ffmpeg sources, but we're not talking about that here. I for one assume that the gcc devs would not have provided default-on auto-vectorisation if the feature triggered (too many) bugs they know of. Yes, it's on by default in gcc 4.7 and has to be switched off explicitly. BTW, I did force a gcc-4.7 auto-vectorised build of ffmpeg recently (using also -ftracer), and didn't notice any errors once alignment issues were avoided (i.e. on OS X). I just noticed no speed gains in my application that justified the effort that would be required to ensure correct alignment on MSWin. Oh, and I didn't claim that a compiler-optimised ad-hoc scalar function would perform better. I just wouldn't be amazed if it had less overhead than using a generic function, as I think we're talking about a very simple operation ... and especially if the buffers are relatively small. And debugging your own code is (almost) always easier than debugging someone else's code O:-) > And since this is a mailing list for developers, it > makes absolutely no sense to argue "compilation is > so difficult", especially as it is only a question No one ever said that ... I just raised the point that a local build would be required. Note that the step from using prebuilt static libraries to self-built libraries does require satisfying all the dependencies first. Not necessarily difficult, but it can be a nuisance if you don't want to use something like MacPorts or apt-get because they'd impose even more dependencies... As to the cast - I suppose Brad put it there just to get rid of a compiler warning (or error, if he's using c++). Of course it shouldn't be doing anything else. R From cehoyos at ag.or.at Mon Feb 25 12:53:24 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Feb 2013 11:53:24 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: Ren? J.V. Bertin writes: > I for one assume that the gcc devs would not have provided > default-on auto-vectorisation if the feature triggered > (too many) bugs they know of. You probably also assume the gcc developers do know the difference between a undecidable and a NP-hard problem? http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203 Seriously: If auto-vectorisation works (for some gcc versions) and has a performance-gain, please send a patch. Carl Eugen From rjvbertin at gmail.com Mon Feb 25 13:40:43 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 13:40:43 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: <72FA5EF8-5A51-4E29-BDE6-1DCEE2BCDABD@gmail.com> On Feb 25, 2013, at 12:53, Carl Eugen Hoyos wrote: > Ren? J.V. Bertin writes: > >> I for one assume that the gcc devs would not have provided >> default-on auto-vectorisation if the feature triggered >> (too many) bugs they know of. > > You probably also assume the gcc developers do know > the difference between a undecidable and a NP-hard problem? > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203 Who cares, as long as they don't release versions that fail on too many kinds of code? As far as I'm concerned they can use whatever kind of magic as long as it isn't too black ;) > Seriously: If auto-vectorisation works (for some gcc > versions) and has a performance-gain, please send a > patch. Wilco, but don't count on it. If gains are to be had they'll probably not only be for specific compiler and host types/versions, but also be on a case-by-case basis (file or even function level), which is probably hard to integrate into the build procedure. To be honest, the example I cited earlier was the 1st time I ever saw a true gain from auto-vectorisation (as opposed to automatic use of the SSE abi for 'regular' calculations). And even that spectacular gain is completely drowned in my application ... little does it matter if a pixel format conversion routine runs at 10kHz or at almost 25kHz when you're calling it at typical video frequencies (or there are a number of other bottlenecks). BTW, is there some documentation on ffmpeg.org on how to create patches after having hacked around in the source tree? And a related question: what's a good way to perform real-world benchmarks on the libraries? Can ffmpeg be compiled so that it collects performance statistics on specific operations? Because I presume no one will be interested in patches that give a performance gain that's significant (reproducible) but completely irrelevant on the overall timescale of operations... (in fact I'm quite sure of that, having read a discussion on a patch to support building universal binaries on OS X ... which could be as easy as implementing the more-or-less standard --disable-dependency-tracking option in configure :) ) R From onemda at gmail.com Mon Feb 25 13:44:49 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 25 Feb 2013 12:44:49 +0000 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <72FA5EF8-5A51-4E29-BDE6-1DCEE2BCDABD@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <72FA5EF8-5A51-4E29-BDE6-1DCEE2BCDABD@gmail.com> Message-ID: On 2/25/13, "Rene J.V. Bertin" wrote: > On Feb 25, 2013, at 12:53, Carl Eugen Hoyos wrote: > >> Rene J.V. Bertin writes: >> >>> I for one assume that the gcc devs would not have provided >>> default-on auto-vectorisation if the feature triggered >>> (too many) bugs they know of. >> >> You probably also assume the gcc developers do know >> the difference between a undecidable and a NP-hard problem? >> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203 > > Who cares, as long as they don't release versions that fail on too many > kinds of code? As far as I'm concerned they can use whatever kind of magic > as long as it isn't too black ;) > >> Seriously: If auto-vectorisation works (for some gcc >> versions) and has a performance-gain, please send a >> patch. > > Wilco, but don't count on it. If gains are to be had they'll probably not > only be for specific compiler and host types/versions, but also be on a > case-by-case basis (file or even function level), which is probably hard to > integrate into the build procedure. > > To be honest, the example I cited earlier was the 1st time I ever saw a true > gain from auto-vectorisation (as opposed to automatic use of the SSE abi for > 'regular' calculations). And even that spectacular gain is completely > drowned in my application ... little does it matter if a pixel format > conversion routine runs at 10kHz or at almost 25kHz when you're calling it > at typical video frequencies (or there are a number of other bottlenecks). > > BTW, is there some documentation on ffmpeg.org on how to create patches > after having hacked around in the source tree? Yes, it is on usual location on project web page. > And a related question: what's a good way to perform real-world benchmarks > on the libraries? Can ffmpeg be compiled so that it collects performance > statistics on specific operations? Because I presume no one will be > interested in patches that give a performance gain that's significant > (reproducible) but completely irrelevant on the overall timescale of > operations... > (in fact I'm quite sure of that, having read a discussion on a patch to > support building universal binaries on OS X ... which could be as easy as > implementing the more-or-less standard --disable-dependency-tracking option > in configure :) ) > > R > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Mon Feb 25 13:50:08 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Feb 2013 12:50:08 +0000 (UTC) Subject: [Libav-user] Converting audio sample buffer format References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <72FA5EF8-5A51-4E29-BDE6-1DCEE2BCDABD@gmail.com> Message-ID: Ren? J.V. Bertin writes: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203 > > Who cares, as long as they don't release versions > that fail on too many kinds of code? What about the ~50 (?) releases since this report was opened? [...] > BTW, is there some documentation on ffmpeg.org on how to > create patches after having hacked around in the > source tree? http://ffmpeg.org/developer.html > And a related question: what's a good way to perform > real-world benchmarks on the libraries? Apart from time there are START_TIMER and STOP_TIMER macros in libavutil. > Can ffmpeg be compiled so that it collects performance > statistics on specific operations? Definitely. > Because I presume no one will be interested in patches > that give a performance gain that's significant > (reproducible) but completely irrelevant on the overall > timescale of operations... This is simply plain wrong. Carl Eugen From rjvbertin at gmail.com Mon Feb 25 14:29:45 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 14:29:45 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <72FA5EF8-5A51-4E29-BDE6-1DCEE2BCDABD@gmail.com> Message-ID: On Feb 25, 2013, at 13:50, Carl Eugen Hoyos wrote: > Ren? J.V. Bertin writes: > >>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11203 >> >> Who cares, as long as they don't release versions >> that fail on too many kinds of code? > > What about the ~50 (?) releases since this report was opened? > > [...] Have you seen the code snippet? It's a bit of inline assembly of the sort that shouldn't occur in the majority of projects. You really think it would have been open for so long if the issue had had more frequent/widespread effects? I've known cases where I had to switch off -ftracer or auto-vectorisation to avoid compiler errors, and I even have to do a manual compile of one lavc52 file with gcc-4.2 (not touching any options) instead of gcc-4.7 to get the most of my version of the FFusion codec for QuickTime. I've seen other weird gcc quirks with 2.x versions. But I can't recall any case where I had to drop all optimisation that was truly a compiler error. In fact, every time I thought I had found a gcc bug, it turned out to be something in my own code. > > >> Because I presume no one will be interested in patches >> that give a performance gain that's significant >> (reproducible) but completely irrelevant on the overall >> timescale of operations... > > This is simply plain wrong. OK, if by some quirk of chance I come up with something that gains me a couple of (milli)seconds on an operation that takes 2 hours to complete and even if it requires a complete rewrite of the build system (think rather post-processing the makefiles) I'll definitely figure out how to create a patch, submit it, and be upset if it doesn't get accepted as soon as I have managed to comply with all your formatting rules O:-) Supposing of course that I'll have made the investment to show that those couple of (milli)seconds are indeed a reproducible gain because somehow I'm not even sure I'd let the test run to completion once it passes the 115 minute mark. :) The only patch from my testing that we might discuss concerns the memalign-hack. If I understand correctly it's there for forcing the correct alignment on mswin, but I'm not sure it actually works. When I played with an auto-vectorised build, I had alignment related crashes until I resorted to using _aligned_malloc (through --malloc-prefix; in the old version I used this also required adding a test for _aligned_malloc in configure). (Note that it's possible I also had to compile with the costly -mstack-realign to ensure proper alignment of buffers not malloc'ed.) Is there a reason the memalign hack remains and is not replaced by using _aligned_malloc (or _mm_malloc)? R. From ndato at 3way.com.ar Mon Feb 25 16:48:16 2013 From: ndato at 3way.com.ar (=?ISO-8859-1?Q?Nicol=E1s_Dato?=) Date: Mon, 25 Feb 2013 12:48:16 -0300 Subject: [Libav-user] Decoding an AAC-LATM 5.1 audio returns errors and only 1 channel with data In-Reply-To: References: Message-ID: 2013/2/22 Carl Eugen Hoyos : > Nicol?s Dato writes: > >> Then, I tested it by upgrading to FFMPEG 1.0, everything looks the >> same as with 0.10.5 untill the error "channel element >> 0.2.." appears, after this happens the data is different, the >> channel 1, 2, 4, 5 and 6 are always in 0 (silence), and the channel 3 >> has the information (and it looks OK). > > This should be fixed in current git head, thank you > for the report! > Yes! using the ffmpeg-git the 5 channels are decoded :) . However, the error "channel element 0.2.." is still there. Thank you for your help! From brado at bighillsoftware.com Mon Feb 25 17:26:00 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 09:26:00 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On Feb 25, 2013, at 2:50 AM, Paul B Mahol wrote: >> >> Exactly, but you'd need to build the libav libs yourself, with debugging >> info. >> >> There's another thing that's nagging me. IIUC, the goal here is to convert a >> buffer of (C) floats into signed shorts. I have some difficulty believing >> that doing this through a generic workhouse function can be more efficient >> than writing a simple loop and let a good optimising compiler create the >> best assembly out of it ... > > Why not do it? And than compare speed. You will learn a lot. There's been several replies by a number of folks on various aspects of my problem, for which I thank you. There appears there may be either some misreads or something getting lost in translation. Rather than answer every post individually, I'm going to try to hit the high points in summary in one post here -- then I'll reply to a few individual ones as necessary. I hope this will communicate the most info while reducing list traffic. To the high points: - It would appear from the replies of more than one person that the source code I posted was either missed or not received. I attached a text file with source code to my original message. I did that so as to minimize the length of the message dialog by not posting all code inline -- thought that would be considered proper etiquette on this list. I received this attachment from the mailing list fine, but perhaps some have mail servers which stripped this attachment off, here is a link to the file: https://www.dropbox.com/sh/3exqfeli6446wno/0w6IEyj7Jo/AudioProcessingSnippet.txt I'm attaching the file as well, in case some have the URL above blocked for some reason. - Ideally yes, as anyone would be, I am interested in maximum performance. However, at this point, performance tweaking is a very distant secondary issue -- getting it working is by far most important issue on the table right now. - It seemed from certain replies that there was a perception that either binaries built elsewhere were in play, or that I wasn't dealing with source. To erase those questions, I am developing on Mac OS X 10.8.2, using Xcode 4.5.2. I pulled FFmpeg source directly from git, and built all relevant libraries from source. - My code has been modeled directly after the resampling_audio.c example bundled with FFmpeg. There were minor changes from the example for a) combining the resampler context allocation and setting of options into one call instead of two using swr_alloc_set_opts, and b) filling the source data array from QTSampleBuffer using the av_samples_fill_arrays. All of these changes execute successfully. The only error I receive results from the swr_convert call. - Some of the responses seem to suggest that either a certain approach or resampling in general might be error prone, or known not to work in some cases or in some environments. If this is indeed the case, please expound further if you could, because at this point, I need to avoid beating my head endlessly against API that might be broken. I have assumed to this point that the API is solid and error-free, and all errors or omissions are in my code. If this is not the case, it would be good to know, and what the ramifications are. After wrestling with this for days, at this point, anything helps. If answering any questions helps erase any ambiguity of what I'm doing or anything that might be contributing to the problem, I'm happy to do so. Again, thanks everyone for the conversation, I greatly appreciate the help. Brad -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: AudioProcessingSnippet.txt URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Mon Feb 25 17:31:51 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 09:31:51 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> Message-ID: <105E7094-C9C6-4213-A6A5-8DE681CFD62A@bighillsoftware.com> On Feb 25, 2013, at 1:30 AM, Paul B Mahol wrote: > > Without looking at exact code I'm playing lottery here. Paul -- I attached source to the original post and my post just prior attached the source again and provided a link to this source. If you are still not able to access it, let me know offline and I'm happy to FTP, private email attachment, etc. -- whatever you need to get this to you. Thx, Brad From brado at bighillsoftware.com Mon Feb 25 17:40:56 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 09:40:56 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> Message-ID: <93213A4A-7385-49EA-89A6-B3F6E4A30432@bighillsoftware.com> On Feb 25, 2013, at 2:29 AM, Carl Eugen Hoyos wrote: > Before you start debugging (the cast to sourceData looks > suspicious): Did you look at doc/examples/filtering_audio.c > and doc/examples/resampling_audio.c ? > I suspect using the aconvert filter has the advantage that > you can do other changes to the audio without additional > code (and bugs). My source code is modeled directly after resampling_audio.c. After our prior discussions about merits of each, history of Libav, etc. it seemed clear that libswresample was the proper direction, and that resampling_audio.c recommended the generally recognized conventional approach. Are there known bugs or gotchas in libswresample that may be possibly hit by using the resampling_audio.c approach? Before scrapping any resampling_audio.c-modeled approach (given that everything except the last line works, and there's no guarantee taking the aconvert route won't end up at the same obstacle), I'd like to understand what reason that this approach won't suffice...that will be useful information to know. Thanks, Brad From brado at bighillsoftware.com Mon Feb 25 17:45:45 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 09:45:45 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: <563541F5-F153-40F9-BAFA-198659539EB5@bighillsoftware.com> On Feb 25, 2013, at 4:37 AM, Ren? J.V. Bertin wrote: > As to the cast - I suppose Brad put it there just to get rid of a compiler warning (or error, if he's using c++). Of course it shouldn't be doing anything else. This is exactly right. There is a compiler warning if you don't include the cast, presumably because the parameter declaration includes "const". There's no type difference at all and the cast should really be doing anything but satisfying the compiler, as the variable in question, sourceData, is declared as a uint8_t *. Brad From rjvbertin at gmail.com Mon Feb 25 17:46:27 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 17:46:27 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On Feb 25, 2013, at 17:26, Brad O'Hearne wrote: > - It would appear from the replies of more than one person that the source code I posted was either missed or not received. I attached a text file with source code to my original message. I did that so as to minimize the length of the message dialog by not From what I understand the main contributor(s) to this mailing list read(s) the posts in a way that makes me think back to the tools I used in the very early nineties. So using html, attachments (etc) are likely to be missed. Have you tried running your code in the debugger, stepping into, through and out of swr_convert? I'm still under 10.6 so don't know Xcode 4.5, but I am pretty sure that if you add the ffmpeg source tree to your Xcode project the integrated debugger will pick up the relevant sources. Good luck, R. From onemda at gmail.com Mon Feb 25 18:04:27 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 25 Feb 2013 17:04:27 +0000 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: On 2/25/13, "Rene J.V. Bertin" wrote: > On Feb 25, 2013, at 17:26, Brad O'Hearne wrote: > >> - It would appear from the replies of more than one person that the source >> code I posted was either missed or not received. I attached a text file >> with source code to my original message. I did that so as to minimize the >> length of the message dialog by not > > From what I understand the main contributor(s) to this mailing list read(s) > the posts in a way that makes me think back to the tools I used in the very > early nineties. So using html, attachments (etc) are likely to be missed. Please, do not spread such nonsense. > > Have you tried running your code in the debugger, stepping into, through and > out of swr_convert? I'm still under 10.6 so don't know Xcode 4.5, but I am > pretty sure that if you add the ffmpeg source tree to your Xcode project the > integrated debugger will pick up the relevant sources. > > Good luck, > > R. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Mon Feb 25 18:19:21 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 10:19:21 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> On Feb 25, 2013, at 9:46 AM, "Ren? J.V. Bertin" wrote: > From what I understand the main contributor(s) to this mailing list read(s) the posts in a way that makes me think back to the tools I used in the very early nineties. So using html, attachments (etc) are likely to be missed. If attachments would be missed, I'll stick to URLs next time. As of a few minutes ago, everyone should have a direct URL to view the source. > Have you tried running your code in the debugger, stepping into, through and out of swr_convert? I'm still under 10.6 so don't know Xcode 4.5, but I am pretty sure that if you add the ffmpeg source tree to your Xcode project the integrated debugger will pick up the relevant sources. All of my code is running in the debugger, but I'm linking to the FFmpeg libraries built on the command line. In other words, I can step to the library calls themselves, but not inside, and the call is completely crashing the app, with no more information than an EXC_ARITHMETIC (presumably divide by 0) error. I had hoped to avoid debugging through FFmpeg source for a few reasons: - I suspect it is going to be quite a job to pull all of the source into my project without causing the compiler to ball up in the corner and weep...think there may be a time consuming project configuration task there, which is going to be a similar experience of wandering about in the dark for a few days. - After manually reading through the source code path inside the swr-convert call, it seemed likely that even if I found the line which resulted in a divide by zero, I'm still not sure I'd even know what to do with it, or what the expectation of the prior code was (other than, of course, divide by zero). If there's no other alternative, then I suppose I'll have to go that route. But in the meantime, I guess I'd ask a simpler question: - swr_convert is crashing -- not returning an error, mind you, but outright crashing. For those maintainers fluent in the code behind this call, what parameter combination could possibly result in such an unhandled crash? Any inkling? I have a really uneducated, blind stab in the dark at this, which might be completely off, but here goes. Given that allocating the sourceData and destinationData arrays succeeded, and given that the filling of the sourceData array from the QTSampleBuffer data also succeeded, I'm wondering if the issue lies in the difference in sample formats: AV_SAMPLE_FMT_FLT vs. AV_SAMPLE_FMT_S16. I had wondered if the formula being used for the conversion of unsigned to signed values (and I'm not even sure if this floating point format is unsigned or not) but I got to thinking that maybe a divide by zero might arise from that process. Does this scan, or is it not a possibility? Thanks, Brad From rjvbertin at gmail.com Mon Feb 25 18:43:29 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 18:43:29 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> Message-ID: On Feb 25, 2013, at 18:19, Brad O'Hearne wrote: > All of my code is running in the debugger, but I'm linking to the FFmpeg libraries built on the command line. In other words, I can step to the library calls themselves, but not inside, and the call is completely crashing the app, with no more information than an EXC_ARITHMETIC (presumably divide by 0) error. If you build with debug info (either with --enable-debug=1 passed to configure, or by ensuring that -g is part of your CFLAGS) you ought to be able to step into the library functions. > I had hoped to avoid debugging through FFmpeg source for a few reasons: > > - I suspect it is going to be quite a job to pull all of the source into my project without causing the compiler to ball up in the corner and weep...think there may be a time consuming project configuration task there, which is going to be a similar experience of wandering about in the dark for a few days. No need for that, as noted above. All you need to do is drag the FFmpeg folder (the source folder, not your build directory) into your project and make sure the code is not added to any of your projects. Xcode will index the code, and its gdb interface will use that information to give you access to the source code for the library functions. NB: gcc and clang accept -g with -O{,1,2,3,s}. > - After manually reading through the source code path inside the swr-convert call, it seemed likely that even if I found the line which resulted in a divide by zero, I'm still not sure I'd even know what to do with it, or what the expectation of the prior code was (other than, of course, divide by zero). Of course, but for that you ought to find people in the know on here. > - swr_convert is crashing -- not returning an error, mind you, but outright crashing. No answer to your question, but once you have your debugger environment set up correctly you don't even have to step through until you find the error. That is, if your bug is not a Heisenbug, i.e. one that disappears as soon as you squint at it too directly ;) Something else you can do just to exclude side-effects of things like stack corruption: run your code with the malloc protection active (see man malloc) and through valgrind to see if the crash occurs elsewhere or if you get other messages. Another option would be to run the analyser on your code (supposing Xcode still has that option). > > Does this scan, or is it not a possibility? The conversion is indeed likely to contain a division. If round-off doesn't work exactly right (**) and one of swr_convert's siblings doesn't check against zero division, you could indeed end up doing that. It should be easy enough to see if your input is signed or not. Look at a recorded white noise signal. If the average of your input buffer is (approx.) 0, you have signed data; if it's non zero with a range between 0 and (probably) twice the mean you have unsigned samples. **) don't x86 CPUs have multiple settings that control the way calculations are rounded off, or am I confounding with instruction variants that round off differently? R. From brado at bighillsoftware.com Mon Feb 25 18:57:50 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 10:57:50 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> Message-ID: On Feb 25, 2013, at 10:43 AM, "Ren? J.V. Bertin" wrote: > No need for that, as noted above. All you need to do is drag the FFmpeg folder (the source folder, not your build directory) into your project and make sure the code is not added to any of your projects. Xcode will index the code, and its gdb interface will use that information to give you access to the source code for the library functions. > NB: gcc and clang accept -g with -O{,1,2,3,s}. I'll give it a try and see if I can't get it to play ball. > Another option would be to run the analyser on your code (supposing Xcode still has that option). I've already got the static analyzer in play -- 100% clean. > **) don't x86 CPUs have multiple settings that control the way calculations are rounded off, or am I confounding with instruction variants that round off differently? I'm building for 64-bit. But anyway, I'm not sure that changing rounding necessarily solves the problem, as any approach could result in 0 -- perhaps not for a selected sample, but eventually, for other random samples, I would think it possible. Brad From rjvbertin at gmail.com Mon Feb 25 19:11:19 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 19:11:19 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> Message-ID: <03C2E6C0-4815-48C3-8178-061BE8BFE227@gmail.com> On Feb 25, 2013, at 18:57, Brad O'Hearne wrote: > On Feb 25, 2013, at 10:43 AM, "Ren? J.V. Bertin" wrote: > > I'm building for 64-bit. But anyway, I'm not sure that changing rounding necessarily solves the problem, as any approach could result in 0 -- perhaps not for a selected sample, but eventually, for other random samples, I would think it possible. True enough, I should have seen that too of course. Another thought - the divisor is *probably* the input range (multiplied by something like SHORT_MAX or SHORT_MAX/2). I don't see any specification of the input range in your sample code, I presume you have checked that it corresponds to what swr_convert expects? R From joe.flowers at nofreewill.com Mon Feb 25 19:23:28 2013 From: joe.flowers at nofreewill.com (Joe Flowers) Date: Mon, 25 Feb 2013 13:23:28 -0500 Subject: [Libav-user] Why (c->frame_size = 0) ? Message-ID: In the decoding_encoding.c file, I have changed codec = avcodec_find_encoder(AV_CODEC_ID_MP2); to codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); but now I get "Could not allocate -22 bytes for samples buffer" back from buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, c->sample_fmt, 0); Anyone know how I can fix this problem? Thanks! Joe ---------------------------------------------------- //For AV_CODEC_ID_PCM_S16LE: //c->channels = (2). //c->frame_size = (0). //c->sample_fmt = (1). //For AV_CODEC_ID_MP2: //c->channels = (2). //c->frame_size = (1152). //c->sample_fmt = (1). ----------------------------------------------------- From onemda at gmail.com Mon Feb 25 19:53:02 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 25 Feb 2013 18:53:02 +0000 Subject: [Libav-user] Why (c->frame_size = 0) ? In-Reply-To: References: Message-ID: On 2/25/13, Joe Flowers wrote: > In the decoding_encoding.c file, I have changed > > > codec = avcodec_find_encoder(AV_CODEC_ID_MP2); > to > codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); > > > but now I get > > > "Could not allocate -22 bytes for samples buffer" > > back from > > buffer_size = av_samples_get_buffer_size(NULL, c->channels, > c->frame_size, c->sample_fmt, 0); > > > Anyone know how I can fix this problem? Without exact source code? Unlikely. > > Thanks! > > Joe > > ---------------------------------------------------- > //For AV_CODEC_ID_PCM_S16LE: > //c->channels = (2). > //c->frame_size = (0). looks wrong. > //c->sample_fmt = (1). looks wrong. > > //For AV_CODEC_ID_MP2: > //c->channels = (2). > //c->frame_size = (1152). > //c->sample_fmt = (1). looks wrong. > ----------------------------------------------------- > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From rjvbertin at gmail.com Mon Feb 25 20:04:51 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 20:04:51 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> Message-ID: <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> On Feb 25, 2013, at 12:00, Carl Eugen Hoyos wrote: > Ren? J.V. Bertin writes: > >> The SIMD version ran twice as fast as the scalar version >> until I used gcc 4.7, which has auto-vectorisation > > Unfortunately, turning auto-vectorisation on triggers > bugs in gcc and is therefore no option;-( I've had some time to check up on this. On my system (a Macbook Pro 13" with a 2.6Ghz i7 running OS X 10.6.8), I only had 4 failing tests after building for i386 with MacPort's gcc-4.7 with -ftree-vectorize . However, if the duration of make check is any indication, auto-vectorisation does not give any performance benefit (or hit); for both, the tests (2nd make check call) take about 249 seconds. ffmpeg version N-50309-gaf0e814 built on Feb 25 2013 19:29:42 with gcc 4.7.2 (MacPorts gcc47 4.7.2_2+universal) configuration: --prefix=/usr/local/FFmpeg/trunk --target-os=darwin --enable-shared --enable-static --enable-gpl --enable-nonfree --enable-libfreetype --enable-pthreads --enable-yasm --disable-doc --cpu=core2 --enable-debug=1 --disable-stripping --enable-ffmpeg --enable-ffprobe --disable-ffplay --enable-hwaccels --enable-libx264 --cc=gcc-mp-4.7 --disable-outdev=sdl CFLAGS env. variable val when doing configure: CFLAGS="-march=core2 -O3 -finline-functions -funroll-loops -fstrict-aliasing -msse3 -msse4 -mssse3 -I/opt/X11/include -ftracer -ftree-vectorize -arch i386 " TEST vsynth1-snow /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/fate-run.sh fate-vsynth1-snow "" "" "/Volumes/Debian/Users/bertin/work/src/FFmpeg/osx86" 'enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p " tests/data/vsynth1.yuv avi "-c snow -strict -2 -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync 0 " -keep ""' '' '/Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth1-snow' '' '' '' '' '' '' '' '1' --- /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth1-snow 2013-01-21 17:17:04.000000000 +0100 +++ tests/data/fate/vsynth1-snow 2013-02-25 19:32:26.000000000 +0100 @@ -1,4 +1,4 @@ -44fed844eb715fba0cc2433e7d7713bb *tests/data/fate/vsynth1-snow.avi -136076 tests/data/fate/vsynth1-snow.avi -91021b7d6d7908648fe78cc1975af8c4 *tests/data/fate/vsynth1-snow.out.rawvideo -stddev: 22.77 PSNR: 20.98 MAXDIFF: 172 bytes: 7603200/ 7603200 +ba4214dd3f747639bdf0b480a0fc3191 *tests/data/fate/vsynth1-snow.avi +236338 tests/data/fate/vsynth1-snow.avi +f138d3e725eb6fd9fe7a7ce9e60f8146 *tests/data/fate/vsynth1-snow.out.rawvideo +stddev: 27.56 PSNR: 19.32 MAXDIFF: 223 bytes: 7603200/ 7603200 Test vsynth1-snow failed. Look at tests/data/fate/vsynth1-snow.err for details. make: *** [fate-vsynth1-snow] Error 1 TEST vsynth1-snow-hpel /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/fate-run.sh fate-vsynth1-snow-hpel "" "" "/Volumes/Debian/Users/bertin/work/src/FFmpeg/osx86" 'enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p " tests/data/vsynth1.yuv avi "-c snow -strict -2 -qscale 2 -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync 0 " -keep ""' '' '/Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth1-snow-hpel' '' '' '' '' '' '' '' '1' --- /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth1-snow-hpel 2013-01-21 17:17:04.000000000 +0100 +++ tests/data/fate/vsynth1-snow-hpel 2013-02-25 19:32:27.000000000 +0100 @@ -1,4 +1,4 @@ -f60c8cb8f41b66bc38df87e9bdb84b34 *tests/data/fate/vsynth1-snow-hpel.avi -138700 tests/data/fate/vsynth1-snow-hpel.avi -d6845c8f1310e041afdcebc6bbfc449b *tests/data/fate/vsynth1-snow-hpel.out.rawvideo -stddev: 22.74 PSNR: 20.99 MAXDIFF: 171 bytes: 7603200/ 7603200 +2e5a43aa672ceabc7f5c743fee63e290 *tests/data/fate/vsynth1-snow-hpel.avi +235404 tests/data/fate/vsynth1-snow-hpel.avi +1e2869537b4ebe884a77605e2a636e34 *tests/data/fate/vsynth1-snow-hpel.out.rawvideo +stddev: 26.57 PSNR: 19.64 MAXDIFF: 246 bytes: 7603200/ 7603200 Test vsynth1-snow-hpel failed. Look at tests/data/fate/vsynth1-snow-hpel.err for details. make: *** [fate-vsynth1-snow-hpel] Error 1 and TEST vsynth2-snow /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/fate-run.sh fate-vsynth2-snow "" "" "/Volumes/Debian/Users/bertin/work/src/FFmpeg/osx86" 'enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p " tests/data/vsynth2.yuv avi "-c snow -strict -2 -qscale 2 -flags +qpel -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync 0 " -keep ""' '' '/Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth2-snow' '' '' '' '' '' '' '' '1' --- /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth2-snow 2013-01-21 17:17:04.000000000 +0100 +++ tests/data/fate/vsynth2-snow 2013-02-25 19:33:25.000000000 +0100 @@ -1,4 +1,4 @@ -4b6236e23ae4a52655f2c24c5a09380a *tests/data/fate/vsynth2-snow.avi -57688 tests/data/fate/vsynth2-snow.avi -8890189af71a0dd3447c4e8424c9a76b *tests/data/fate/vsynth2-snow.out.rawvideo -stddev: 10.47 PSNR: 27.72 MAXDIFF: 119 bytes: 7603200/ 7603200 +37ab2db2f1a5e7b6c5eefa5923e7e055 *tests/data/fate/vsynth2-snow.avi +153908 tests/data/fate/vsynth2-snow.avi +e6033526feddf5e8966a4f2c6568e792 *tests/data/fate/vsynth2-snow.out.rawvideo +stddev: 16.20 PSNR: 23.94 MAXDIFF: 203 bytes: 7603200/ 7603200 Test vsynth2-snow failed. Look at tests/data/fate/vsynth2-snow.err for details. make: *** [fate-vsynth2-snow] Error 1 TEST vsynth2-snow-hpel /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/fate-run.sh fate-vsynth2-snow-hpel "" "" "/Volumes/Debian/Users/bertin/work/src/FFmpeg/osx86" 'enc_dec "rawvideo -s 352x288 -pix_fmt yuv420p " tests/data/vsynth2.yuv avi "-c snow -strict -2 -qscale 2 -me_method iter -dia_size 2 -cmp 12 -subcmp 12 -s 128x64" rawvideo "-s 352x288 -pix_fmt yuv420p -vsync 0 " -keep ""' '' '/Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth2-snow-hpel' '' '' '' '' '' '' '' '1' --- /Volumes/Debian/Users/bertin/work/src/FFmpeg/tests/ref/vsynth/vsynth2-snow-hpel 2013-01-21 17:17:04.000000000 +0100 +++ tests/data/fate/vsynth2-snow-hpel 2013-02-25 19:33:26.000000000 +0100 @@ -1,4 +1,4 @@ -9872032345c33cf8e8fc26ab655be3d3 *tests/data/fate/vsynth2-snow-hpel.avi -61760 tests/data/fate/vsynth2-snow-hpel.avi -8680d40905f423999d65b996c4dcb984 *tests/data/fate/vsynth2-snow-hpel.out.rawvideo -stddev: 10.45 PSNR: 27.74 MAXDIFF: 123 bytes: 7603200/ 7603200 +41255ade6e07c026c851bf5cc6d9815b *tests/data/fate/vsynth2-snow-hpel.avi +155434 tests/data/fate/vsynth2-snow-hpel.avi +fd30dcfa74fbddc2113d64872be40e1d *tests/data/fate/vsynth2-snow-hpel.out.rawvideo +stddev: 15.32 PSNR: 24.42 MAXDIFF: 197 bytes: 7603200/ 7603200 Test vsynth2-snow-hpel failed. Look at tests/data/fate/vsynth2-snow-hpel.err for details. make: *** [fate-vsynth2-snow-hpel] Error 1 From brado at bighillsoftware.com Mon Feb 25 20:11:23 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 12:11:23 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> Message-ID: <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> On Feb 25, 2013, at 10:43 AM, Ren? J.V. Bertin wrote: > No need for that, as noted above. All you need to do is drag the FFmpeg folder (the source folder, not your build directory) into your project and make sure the code is not added to any of your projects. Xcode will index the code, and its gdb interface will use that information to give you access to the source code for the library functions. > NB: gcc and clang accept -g with -O{,1,2,3,s}. Ok, I must not have everything completely right, as I still can't step into the code, but pulling the source code in apparently added a little more info to the stack trace (I actually think I must need to recompile the linked libraries to add debug symbols in order to step into the code -- don't think I did that the first time around). However, the little nugget of info this dished out on next run might be enough to give a foothold to find the problem. It appears that the offending line that is crashing is a call to swri_realloc_audio inside of swr_convert. I've attached a small image that shows this part of the stack trace in Xcode. Does that spark any theories by the FFmpeg gurus out there? Brad -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2013-02-25 at 12.03.33 PM.png Type: image/png Size: 9840 bytes Desc: not available URL: From klaussfreire at gmail.com Mon Feb 25 20:19:11 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Mon, 25 Feb 2013 16:19:11 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> Message-ID: On Mon, Feb 25, 2013 at 4:04 PM, "Ren? J.V. Bertin" wrote: > >> Ren? J.V. Bertin writes: >> >>> The SIMD version ran twice as fast as the scalar version >>> until I used gcc 4.7, which has auto-vectorisation >> >> Unfortunately, turning auto-vectorisation on triggers >> bugs in gcc and is therefore no option;-( > > I've had some time to check up on this. On my system (a Macbook Pro 13" with a 2.6Ghz i7 running OS X 10.6.8), I only had 4 failing tests after building for i386 with MacPort's gcc-4.7 with -ftree-vectorize . However, if the duration of make check is any indication, auto-vectorisation does not give any performance benefit (or hit); for both, the tests (2nd make check call) take about 249 seconds. That's because __builtin_assume_aligned isn't being called (most likely, didn't check). That results in **far** sub-optimal vectorization. I don't know about the failing tests though. From rjvbertin at gmail.com Mon Feb 25 23:34:53 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 25 Feb 2013 23:34:53 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> Message-ID: <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> On Feb 25, 2013, at 20:19, Claudio Freire wrote: > That's because __builtin_assume_aligned isn't being called (most > likely, didn't check). That results in **far** sub-optimal > vectorization. I don't know about the failing tests though. I doubt that call (or rather, token?) is required on OS X, where memory allocations (and stack alignment) are aligned. I know of a case where the absence of the token didn't prevent a very substantial performance gain, but haven't checked if that's always the case. I have a list of the loops that were vectorised (hard to read as I build with -j4 :)). I kind of expect those loops to be in places where the vectorisation doesn't change the overall performance picture - because the containing functions don't do any significant work (think initialisation) or simply aren't called at all (catch-all cases for which there is no hand-coded mmx/sse/... function that don't get tripped by the test suite). If that hunch is correct, the absence of a performance gain isn't surprising. I guess I ought to repeat the comparison in x86_64 mode... R. From klaussfreire at gmail.com Tue Feb 26 02:21:11 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Mon, 25 Feb 2013 22:21:11 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> Message-ID: On Mon, Feb 25, 2013 at 7:34 PM, "Ren? J.V. Bertin" wrote: > On Feb 25, 2013, at 20:19, Claudio Freire wrote: > >> That's because __builtin_assume_aligned isn't being called (most >> likely, didn't check). That results in **far** sub-optimal >> vectorization. I don't know about the failing tests though. > > I doubt that call (or rather, token?) is required on OS X, where memory allocations (and stack alignment) are aligned. I know of a case where the absence of the token didn't prevent a very substantial performance gain, but haven't checked if that's always the case. I wouldn't assume. Even if they are in effect aligned, if the compiler doesn't know it (ie, if malloc doesn't mark them as such), vectorization will still assume out-of-alignment access. Architecture-mandated and SSE/2/3/MMX/Whatever alignment requirements tend to be different. You can write a very simple test case to check it out. From brado at bighillsoftware.com Tue Feb 26 02:54:04 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 25 Feb 2013 18:54:04 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> Message-ID: <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> On Feb 25, 2013, at 12:11 PM, Brad O'Hearne wrote: > However, the little nugget of info this dished out on next run might be enough to give a foothold to find the problem. It appears that the offending line that is crashing is a call to > > swri_realloc_audio > > inside of > > swr_convert. > > I've attached a small image that shows this part of the stack trace in Xcode. Does that spark any theories by the FFmpeg gurus out there? In lieu of being at a bit of a standstill for getting this resampling to work, I thought I might tap the audio gurus out there to expound a little bit on what your best guess is on how a buffer would be laid out to accommodate a sample format as the one I am being handed from capture: - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz I understand this is the QTSampleBuffer byte buffer, which is QTKit (and FWIW I have a question out on the QuickTime API mailing list about this too), but perhaps with the audio knowledge on this list you can speculate on a structure for that data, which I can verify in code. From there, perhaps with a little more guidance on how AV_SAMPLE_FMT_S16 samples are laid out, I can just write my own resampling algorithm. Any guidance is very welcome. Thanks, Brad From haridassagarn at tataelxsi.co.in Tue Feb 26 05:38:29 2013 From: haridassagarn at tataelxsi.co.in (Haridas Sagar N) Date: Tue, 26 Feb 2013 04:38:29 +0000 Subject: [Libav-user] Why (c->frame_size = 0) ? In-Reply-To: References: , Message-ID: <5773415B74E79546B5E12D008F2014B11015985D@SIXPRD0410MB396.apcprd04.prod.outlook.com> > codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); " AV_CODEC_ID_PCM_S16LE" is not the codec id it is just the sample format do you have to use AV_CODEC_ID_MP2 i guess... and can i know what exactly you are working on decoding_encoding.c example Regards Haridas Sagar N ________________________________________ From: libav-user-bounces at ffmpeg.org [libav-user-bounces at ffmpeg.org] on behalf of Paul B Mahol [onemda at gmail.com] Sent: Tuesday, February 26, 2013 12:23 AM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] Why (c->frame_size = 0) ? On 2/25/13, Joe Flowers wrote: > In the decoding_encoding.c file, I have changed > > > codec = avcodec_find_encoder(AV_CODEC_ID_MP2); > to > codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); > > > but now I get > > > "Could not allocate -22 bytes for samples buffer" > > back from > > buffer_size = av_samples_get_buffer_size(NULL, c->channels, > c->frame_size, c->sample_fmt, 0); > > > Anyone know how I can fix this problem? Without exact source code? Unlikely. > > Thanks! > > Joe > > ---------------------------------------------------- > //For AV_CODEC_ID_PCM_S16LE: > //c->channels = (2). > //c->frame_size = (0). looks wrong. > //c->sample_fmt = (1). looks wrong. > > //For AV_CODEC_ID_MP2: > //c->channels = (2). > //c->frame_size = (1152). > //c->sample_fmt = (1). looks wrong. > ----------------------------------------------------- > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you From onemda at gmail.com Tue Feb 26 10:47:30 2013 From: onemda at gmail.com (Paul B Mahol) Date: Tue, 26 Feb 2013 09:47:30 +0000 Subject: [Libav-user] Why (c->frame_size = 0) ? In-Reply-To: <5773415B74E79546B5E12D008F2014B11015985D@SIXPRD0410MB396.apcprd04.prod.outlook.com> References: <5773415B74E79546B5E12D008F2014B11015985D@SIXPRD0410MB396.apcprd04.prod.outlook.com> Message-ID: On 2/26/13, Haridas Sagar N wrote: >> codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); > " AV_CODEC_ID_PCM_S16LE" is not the codec id it is just the sample format do > you have to use AV_CODEC_ID_MP2 i guess... wrong. > > and can i know what exactly you are working on decoding_encoding.c example > > Regards > > Haridas Sagar N > ________________________________________ > From: libav-user-bounces at ffmpeg.org [libav-user-bounces at ffmpeg.org] on > behalf of Paul B Mahol [onemda at gmail.com] > Sent: Tuesday, February 26, 2013 12:23 AM > To: This list is about using libavcodec, libavformat, libavutil, > libavdevice and libavfilter. > Subject: Re: [Libav-user] Why (c->frame_size = 0) ? > > On 2/25/13, Joe Flowers wrote: >> In the decoding_encoding.c file, I have changed >> >> >> codec = avcodec_find_encoder(AV_CODEC_ID_MP2); >> to >> codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); >> >> >> but now I get >> >> >> "Could not allocate -22 bytes for samples buffer" >> >> back from >> >> buffer_size = av_samples_get_buffer_size(NULL, c->channels, >> c->frame_size, c->sample_fmt, 0); >> >> >> Anyone know how I can fix this problem? > > Without exact source code? Unlikely. > >> >> Thanks! >> >> Joe >> >> ---------------------------------------------------- >> //For AV_CODEC_ID_PCM_S16LE: >> //c->channels = (2). >> //c->frame_size = (0). > > looks wrong. > >> //c->sample_fmt = (1). > > looks wrong. > >> >> //For AV_CODEC_ID_MP2: >> //c->channels = (2). >> //c->frame_size = (1152). >> //c->sample_fmt = (1). > > looks wrong. > >> ----------------------------------------------------- >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > Notice: The information contained in this e-mail message and/or attachments > to it may contain confidential or privileged information. If you are not the > intended recipient, any dissemination, use, review, distribution, printing > or copying of the information contained in this e-mail message and/or > attachments to it are strictly prohibited. If you have received this > communication in error, please notify us by reply e-mail or telephone and > immediately and permanently delete the message and any attachments. Thank > you > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From rjvbertin at gmail.com Tue Feb 26 11:05:42 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Tue, 26 Feb 2013 11:05:42 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> Message-ID: <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> On Feb 26, 2013, at 02:21, Claudio Freire wrote: > I wouldn't assume. Even if they are in effect aligned, if the compiler > doesn't know it (ie, if malloc doesn't mark them as such), > vectorization will still assume out-of-alignment access. I may be wrong, but if that were the case (and glue code were added to ensure proper alignment), auto-vectorisation should not in that case be able to provoke a crash on win32 because of ... incorrect alignment. And yet that happens (i.e. crashes). > Architecture-mandated and SSE/2/3/MMX/Whatever alignment requirements > tend to be different. Of course, but as far as I have understood not in this case, because Apple makes such intensive use of SIMD throughout its APIs/SDKs. > > You can write a very simple test case to check it out. Done. More exactly, I was doing some comparisons of a hand-coded SIMD vs. a straightforward scalar version of functions I'd found when I discovered that gcc-4.7 has auto-vectorisation on by default (at least on OS X) because the scalar version was almost 2.5x faster than the SIMD version. That's what set the whole thing rolling, begging the question if there wouldn't be any gains (albeit undoubtedly smaller) to be had letting the compiler do its thing on the ffmpeg sources. R From joe.flowers at nofreewill.com Tue Feb 26 11:21:50 2013 From: joe.flowers at nofreewill.com (Joe Flowers) Date: Tue, 26 Feb 2013 05:21:50 -0500 Subject: [Libav-user] Why (c->frame_size = 0) ? In-Reply-To: References: Message-ID: > Without exact source code? Unlikely. It's the decoding_encoding.c file inside of ffmpeg-1.1.2.tar.gz. From onemda at gmail.com Tue Feb 26 11:40:49 2013 From: onemda at gmail.com (Paul B Mahol) Date: Tue, 26 Feb 2013 10:40:49 +0000 Subject: [Libav-user] Why (c->frame_size = 0) ? In-Reply-To: References: Message-ID: On 2/26/13, Joe Flowers wrote: >> Without exact source code? Unlikely. > > It's the decoding_encoding.c file inside of ffmpeg-1.1.2.tar.gz. So you need help what needs changed for free? Unfortunately I'm out of time to help you. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From pavel at sokolov.me Tue Feb 26 12:17:44 2013 From: pavel at sokolov.me (Pavel Sokolov) Date: Tue, 26 Feb 2013 15:17:44 +0400 Subject: [Libav-user] avio read proxy In-Reply-To: <5113B36A.8030207@sokolov.me> References: <5113B36A.8030207@sokolov.me> Message-ID: <512C99D8.70701@sokolov.me> Problem was solved with adding AVSEEK_SIZE to seek proxy function: int64_t FFmpegIoProxy::seekFunction(int64_t offset, int whence){ if (offset == 0 && whence == AVSEEK_SIZE) return avio_size(_origAvio); return avio_seek(_origAvio, offset, whence); } 07.02.2013 18:00, Pavel Sokolov ?????: > Hi! > > For some reasons I need to implement universal avio proxy, which will > support all ffmpeg protocols. > The main goal is to parse all avio_read traffic via some custom function. > > So, I create custom context with direct i/o: > > AVIOContext* _ffmpeg_io_context = avio_alloc_context(NULL, 0, > 0, // writeflag > this, //context (opaque) > readFunctionWrapper, //read > NULL , //write > seekFunctionWrapper );//seek > _ffmpeg_io_context->direct = true; > > After I open the original avio: > > AVIOContext* _origAvio = NULL; > avio_open2(&_origAvio, _url.c_str(), AVIO_FLAG_READ, NULL, NULL); > _ffmpeg_io_context->seekable = _origAvio->seekable; /// Set to custom > avio seekable flags from the original avio > > My custom functions looks like this: > > int FFmpegIoProxy::readFunction(uint8_t* buf, int buf_size){ > int res = avio_read(_origAvio, buf, buf_size); > if (res>0){ > ... do something with buf > } > return buf; > } > > int64_t FFmpegIoProxy::seekFunction(int64_t offset, int whence){ > return avio_seek(_origAvio, offset, whence); > } > > After I open avformat with custom i/o: > > _ffmpeg_format_context = avformat_alloc_context(); > _ffmpeg_format_context->pb= _ffmpeg_io_context; > avformat_open_input(&_ffmpeg_format_context, NULL, NULL, NULL); > > > Local (file://) url works fine, but when I try to open http:// > protocol I see messages: > > [http @ 0x4b97c0] HTTP error 416 Requested Range Not Satisfiable > > So, really it requesting out-of range data. > > Is somebody knows, what is wrong? May be I need to set some more > fields of my proxy avio? > -- With best regards, Pavel A. Sokolov mobile: +7(921)419-1819 skype: pavel_a_sokolov From rjvbertin at gmail.com Tue Feb 26 12:39:12 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Tue, 26 Feb 2013 12:39:12 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> Message-ID: On Feb 26, 2013, at 02:54, Brad O'Hearne wrote: expound a little bit on what your best guess is on how a buffer would be laid out to accommodate a sample format as the one I am being handed from capture: > > - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz You realise that your earlier message mentioned 32 bit float capture data? > > I understand this is the QTSampleBuffer byte buffer, which is QTKit (and FWIW I have a question out on the QuickTime API mailing list about this too), but perhaps with the audio knowledge on this list you can speculate on a structure for that data, which I can verify in code. From there, perhaps with a little more guidance on how AV_SAMPLE_FMT_S16 samples are laid out, I can just write my own resampling algorithm. If I understand correctly, you want to know how audio samples are stored in your buffer. This shouldn't be too difficult to figure out as you have only 2 channels of 1 dimensional, temporal data. That is, you know that each channel contains a sequential series of integers with 24 bit resolution (possibly size), and from what I read you know that those 2 channels are contained in a single array that you obtain from the QTKit API. All you have to do is put a short, known input signal into your capture procedure, and plot the data in your array. Use block wave at first, in counter phase between the channels. You can also save the array to file and see if a programme like Audacity can import it correctly, and with what settings. I've already gone that road to identify audio data extracted from a proprietary AV container format. R From klaussfreire at gmail.com Tue Feb 26 16:53:58 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Tue, 26 Feb 2013 12:53:58 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> Message-ID: On Tue, Feb 26, 2013 at 7:05 AM, "Ren? J.V. Bertin" wrote: > > On Feb 26, 2013, at 02:21, Claudio Freire wrote: > >> I wouldn't assume. Even if they are in effect aligned, if the compiler >> doesn't know it (ie, if malloc doesn't mark them as such), >> vectorization will still assume out-of-alignment access. > > I may be wrong, but if that were the case (and glue code were added to ensure proper alignment), auto-vectorisation should not in that case be able to provoke a crash on win32 because of ... incorrect alignment. And yet that happens (i.e. crashes). Um... AFAIR, SSE doesn't crash on misaligned access, it just performs poorly. >> Architecture-mandated and SSE/2/3/MMX/Whatever alignment requirements >> tend to be different. > > Of course, but as far as I have understood not in this case, because Apple makes such intensive use of SIMD throughout its APIs/SDKs. Ok, but intrinsics and auto-vectorization aren't the same thing, I was just wondering if gcc knew about the alignment. >> You can write a very simple test case to check it out. > > Done. More exactly, I was doing some comparisons of a hand-coded SIMD vs. a straightforward scalar version of functions I'd found when I discovered that gcc-4.7 has auto-vectorisation on by default (at least on OS X) because the scalar version was almost 2.5x faster than the SIMD version. That's what set the whole thing rolling, begging the question if there wouldn't be any gains (albeit undoubtedly smaller) to be had letting the compiler do its thing on the ffmpeg sources. I remember that thread, I just didn't get from your last post that you had actually tested. Sorry for the waste then. I guess the only possibility then is to compare the resulting assembly to try to spot why SIMD isn't outperforming scalar code. It's all in the details, but it should outperform it, if there isn't too much overhead. From rjvbertin at gmail.com Tue Feb 26 17:07:40 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Tue, 26 Feb 2013 17:07:40 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> Message-ID: <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> On Feb 26, 2013, at 16:53, Claudio Freire wrote: > Um... AFAIR, SSE doesn't crash on misaligned access, it just performs poorly. On MS Windows, that kind of access (can) provoke(s) a crash. >> Of course, but as far as I have understood not in this case, because Apple makes such intensive use of SIMD throughout its APIs/SDKs. > > Ok, but intrinsics and auto-vectorization aren't the same thing, I was > just wondering if gcc knew about the alignment. No, they aren't, though in the end they both lead to the use of MMX/SSE instructions. > I guess the only possibility then is to compare the resulting assembly > to try to spot why SIMD isn't outperforming scalar code. It's all in > the details, but it should outperform it, if there isn't too much > overhead. Overhead can be due to setting things up for using vectorised code, but it can also take other forms. Auto-vectorisation may have evolved to be able to handle more kinds of code (loops), but that still doesn't mean that anything can be vectorised (efficiently), nor that an executing app spends a significant amount of time in the parts that can be vectorised. I think that's what happens here, at least in the test suite. That doesn't mean that there is no benefit whatsoever, but I have a too limited knowledge of the different parts of the ffmpeg libs to start looking for that. When I have time I might compare builds that do not use any of the hand-coded optimisations or assembly code, to see if auto-vectorisation has a benefit there. And of course if someone has a good idea of a subsystem that doesn't yet benefit of extensive hand-coded optimisations and can provide a simple test case, I'm perfectly willing to do some comparisons. R. From brado at bighillsoftware.com Tue Feb 26 17:43:17 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 26 Feb 2013 09:43:17 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> Message-ID: <1039475C-B110-41B2-A555-A0DE1C3E986B@bighillsoftware.com> On Feb 26, 2013, at 4:39 AM, Ren? J.V. Bertin wrote: > On Feb 26, 2013, at 02:54, Brad O'Hearne wrote: >> >> - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz > > You realise that your earlier message mentioned 32 bit float capture data? Rene - thank you for your attention to detail. You are correct -- the sample format I mentioned above was a sleep-deprived copy/paste mistake. The proper sample format was as I originally stated: - Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz Thanks again for the good catch! So back to the issue at hand -- I've done a fair amount of reading on audio formats and structure, but I'm still not completely clear on the layout of these buffers depending on #of bits, channels, whether they are interleaved, and sample rate, alignment, and endianness (though with the other info this may be clear). I'm sure there are a few simple principles at work -- but if there's someone that has a good grasp of how these layouts work, I'll give it the college try to convert the sample format myself. Having said that, if anyone has any idea or suggestions for how to fix the original issue (which I've traced as far as the swri_realloc_audio call inside of swr_convert). Thanks everyone's help and discussion thus far -- it is greatly appreciated. Cheers, Brad From onemda at gmail.com Tue Feb 26 19:51:26 2013 From: onemda at gmail.com (Paul B Mahol) Date: Tue, 26 Feb 2013 18:51:26 +0000 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <1039475C-B110-41B2-A555-A0DE1C3E986B@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> <1039475C-B110-41B2-A555-A0DE1C3E986B@bighillsoftware.com> Message-ID: On 2/26/13, Brad O'Hearne wrote: > On Feb 26, 2013, at 4:39 AM, Rene J.V. Bertin wrote: > >> On Feb 26, 2013, at 02:54, Brad O'Hearne wrote: >>> >>> - Linear PCM, 24 bit little-endian signed integer, 2 channels, 44100 Hz >> >> You realise that your earlier message mentioned 32 bit float capture >> data? > > Rene - thank you for your attention to detail. You are correct -- the sample > format I mentioned above was a sleep-deprived copy/paste mistake. The proper > sample format was as I originally stated: > > - Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz > > Thanks again for the good catch! So back to the issue at hand -- I've done a > fair amount of reading on audio formats and structure, but I'm still not > completely clear on the layout of these buffers depending on #of bits, > channels, whether they are interleaved, and sample rate, alignment, and > endianness (though with the other info this may be clear). I'm sure there > are a few simple principles at work -- but if there's someone that has a > good grasp of how these layouts work, I'll give it the college try to > convert the sample format myself. > > Having said that, if anyone has any idea or suggestions for how to fix the > original issue (which I've traced as far as the swri_realloc_audio call > inside of swr_convert). > > Thanks everyone's help and discussion thus far -- it is greatly appreciated. Planar is used if sample_fmt is set to planar one - in this case for every channel, channel samples are stored in separate buffer eg. p->data[X] where X is channel number. Interleaved use only p->data[0] and every channel sample comes one after another. Samples are always considered to be in native endiannes (you need to do swapping on your own) > > > Cheers, > > Brad > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Tue Feb 26 20:26:07 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 26 Feb 2013 12:26:07 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <017B68BE-E0B6-44A6-9DCF-6865A94E8E23@bighillsoftware.com> <1039475C-B110-41B2-A555-A0DE1C3E986B@bighillsoftware.com> Message-ID: On Feb 26, 2013, at 11:51 AM, Paul B Mahol wrote: > Planar is used if sample_fmt is set to planar one - in this case for > every channel, channel samples are stored in separate buffer eg. > p->data[X] where X is channel number. > > Interleaved use only p->data[0] and every channel sample comes one > after another. > > Samples are always considered to be in native endiannes (you need to > do swapping on your own) Paul -- hey great, this is a good start for me. So if I am understanding you correctly: *** Channel layout 1) Planar channel 1 = data[0] channel 2 = data[channel 1 data length] ...etc. 2) Interleaved channel 1, sample 1 = data[0] channel 2, sample 1 = data[channel 1 sample length] ...etc. Follow up question -- if I have 2 channels in play, is there a 1:1 relationship between channel 1 and channel 2 samples? In other words, for every channel 1 sample will there be a channel 2 sample? (Obviously effects buffer lengths and interleaving). If this is so....perhaps you can expound a little more on how AV_SAMPLE_FMT_S16 is laid out (think I know, just want to confirm). Thx for your help.... Brad From brado at bighillsoftware.com Tue Feb 26 20:44:12 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 26 Feb 2013 12:44:12 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> Message-ID: <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> On Feb 25, 2013, at 12:11 PM, Brad O'Hearne wrote: > However, the little nugget of info this dished out on next run might be enough to give a foothold to find the problem. It appears that the offending line that is crashing is a call to > > swri_realloc_audio > > inside of > > swr_convert. > > I've attached a small image that shows this part of the stack trace in Xcode. Does that spark any theories by the FFmpeg gurus out there? I have what may be a stupid question here, but I've been looking curiously at another line of code upstream from my swr_convert line of code which is failing, specifically the call to this method: int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); This is being called to fill my sourceData array (allocated with av_samples_alloc) with the captured data in QTSampleBuffer. In noticing that most of these libswresample functions declare buffers as: const uint8_t *buf what does this mean for sample data that is signed? is the fill function above performing a conversion of signed sample data to its unsigned value, or am I completely missing something about the data storage for signed/unsigned data in these buffers? If not, then what is the recommended way to perform this conversion? (I'm guessing this is swr_convert -- but this regards further upstream behavior of just filling a sample array with expected data.) So one last follow on...if I was to resample a 32-bit buffer to 16-bit, what's the typical approach to losing precision -- is this a proportional rescale? Surely it isn't just truncating... Thanks for your assistance, Brad From rjvbertin at gmail.com Tue Feb 26 21:01:04 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Tue, 26 Feb 2013 21:01:04 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> Message-ID: <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> On Feb 26, 2013, at 20:44, Brad O'Hearne wrote: > > This is being called to fill my sourceData array (allocated with av_samples_alloc) with the captured data in QTSampleBuffer. In noticing that most of these libswresample functions declare buffers as: > > const uint8_t *buf > > what does this mean for sample data that is signed? is the fill function above performing a conversion of signed sample data to its I'm guessing nothing (and hoping that a fill function only copies data) ... uint8_t is just a way to say 'byte', and I presume that the const indicates that the function doesn't modify the array. What I don't dare to guess is why the void* type isn't used - is there a practical reason or only a 'programming principle' behind that? R. From steve.hart at rtsw.co.uk Tue Feb 26 18:31:19 2013 From: steve.hart at rtsw.co.uk (Steve Hart) Date: Tue, 26 Feb 2013 17:31:19 +0000 Subject: [Libav-user] Seek and record Message-ID: Hi I have a question Could anyone tell me if it is possible to play back and seek within a file that is recording. So If we have a program that starts captures video and records to disk and at the same time want to play the video to screen and (most importantly) seek within that file. (jog/shuttle etc). Is this possible? Any caveats? Cheers Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Tue Feb 26 21:34:07 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 26 Feb 2013 13:34:07 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> Message-ID: <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> On Feb 26, 2013, at 1:01 PM, Ren? J.V. Bertin wrote: > I'm guessing nothing (and hoping that a fill function only copies data) ... uint8_t is just a way to say 'byte', and I presume that the const indicates that the function doesn't modify the array. What I don't dare to guess is why the void* type isn't used - is there a practical reason or only a 'programming principle' behind that? Perhaps I've been staring at this too long and am losing my mind, but there is a difference between uint8_t and int8_t: typedef signed char int8_t typedef unsigned char uint8_t -- the sign, and max / min values of the byte. If a byte in a sample buffer is signed, say a fictional value of -1, that isn't going to be interpreted properly if assigned to a uint8_t, no? Doesn't a fictional signed range of -1 to 1 need to be translated to an unsigned range of 0 to 2? Is this accurate, or is it just lunch time? :-) Brad From nicolas.george at normalesup.org Tue Feb 26 23:04:59 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Tue, 26 Feb 2013 23:04:59 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> References: <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> Message-ID: <20130226220459.GA17946@phare.normalesup.org> > On Feb 26, 2013, at 1:01 PM, Ren? J.V. Bertin wrote: > > What I don't dare > > to guess is why the void* type isn't used - is there a practical reason > > or only a 'programming principle' behind that? You can not do pointer arithmetic with void pointers. Therefore, for some simple task (for example, copying n samples from position m to position p), having the pointer already with a suitable type avoids an additional cast. L'octidi 8 vent?se, an CCXXI, Brad O'Hearne a ?crit?: > Perhaps I've been staring at this too long and am losing my mind, but > there is a difference between uint8_t and int8_t: This difference is irrelevant for pointer arithmetic, it is only relevant when dereferencing the pointer. You are not supposed to dereference these pointers directly, you are supposed to cast them to the actual type of the samples before. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From rjvbertin at gmail.com Tue Feb 26 23:17:26 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Tue, 26 Feb 2013 23:17:26 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <20130226220459.GA17946@phare.normalesup.org> References: <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> <20130226220459.GA17946@phare.normalesup.org> Message-ID: On Feb 26, 2013, at 23:04, Nicolas George wrote: > You can not do pointer arithmetic with void pointers. Therefore, for some > simple task (for example, copying n samples from position m to position p), Other than using memcpy or memmove? ;) > having the pointer already with a suitable type avoids an additional cast. Ok, so I should have dared to guess aloud! :) From brado at bighillsoftware.com Tue Feb 26 23:27:44 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 26 Feb 2013 15:27:44 -0700 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <20130226220459.GA17946@phare.normalesup.org> References: <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> <20130226220459.GA17946@phare.normalesup.org> Message-ID: On Feb 26, 2013, at 3:04 PM, Nicolas George wrote: >> On Feb 26, 2013, at 1:01 PM, Ren? J.V. Bertin wrote: >>> What I don't dare >>> to guess is why the void* type isn't used - is there a practical reason >>> or only a 'programming principle' behind that? > > You can not do pointer arithmetic with void pointers. Therefore, for some > simple task (for example, copying n samples from position m to position p), > having the pointer already with a suitable type avoids an additional cast. > > > L'octidi 8 vent?se, an CCXXI, Brad O'Hearne a ?crit : >> Perhaps I've been staring at this too long and am losing my mind, but >> there is a difference between uint8_t and int8_t: > > This difference is irrelevant for pointer arithmetic, it is only relevant > when dereferencing the pointer. You are not supposed to dereference these > pointers directly, you are supposed to cast them to the actual type of the > samples before. Nicolas - thanks for the reply. This makes sense (more or less) to me for a planar format -- if I'm understanding you correctly, such a structure would look something like: uint8_t **data data[0]-> channel 1 buffer data[1]-> channel 2 buffer If this is right, then what does an interleaved format look like, is it like this: uint8_t **data data[0]-> buffer containing interleaved channel 1 and channel 2 data Is that correct? Thanks, Brad From joe.flowers at nofreewill.com Tue Feb 26 23:54:49 2013 From: joe.flowers at nofreewill.com (Joe Flowers) Date: Tue, 26 Feb 2013 17:54:49 -0500 Subject: [Libav-user] Why (c->frame_size = 0) ? -> Could not allocate -22 bytes for samples buffer Message-ID: Below is the relevant snippet of code from the ffmpeg's ../ffmpeg-1.1.2/doc/examples/decoding_encoding.c file. When I run "./decoding_encoding mp2", it ends with: "Could not allocate -22 bytes for samples buffer". The only thing I did was change the line codec = avcodec_find_encoder(AV_CODEC_ID_MP2); to codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); ----------------------- /* * Audio encoding example */ static void audio_encode_example(const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; AVFrame *frame; AVPacket pkt; int i, j, k, ret, got_output; int buffer_size; FILE *f; uint16_t *samples; float t, tincr; printf("Encode audio file %s\n", filename); /* find the MP2 encoder */ // codec = avcodec_find_encoder(AV_CODEC_ID_MP2); codec = avcodec_find_encoder(AV_CODEC_ID_PCM_S16LE); if (!codec) { fprintf(stderr, "Codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); if (!c) { fprintf(stderr, "Could not allocate audio codec context\n"); exit(1); } /* put sample parameters */ c->bit_rate = 64000; /* check that the encoder supports s16 pcm input */ c->sample_fmt = AV_SAMPLE_FMT_S16; if (!check_sample_fmt(codec, c->sample_fmt)) { fprintf(stderr, "Encoder does not support sample format %s", av_get_sample_fmt_name(c->sample_fmt)); exit(1); } /* select other audio parameters supported by the encoder */ c->sample_rate = select_sample_rate(codec); c->channel_layout = select_channel_layout(codec); c->channels = av_get_channel_layout_nb_channels(c->channel_layout); /* open it */ if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "Could not open codec\n"); exit(1); } f = fopen(filename, "wb"); if (!f) { fprintf(stderr, "Could not open %s\n", filename); exit(1); } /* frame containing input raw audio */ frame = avcodec_alloc_frame(); if (!frame) { fprintf(stderr, "Could not allocate audio frame\n"); exit(1); } frame->nb_samples = c->frame_size; frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; /* the codec gives us the frame size, in samples, * we calculate the size of the samples buffer in bytes */ buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, c->sample_fmt, 0); samples = av_malloc(buffer_size); if (!samples) { fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", buffer_size); exit(1); } ..... ----------------------- From nicolas.george at normalesup.org Wed Feb 27 00:15:19 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Wed, 27 Feb 2013 00:15:19 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> <20130226220459.GA17946@phare.normalesup.org> Message-ID: <20130226231519.GA3317@phare.normalesup.org> L'octidi 8 vent?se, an CCXXI, "Ren? J.V. Bertin" a ?crit?: > Other than using memcpy or memmove? ;) You still have to compute the pointers you give to memcpy/memmove, so the correct phrasing would be: *including* using memcpy or memmove. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From nicolas.george at normalesup.org Wed Feb 27 00:16:25 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Wed, 27 Feb 2013 00:16:25 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: References: <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> <20130226220459.GA17946@phare.normalesup.org> Message-ID: <20130226231625.GB3317@phare.normalesup.org> L'octidi 8 vent?se, an CCXXI, Brad O'Hearne a ?crit?: > Nicolas - thanks for the reply. This makes sense (more or less) to me for > a planar format -- if I'm understanding you correctly, such a structure > would look something like: > > uint8_t **data > data[0]-> channel 1 buffer > data[1]-> channel 2 buffer Yes. > If this is right, then what does an interleaved format look like, is it like this: > > uint8_t **data > data[0]-> buffer containing interleaved channel 1 and channel 2 data > > Is that correct? Yes. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From rjvbertin at gmail.com Wed Feb 27 00:19:43 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 27 Feb 2013 00:19:43 +0100 Subject: [Libav-user] Converting audio sample buffer format In-Reply-To: <20130226231519.GA3317@phare.normalesup.org> References: <1C868594-2C62-46FE-ABAB-30A7B9C141CB@bighillsoftware.com> <8A54690F-D939-4717-A732-4B090D305A10@bighillsoftware.com> <6D19DFBB-A519-406A-BB23-FDFC845A7453@bighillsoftware.com> <5B05353D-64E8-4F6F-9EA9-9D4C56D036D4@gmail.com> <5A23D118-4723-4ABF-9065-E03BC263D73F@bighillsoftware.com> <20130226220459.GA17946@phare.normalesup.org> <20130226231519.GA3317@phare.normalesup.org> Message-ID: On Feb 27, 2013, at 00:15, Nicolas George wrote: > L'octidi 8 vent?se, an CCXXI, "Ren? J.V. Bertin" a ?crit : >> Other than using memcpy or memmove? ;) > > You still have to compute the pointers you give to memcpy/memmove Assuming that's the case, then > correct phrasing would be: *including* using memcpy or memmove. yes, indeed. It's always annoyed me that a generic address type cannot represent things like "the Nth next address" ... R From scdmusic at gmail.com Wed Feb 27 14:19:15 2013 From: scdmusic at gmail.com (Shawn Donnelly) Date: Wed, 27 Feb 2013 08:19:15 -0500 Subject: [Libav-user] AVFormatContext buffer flush Message-ID: I have set up a custom AVIOContext that takes a callback function and writes out data to a buffer. static int WritePacket(void *opaque, uint8_t *pBuffer, int pBufferSize) { printf("Writen to file %i\n",pBufferSize); return fwrite(pBuffer, pBufferSize, 1, FileOut); } int BUFFERSIZE= 32768; AVIOContext *pAVIOContext= NULL; unsigned char *pBufferCallBack= (unsigned char*)av_malloc(BUFFERSIZE * sizeof(uint8_t)); pAVIOContext= avio_alloc_context(pBufferCallBack, BUFFERSIZE, 1, NULL, NULL, WritePacket, NULL); After avformat_write_header I would like to flush that to direct to the buffer before I write any frames to the buffer. As of now it takes a 30 frames before that buffer flushes. I need access to the header before frames are written. I tried avio_flush, but that didn't seem to do anything. Is there a way I can do this? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Wed Feb 27 17:31:37 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 27 Feb 2013 17:31:37 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> Message-ID: I've added a benchmarking option to ffmpeg, allowing to break down the time spent in various stages without dumping everything immediately as -benchmark_all does. The results are quite educative. It turns out that there is actually a slight penalty to running auto-vectorised code (probably not large enough to be due to non-optimal vectorisation due to alignment assumptions not being met). There's also a huge chunk of work that's not being benchmarked at all - and it is multithreaded. I haven't gone so far as to delve into ffmpeg.c to figure out what it corresponds to, though. The format conversion(s), maybe? For me this settles the question: better stick to not using auto-vectorisation esp. since it causes a few tests to fail. I have yet to test my modifications on MS Windows but I'd be willing to post a patch for this option (but also to admit it'd annoy me to have to adapt my cross-platform HR timing routines to ffmpeg naming conventions :( ) Benchmark results (intended to focus on decoding for playback; I'm surprised encoding to rawvideo is so expensive): > time /usr/local/FFmpeg/trunk/bin/ffmpeg-rjvb -benchmark_most -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null; \ time /usr/local/FFmpeg/trunk.vect/bin/ffmpeg-rjvb -benchmark_most -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; \ time /usr/local/FFmpeg/trunk.O0/bin/ffmpeg-rjvb -benchmark_most -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; \ time /usr/local/FFmpeg/trunk.O0vect/bin/ffmpeg-rjvb -benchmark_most -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null Detailed benchmark results: (32 bit, MMX/SSE code, -fno-tree-vectorize) samples user t kernel t real t CPU % Video decode : 85166 27.0846s 2.48361s 13.5333s 218.484% Audio decode : 152971 10.5851s 0.189161s 4.71418s 228.55% Video encode : 85164 38.3081s 0.304017s 19.4358s 198.665% Audio encode : 152969 1.12343s 0.141641s 0.581738s 217.465% Failed loops : 1 0s 1e-06s 8.64995e-07s 115.608% Weighed totals: 476271/5 15.4539s 0.604725s 7.59638s 211.398% Overall execution timing: : 1 233.666s 6.46592s 108.363s 221.6% 233.673 user_cpu 6.472 kernel_cpu 1:48.37 total_time 221.5%CPU {0W 0X 0D 0K 21553152M 37F 12625R 0I 0O 0r 0s 0k 0w 213203c} Detailed benchmark results: (32 bit, MMX/SSE code, -ftree-vectorize) samples user t kernel t real t CPU % Video decode : 85166 27.9066s 2.62058s 13.9246s 219.232% Audio decode : 152971 11.0481s 0.201142s 4.9342s 227.985% Video encode : 85164 40.3674s 0.33645s 20.4187s 199.346% Audio encode : 152969 1.23643s 0.150545s 0.602971s 230.023% Failed loops : 1 0s 0s 1.012e-06s 0% Weighed totals: 476271/5 16.1541s 0.641726s 7.91958s 212.079% Overall execution timing: : 1 246.41s 6.8878s 114.681s 220.872% 246.418 user_cpu 6.894 kernel_cpu 1:54.69 total_time 220.8%CPU {0W 0X 0D 0K 21592064M 0F 12679R 0I 0O 0r 0s 0k 0w 216849c} Detailed benchmark results: (64 bit, no MMX/SSE code, -fno-tree-vectorize) samples user t kernel t real t CPU % Video decode : 85166 199.297s 3.36215s 49.5899s 408.67% Audio decode : 152971 29.3016s 0.32553s 8.54242s 346.823% Video encode : 85164 73.5307s 0.530001s 23.1734s 319.594% Audio encode : 152969 2.49674s 0.203737s 0.718678s 375.756% Failed loops : 1 1e-06s 1e-06s 1.07e-06s 186.915% Weighed totals: 476271/5 58.9994s 0.865978s 15.9858s 374.49% Overall execution timing: : 1 535.404s 9.23317s 155.785s 349.607% 535.408 user_cpu 9.239 kernel_cpu 2:35.79 total_time 349.5%CPU {0W 0X 0D 0K 22816768M 220F 13492R 0I 0O 0r 0s 0k 0w 470931c} Detailed benchmark results: (64 bit, no MMX/SSE code, -ftree-vectorize) samples user t kernel t real t CPU % Video decode : 85166 213.686s 3.43406s 53.0596s 409.201% Audio decode : 152971 30.5476s 0.328917s 8.79987s 350.874% Video encode : 85164 74.08s 0.51521s 23.2998s 320.153% Audio encode : 152969 2.47226s 0.202298s 0.745479s 358.771% Failed loops : 1 0s 1e-06s 1.24599e-06s 80.2573% Weighed totals: 476271/5 62.0631s 0.876818s 16.7202s 376.43% Overall execution timing: : 1 558.639s 9.3095s 160.509s 353.842% 558.643 user_cpu 9.318 kernel_cpu 2:40.51 total_time 353.8%CPU {0W 0X 0D 0K 22867968M 195F 13538R 0I 0O 0r 0s 0k 0w 480915c} The test video: > /usr/local/FFmpeg/trunk/bin/ffprobe ~/Desktop/Downloads/SOA4ep11.flv ffprobe version N-50309-gaf0e814 Copyright (c) 2007-2013 the FFmpeg developers built on Feb 25 2013 19:48:25 with gcc 4.7.2 (MacPorts gcc47 4.7.2_2+universal) configuration: --prefix=/usr/local/FFmpeg/trunk --target-os=darwin --enable-shared --enable-static --enable-gpl --enable-nonfree --enable-libfreetype --enable-pthreads --enable-yasm --disable-doc --cpu=core2 --enable-debug=1 --disable-stripping --enable-ffmpeg --enable-ffprobe --disable-ffplay --enable-hwaccels --enable-libx264 --cc=gcc-mp-4.7 --disable-outdev=sdl libavutil 52. 17.103 / 52. 17.103 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.100 / 54. 63.100 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 41.100 / 3. 41.100 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, flv, from '/Users/bertin/Desktop/Downloads/SOA4ep11.flv': Metadata: canSeekToEnd : false hasCuePoints : false hasVideo : true videosize : 101806465 lasttimestamp : 3552 hasMetadata : true hasKeyframes : true metadatacreator : inlet media FLVTool2 v1.0.6 - http://www.inlet-media.de/flvtool2 hasAudio : true audiodelay : 0 lastkeyframetimestamp: 3539 datasize : 139300867 audiosize : 37480392 Duration: 00:59:11.99, start: 0.042000, bitrate: 315 kb/s Stream #0:0: Video: h264 (High), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 232 kb/s, 23.98 tbr, 1k tbn, 47.95 tbc Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp, 82 kb/s From klaussfreire at gmail.com Wed Feb 27 17:37:32 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Wed, 27 Feb 2013 13:37:32 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> Message-ID: On Wed, Feb 27, 2013 at 1:31 PM, "Ren? J.V. Bertin" wrote: > For me this settles the question: better stick to not using auto-vectorisation esp. since it causes a few tests to fail. > > I have yet to test my modifications on MS Windows but I'd be willing to post a patch for this option (but also to admit it'd annoy me to have to adapt my cross-platform HR timing routines to ffmpeg naming conventions :( ) > ... > Detailed benchmark results: (32 bit, MMX/SSE code, -fno-tree-vectorize) > samples user t kernel t real t CPU % > Video decode : 85166 27.0846s 2.48361s 13.5333s 218.484% Wait... 200%... what's your hardware like? If by any chance you have Hyper Threading enabled (which is quite likely), then I bet that's what the penalty is coming from (there's only one SIMD execution unit, and thus no real parallelization of SIMD code, whereas float code can be run in parallel with hand-optimized SIMD code or other integer code). From rjvbertin at gmail.com Wed Feb 27 17:46:11 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 27 Feb 2013 17:46:11 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> Message-ID: <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> On Feb 27, 2013, at 17:37, Claudio Freire wrote: >> Detailed benchmark results: (32 bit, MMX/SSE code, -fno-tree-vectorize) >> samples user t kernel t real t CPU % >> Video decode : 85166 27.0846s 2.48361s 13.5333s 218.484% > > > Wait... 200%... what's your hardware like? > > If by any chance you have Hyper Threading enabled (which is quite > likely), then I bet that's what the penalty is coming from (there's Ah, ok. I have a dual core, hyper-threaded i7 . Do you think there's an interest other than academic to deactivate hyper threading? R. From klaussfreire at gmail.com Wed Feb 27 17:56:33 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Wed, 27 Feb 2013 13:56:33 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> Message-ID: On Wed, Feb 27, 2013 at 1:46 PM, "Ren? J.V. Bertin" wrote: > On Feb 27, 2013, at 17:37, Claudio Freire wrote: > >>> Detailed benchmark results: (32 bit, MMX/SSE code, -fno-tree-vectorize) >>> samples user t kernel t real t CPU % >>> Video decode : 85166 27.0846s 2.48361s 13.5333s 218.484% >> >> >> Wait... 200%... what's your hardware like? >> >> If by any chance you have Hyper Threading enabled (which is quite >> likely), then I bet that's what the penalty is coming from (there's > > Ah, ok. I have a dual core, hyper-threaded i7 . Do you think there's an interest other than academic to deactivate hyper threading? I think it's just academic. It would be one mystery less. Perhaps it would be easier trying to disable threading in ffmpeg and re-running the benchmark. From rjvbertin at gmail.com Wed Feb 27 18:11:14 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 27 Feb 2013 18:11:14 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> Message-ID: <8F992173-227B-41E3-8A84-6960CF2FC3B7@gmail.com> On Feb 27, 2013, at 17:56, Claudio Freire wrote: > Perhaps it would be easier trying to disable threading in ffmpeg and > re-running the benchmark. All I have to do is use the Processor preference pane, or do > hwprefs cpu_ht=False so it's not like it's hard to do. Maybe when I go down for diner... R. From rjvbertin at gmail.com Wed Feb 27 22:58:34 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Wed, 27 Feb 2013 22:58:34 +0100 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> Message-ID: <56CD08B0-4FEC-441D-B96E-0036B58F044B@gmail.com> On Feb 27, 2013, at 17:56, Claudio Freire wrote: > I think it's just academic. It would be one mystery less. In the end I decided to go a step further than disabling HT - I forced the use of a single thread. And a mystery less? Actually, no: > time /usr/local/FFmpeg/trunk/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.vect/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.O0/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.O0vect/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null Detailed benchmark results: samples user t kernel t real t CPU % Video decode : 85162 85.4759s 0.11533s 85.7097s 99.8618% Audio decode : 152971 3.66945s 0.095735s 3.74859s 100.443% Video encode : 85164 14.9526s 0.090322s 15.0694s 99.8241% Audio encode : 152969 0.341693s 0.08129s 0.392368s 107.803% Failed loops : 1 0s 1e-06s 7.03003e-07s 142.247% Weighed totals: 476267/5 19.2462s 0.0936312s 19.3505s 99.9444% Overall execution timing: : 1 152.645s 2.5378s 155.699s 99.6688% 152.655 user_cpu 2.553 kernel_cpu 2:36.18 total_time 99.3%CPU {0W 0X 0D 0K 12974080M 604F 7590R 10I 0O 0r 0s 0k 36w 1676c} Detailed benchmark results: samples user t kernel t real t CPU % Video decode : 85162 87.1021s 0.118153s 87.3188s 99.8872% Audio decode : 152971 3.7146s 0.095249s 3.79602s 100.364% Video encode : 85164 15.2192s 0.091017s 15.3272s 99.8888% Audio encode : 152969 0.338267s 0.08176s 0.390411s 107.586% Failed loops : 1 1e-06s 1e-06s 1.21299e-06s 164.882% Weighed totals: 476267/5 19.598s 0.0942551s 19.699s 99.9659% Overall execution timing: : 1 155.574s 2.53883s 158.133s 99.9877% 155.580 user_cpu 2.544 kernel_cpu 2:38.14 total_time 99.9%CPU {0W 0X 0D 0K 12974080M 50F 8144R 0I 0O 0r 0s 0k 1w 1592c} Detailed benchmark results: samples user t kernel t real t CPU % Video decode : 85162 198.603s 0.194156s 198.966s 99.9148% Audio decode : 152971 4.72838s 0.091876s 4.80426s 100.333% Video encode : 85164 15.6997s 0.084267s 15.8032s 99.8786% Audio encode : 152969 0.316537s 0.07774s 0.364985s 108.026% Failed loops : 1 0s 0s 6.47007e-07s 0% Weighed totals: 476267/5 39.9402s 0.104264s 40.0636s 99.9521% Overall execution timing: : 1 254.731s 2.65197s 258.002s 99.76% 254.736 user_cpu 2.662 kernel_cpu 4:18.40 total_time 99.6%CPU {0W 0X 0D 0K 13543424M 624F 7796R 8I 0O 0r 0s 0k 21w 2877c} Detailed benchmark results: samples user t kernel t real t CPU % Video decode : 85162 208.447s 0.196297s 208.806s 99.9218% Audio decode : 152971 4.89258s 0.094659s 4.97187s 100.309% Video encode : 85164 15.7334s 0.090704s 15.8499s 99.8372% Audio encode : 152969 0.326942s 0.077216s 0.378373s 106.815% Failed loops : 1 1e-06s 1e-06s 7.37025e-07s 271.361% Weighed totals: 476267/5 41.7625s 0.106523s 41.8896s 99.9509% Overall execution timing: : 1 265.295s 2.69075s 268.599s 99.7717% 265.301 user_cpu 2.699 kernel_cpu 4:28.80 total_time 99.6%CPU {0W 0X 0D 0K 13570048M 630F 7804R 9I 0O 0r 0s 0k 18w 2904c} From qiuju828 at gmail.com Thu Feb 28 04:28:01 2013 From: qiuju828 at gmail.com (=?GB2312?B?1cXApLHy?=) Date: Thu, 28 Feb 2013 11:28:01 +0800 Subject: [Libav-user] how to use HW acclerator? Message-ID: I am a newer. I want to decode h264 with DXVA2. What should I do? any documents about DXVA2? TKS. -------------- next part -------------- An HTML attachment was scrubbed... URL: From svetlana.olonetsky at gmail.com Thu Feb 28 10:11:31 2013 From: svetlana.olonetsky at gmail.com (Svetlana Olonetsky) Date: Thu, 28 Feb 2013 11:11:31 +0200 Subject: [Libav-user] how to allow '-strict -2' in C++ Message-ID: Hi Everyone, I can not find how to enable ffmpeg to work with experimental codec (equivalent to ffmpeg -strict -2). Suggestions ? Thank you, Svetlana -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Feb 28 10:17:57 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 28 Feb 2013 09:17:57 +0000 (UTC) Subject: [Libav-user] how to allow '-strict -2' in C++ References: Message-ID: Svetlana Olonetsky writes: > I can not find how to enable ffmpeg to work with experimental > codec (equivalent to ffmpeg?-strict -2). See AVCodecContext:strict_std_compliance in avcodec.h Carl Eugen From krueger at lesspain.de Thu Feb 28 10:27:26 2013 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Thu, 28 Feb 2013 10:27:26 +0100 Subject: [Libav-user] Fastest possible stream parsing Message-ID: Hi, what is the fastest possible way to retrieve things like frame type information with ffmpeg api? I would like to write code that does things like - retrieve frame type information (I,B,P) for an MPEG2 stream - retrieve keyframe positions for H.264 (for formats that do not store this info in the container or where no index is implemented in libavformat) The only thing I found was setting the two AVCodecContext fields skip_idct and skip_loop_filter to AVDISCARD_ALL but the speed gains were only around 5% in my tests, so I would assume there is still a lot of decoding happening. Is there any way to suppress the actual decoding of picture data and just parse e.g. a transport stream and metadata in the bitstream with public API? Thanks, Robert From svetlana.olonetsky at gmail.com Thu Feb 28 10:28:50 2013 From: svetlana.olonetsky at gmail.com (Svetlana Olonetsky) Date: Thu, 28 Feb 2013 11:28:50 +0200 Subject: [Libav-user] how to allow '-strict -2' in C++ In-Reply-To: References: Message-ID: Thank you ! On Thu, Feb 28, 2013 at 11:17 AM, Carl Eugen Hoyos wrote: > Svetlana Olonetsky writes: > > > I can not find how to enable ffmpeg to work with experimental > > codec (equivalent to ffmpeg -strict -2). > > See AVCodecContext:strict_std_compliance in avcodec.h > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zyvj at qq.com Thu Feb 28 10:32:45 2013 From: zyvj at qq.com (=?ISO-8859-1?B?VG9jeQ==?=) Date: Thu, 28 Feb 2013 17:32:45 +0800 Subject: [Libav-user] Fastest possible stream parsing Message-ID: i think you can consider av_parser_parse2 function ------------------ Original ------------------ From: "Robert Kr?ger"; Date: Thu, Feb 28, 2013 05:27 PM To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: [Libav-user] Fastest possible stream parsing Hi, what is the fastest possible way to retrieve things like frame type information with ffmpeg api? I would like to write code that does things like - retrieve frame type information (I,B,P) for an MPEG2 stream - retrieve keyframe positions for H.264 (for formats that do not store this info in the container or where no index is implemented in libavformat) The only thing I found was setting the two AVCodecContext fields skip_idct and skip_loop_filter to AVDISCARD_ALL but the speed gains were only around 5% in my tests, so I would assume there is still a lot of decoding happening. Is there any way to suppress the actual decoding of picture data and just parse e.g. a transport stream and metadata in the bitstream with public API? Thanks, Robert _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From krueger at lesspain.de Thu Feb 28 12:35:19 2013 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Thu, 28 Feb 2013 12:35:19 +0100 Subject: [Libav-user] Fastest possible stream parsing In-Reply-To: References: Message-ID: On Thu, Feb 28, 2013 at 10:32 AM, Tocy wrote: > i think you can consider av_parser_parse2 function > That looks indeed promising. I will try that. Thank you! Robert From julian.herrera at tvgenius.net Thu Feb 28 12:53:52 2013 From: julian.herrera at tvgenius.net (Julian Herrera) Date: Thu, 28 Feb 2013 11:53:52 +0000 Subject: [Libav-user] Dump unmodified MPEGTS from RTSP streaming server Message-ID: <512F4550.1060100@tvgenius.net> Hello, I'm relatively new to development with libav but has already managed to create an iOS-based video player for DVB-S (MPEGTS) streams that are delivered by a set-top box via RTSP. After few modifications to libav, it is now able to download and play the stream directly from the box. Now I have to implement time-shifting so I intend to use a local file to store the stream as a circular buffer of fixed size. Please note that the box's RTSP server only supports PLAY, not pause or anything useful. My problem is that I cannot figure out how to dump the MPEG-TS stream unmodified to a local file. I'm not really sure at what point should I store the current packet's pkt->data to a file in such a way that at the end the file will be perfectly played as an mpegts movie. I'm not sure even if pkt->data holds enough information to reconstruct the mpegts movie sequentially as the packets are being read. In the process I don't need to transcode anything, just need to store a table of timestamps/byte positions for the time-shifting to work. I'd appreciate if someone could share some ideas. Thank you! Julian Herrera From cehoyos at ag.or.at Thu Feb 28 13:02:35 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 28 Feb 2013 12:02:35 +0000 (UTC) Subject: [Libav-user] Dump unmodified MPEGTS from RTSP streaming server References: <512F4550.1060100@tvgenius.net> Message-ID: Julian Herrera writes: > After few modifications to libav, it is now able to > download and play the stream directly from the box. Please don't forget to send any bug-fixes to ffmpeg-devel. I can't really comment on the stream-dump question from a FFmpeg point-of-view, but afaict, you should simply start dumping everything that comes from the protocol reader to a file as soon as the user starts time-shift. Carl Eugen From julian.herrera at tvgenius.net Thu Feb 28 13:11:41 2013 From: julian.herrera at tvgenius.net (Julian Herrera) Date: Thu, 28 Feb 2013 12:11:41 +0000 Subject: [Libav-user] Dump unmodified MPEGTS from RTSP streaming server In-Reply-To: References: <512F4550.1060100@tvgenius.net> Message-ID: <512F497D.5070004@tvgenius.net> On 28/02/2013 12:02, Carl Eugen Hoyos wrote: > Julian Herrera writes: > >> After few modifications to libav, it is now able to >> download and play the stream directly from the box. > > Please don't forget to send any bug-fixes to ffmpeg-devel. > Thank you for your quick reply! I don't think the modifications I've done are really bug-fixes, it's just this box that has an unofficial way to setup RTSP streams. > I can't really comment on the stream-dump question from > a FFmpeg point-of-view, but afaict, you should simply start > dumping everything that comes from the protocol reader to > a file as soon as the user starts time-shift. > > Carl Eugen > I've tried to save into a file whatever pkt->data contains at the end of the rtsp_read_packet() function. But the result isn't a playable mpegts file, unfortunately. I don't know what I'm missing. Julian Herrera From klaussfreire at gmail.com Thu Feb 28 16:35:35 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Thu, 28 Feb 2013 12:35:35 -0300 Subject: [Libav-user] gcc auto-vectorisation In-Reply-To: <56CD08B0-4FEC-441D-B96E-0036B58F044B@gmail.com> References: <04DFEC58-B58E-480B-BFD5-4A50539F9D9A@bighillsoftware.com> <925DF358-EAA0-4BC4-B77B-F2C92C91C68C@bighillsoftware.com> <7ed04152-9e87-4ad8-8ad5-0f4aa1e01495@email.android.com> <5B4DB99E-2148-4A81-8B4F-17953A8A2F74@gmail.com> <0433DB18-381D-4A8A-830E-4DB0221FDE16@gmail.com> <1F38D5E1-0424-4B9F-AE59-39ADC3EACECB@gmail.com> <9BF4DFAF-9714-4F74-B4EF-1C32E2924218@gmail.com> <7FE1A296-20A0-4E40-9EEC-C9E728A55AE2@gmail.com> <56CD08B0-4FEC-441D-B96E-0036B58F044B@gmail.com> Message-ID: On Wed, Feb 27, 2013 at 6:58 PM, "Ren? J.V. Bertin" wrote: > On Feb 27, 2013, at 17:56, Claudio Freire wrote: > >> I think it's just academic. It would be one mystery less. > > In the end I decided to go a step further than disabling HT - I forced the use of a single thread. And a mystery less? Actually, no: > >> time /usr/local/FFmpeg/trunk/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.vect/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.O0/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null ; time /usr/local/FFmpeg/trunk.O0vect/bin/ffmpeg-rjvb -benchmark_most -threads 1 -y -v 0 -i ~/Desktop/Downloads/SOA4ep11.flv -pix_fmt argb -vcodec rawvideo -acodec pcm_f32le -f mov /dev/null (snipped bench results) I guess this means hand-optimized vectorization has been applied where it matters, and -ftree-vectorize only vectorizes unimportant code sections. Whether the perceived slowing after vectorization is statistically significant or not is another matter. And if it is, perhaps the compiler guys should be made aware of it.