From gbstack08 at gmail.com Sun Dec 1 06:54:19 2013 From: gbstack08 at gmail.com (Mark Ma) Date: Sun, 01 Dec 2013 13:54:19 +0800 Subject: [Libav-user] Encoding flv video by libavcodec not working In-Reply-To: <52935492.4030904@gmail.com> References: <52935492.4030904@gmail.com> Message-ID: <529ACF0B.3030100@gmail.com> On 2013/11/25 21:45, Mark Ma wrote: > Hi, everyone. > I'm trying to use libavcodec to encode a flv video. Following code is > a sample code to generate a mpeg video, it works well. But after > replacing the codec ID with AV_CODEC_ID_FLV1, the generated video file > cannot be played. > > I opened the generated file and checked the first 4 bytes (previous > tag size), but it's not 0. I'm curious whether converted packet is > valid flv packet? > Any suggestion is appreciated. > > (Code) > |void simpleEncode(){ > AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_MPEG1VIDEO); > AVCodecContext *ctx = avcodec_alloc_context3(codec); > ctx->bit_rate = 400000; > ctx->width = 352; > ctx->height = 288; > AVRational time_base = {1,25}; > ctx->time_base = time_base; > ctx->gop_size = 10; > ctx->pix_fmt = AV_PIX_FMT_YUV420P; > > avcodec_open2(ctx, codec, NULL); > > AVFrame *frame = av_frame_alloc(); > av_image_alloc(frame->data, frame->linesize, ctx->width, ctx->height, ctx->pix_fmt, 32); > frame->format = ctx->pix_fmt; > frame->height = ctx->height; > frame->width = ctx->width; > > AVPacket pkt; > int got_output; > FILE *f = fopen("test.mpg", "wb"); > for(int i=0; i<25; i++){ > av_init_packet(&pkt); > pkt.data = NULL; > pkt.size = 0; > > for(int w=0; wwidth; w++){ > for(int h=0; hheight; h++){ > frame->data[0][h*frame->linesize[0]+w]=i*10; > } > } > for(int w=0; wwidth/2; w++){ > for(int h=0; hheight/2; h++){ > frame->data[1][h*frame->linesize[1]+w]=i*10; > frame->data[2][h*frame->linesize[2]+w]=i*10; > } > } > > frame->pts=i; > avcodec_encode_video2(ctx, &pkt, frame, &got_output); > > fwrite(pkt.data, 1, pkt.size, f); > } > }| Now it's solved by adding flv file header and tag header manually in the code. -------------- next part -------------- An HTML attachment was scrubbed... URL: From adishavit at gmail.com Sun Dec 1 11:43:27 2013 From: adishavit at gmail.com (Adi Shavit) Date: Sun, 1 Dec 2013 12:43:27 +0200 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: References: Message-ID: Does anyone have any insights or some references I should follow regarding this issue? On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit wrote: > Hi, > > I am consuming a multi-program transport stream with several video > streams and decoding them simultaneously. This works well. > > I am currently doing it al on a single thread. > Each AVPacket received by av_read_frame() is checked for the relevant > stream_index and passed to a *corresponding* decoder. > Hence, I have one AVCodecContext per decoded elementary stream. Each such > AVCodecContext handles one elementary stream, calling > avcodec_decode_video2() etc. > > The current single threaded design means that the next packet isn't > decoded until the one before it is decoded. > I'd like to move to a multi-threaded design where each AVCodecContext > resides in a separate thread with its own AVPacket (concurrent SPSC-)queue > and the master thread calls av_read_frame() and inserts the coded packet > into the relevant queue (Actor Model / Erlang style). > Note that each elementary stream is always decoded by the same single > thread. > > Before I refactor my code to do this, I'd like to know if there is > anything on the avlib side *preventing* me from implementing this > approach. > > - AVPacket is a pointer to internal and external data. Are there any > such data that are shared between elementary streams? > - What should I beware of? > > Please advise, > Thanks, > Adi > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From safiuddinkhan at gmail.com Sun Dec 1 14:02:43 2013 From: safiuddinkhan at gmail.com (Safi ud Din Khan) Date: Sun, 01 Dec 2013 18:02:43 +0500 Subject: [Libav-user] Hardware Accelerated Decoding In-Reply-To: <20131130190526.08afc86b@debian> References: <529882E8.6010008@gmail.com> <20131130190526.08afc86b@debian> Message-ID: <529B3373.7080000@gmail.com> Hey thank you for the help i have finally successfully implemented hardware acceleration inside my program all thanks to you On 11/30/2013 11:05 PM, wm4 wrote: > On Fri, 29 Nov 2013 17:04:56 +0500 > Safi ud Din Khan wrote: > >> Hello i am interested in doing hardware accelerated decoding for my >> ffmpeg based multimedia program using VA API .... i am kind of a >> beginner and does not understand very well as how VAAPI interacts with >> ffmpeg libraries .... what i have seen from the source code of ffmpeg is >> that some parts of VAAPI (decoding parts) are already implemented inside >> ffmpeg source code (libavcodec/vaapi.c and others) ...... > It's complicated. ffmpeg.c now supports hardware decoding too (it's > mostly an "example"), see: > > http://git.videolan.org/?p=ffmpeg.git;a=blob;f=ffmpeg_vdpau.c > > For VAAPI is relatively similar, but the patches for ffmpeg.c vaapi > support have not been merged yet, but see the series of patches > starting here: > > http://lists.libav.org/pipermail/libav-devel/2013-November/053307.html > > (Note that these just read the decoded video back to CPU RAM, which is > of course inefficient and only serves as a way to somehow use the > decoded data within the ffmpeg.c/avconv.c utilities.) > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From ahqzy at 163.com Mon Dec 2 02:32:31 2013 From: ahqzy at 163.com (=?utf-8?Q?ahqzy=40163.com?=) Date: Mon, 2 Dec 2013 09:32:31 +0800 Subject: [Libav-user] =?utf-8?Q?=E5=9B=9E=E5=A4=8D=3A=E5=9B=9E=E5=A4=8D=3Awhat's__?=the extradata should be when using ffmpeg+libstagefright? Message-ID: <5befa170-b60e-45b7-8831-86acdeebb7b5@qzy-ip5> ? ????iPhone ?2013-12-02(tel:2013-12-02) 09:32:16.16,ahqzy at 163.com??: anybody can help? ????iPhone ?2013-11-24(tel:2013-11-24) 17:05:04.4,ahqzy at 163.com??: Hi all, To using hardware decoding, I compiled ffmpeg(0.10) with andorid libstagefright successfully. When I call it, in the Stagefright_init(AVCodecContext *avctx), the extradata must be specified as below in the source: static av_cold int Stagefright_init(AVCodecContext *avctx) { ?? ?? if (!avctx->extradata || !avctx->extradata_size || avctx->extradata[0] != 1) return -1; ?? } I dont't konw how to fill the avctx->extradata, anyone can help me? -------------- next part -------------- An HTML attachment was scrubbed... URL: From gbstack08 at gmail.com Mon Dec 2 04:14:25 2013 From: gbstack08 at gmail.com (Mark Ma) Date: Mon, 02 Dec 2013 11:14:25 +0800 Subject: [Libav-user] =?utf-8?b?5Zue5aSNOuWbnuWkjTp3aGF0J3MgIHRoZSBleHRy?= =?utf-8?q?adata_should_be_when_using_ffmpeg+libstagefright=3F?= In-Reply-To: <5befa170-b60e-45b7-8831-86acdeebb7b5@qzy-ip5> References: <5befa170-b60e-45b7-8831-86acdeebb7b5@qzy-ip5> Message-ID: <529BFB11.2050500@gmail.com> On 2013/12/2 9:32, ahqzy at 163.com wrote: > > ? > > > ????iPhone > > ?2013-12-02 09:32:16.16,ahqzy at 163.com??: > > ------------------------------------------------------------------------ > > anybody can help? > > > ????iPhone > > ?2013-11-24 17:05:04.4,ahqzy at 163.com??: > > ------------------------------------------------------------------------ > Hi all, > To using hardware decoding, I compiled ffmpeg(0.10) with > andorid libstagefright successfully. When I call it, in the > Stagefright_init(AVCodecContext *avctx), the extradata must be > specified as below in the source: > > static av_cold int Stagefright_init(AVCodecContext *avctx) > { > ?? > ?? > if (!avctx->extradata || !avctx->extradata_size || > avctx->extradata[0] != 1) > return -1; > ?? > } > I dont't konw how to fill the avctx->extradata, anyone can help me? > > > > > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user Please stop spamming -------------- next part -------------- An HTML attachment was scrubbed... URL: From hatalyak.gyula at artklikk.hu Mon Dec 2 17:29:14 2013 From: hatalyak.gyula at artklikk.hu (=?ISO-8859-1?Q?Gyula_Hataly=E1k?=) Date: Mon, 2 Dec 2013 17:29:14 +0100 Subject: [Libav-user] Measure sent bytes to network Message-ID: Hi! How do I measure sent bytes to network by avformat? I am streaming out in flv (rtmp) format to a remote host. I use av_interleaved_write_frame to write packets to flv format. As I know av_interleaved_write_frame returns immediately. So I don't know how much data have been actually sent to network by the underlying levels in avformat. Any best practice? Thanks in advance, Gyula -------------- next part -------------- An HTML attachment was scrubbed... URL: From me at robertobaibich.com Mon Dec 2 19:22:46 2013 From: me at robertobaibich.com (Roberto Baibich) Date: Mon, 2 Dec 2013 13:22:46 -0500 Subject: [Libav-user] Buffering a specific channel position Message-ID: Hi guys, I'm working on an iOS app that allows people to turn specific channels on or off while playing videos with surround audio tracks. I'm using kxmovie ( https://github.com/kolyvan/kxmovie) as the base for it. The render callback on the audio unit is currently calling swresample, which is remixing sound to match the 2-ch output of the Apple remote I/O. As you probably know, different audio codecs encode their channels in different orders, so I can't just always ask for the second channel in an audio track, for example. Is there a way for me to get a specific audio channel in mono (e.g. ask for surround left and let ffmpeg figure out which one it is for the selected codec) or to get it to set a default channel order and reorder it if the format doesn't match it (which would then allow me to always point to the same channel number if I want the surround left channel, for example). Right now this is the code I have for the buffer: - (kxMovieError) openAudioStream: (NSInteger) audioStream { AVCodecContext *codecCtx = _formatCtx->streams[audioStream]->codec; SwrContext *swrContext = NULL; AVCodec *codec = avcodec_find_decoder(codecCtx->codec_id); if(!codec) return kxMovieErrorCodecNotFound; if (avcodec_open2(codecCtx, codec, NULL) < 0) return kxMovieErrorOpenCodec; if (!audioCodecIsSupported(codecCtx)) { id audioManager = [KxAudioManager audioManager]; swrContext = swr_alloc_set_opts(NULL, av_get_default_channel_layout(audioManager.numOutputChannels), AV_SAMPLE_FMT_S16, audioManager.samplingRate, av_get_default_channel_layout(codecCtx->channels), codecCtx->sample_fmt, codecCtx->sample_rate, 0, NULL); if (!swrContext || swr_init(swrContext)) { if (swrContext) swr_free(&swrContext); avcodec_close(codecCtx); return kxMovieErroReSampler; } } _audioFrame = avcodec_alloc_frame(); if (!_audioFrame) { if (swrContext) swr_free(&swrContext); avcodec_close(codecCtx); return kxMovieErrorAllocateFrame; } _audioStream = audioStream; _audioCodecCtx = codecCtx; _swrContext = swrContext; AVStream *st = _formatCtx->streams[_audioStream]; avStreamFPSTimeBase(st, 0.025, 0, &_audioTimeBase); return kxMovieErrorNone; } Can you help me out? Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From carbonkrissa at gmail.com Mon Dec 2 03:36:58 2013 From: carbonkrissa at gmail.com (Krissa Carbon) Date: Mon, 2 Dec 2013 10:36:58 +0800 Subject: [Libav-user] FFMPEG Ported to iOS and Use Segment Function Message-ID: Good day. I have been trying to implement a video segmenter in objective-c for an application on iPhone. I see that the ffmpeg has all the things I need such as encoders when used in a terminal of a pc. I have already ported the ffmpeg codes to be used in iOS. I would like to ask if you can give me tips on how can I trace the encoding and segmentation process in the ffmpeg code so I can mimic this process in iOS. the command I use to encode and segment my file using mac terminal is: ffmpeg -i -vcodec libx264 -acodec libfaac -r 29.97 -profile:v baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts -segment_list_type m3u8 segment%05d.ts or ffmpeg -i -c copy -bsf h264_mp4toannexb -r 29.97 -profile:v baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts -segment_list_type m3u8 segment%05d.ts *Krissa G. Carbon* think. create. inspire. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefasab at gmail.com Mon Dec 2 20:23:25 2013 From: stefasab at gmail.com (Stefano Sabatini) Date: Mon, 2 Dec 2013 20:23:25 +0100 Subject: [Libav-user] FFMPEG Ported to iOS and Use Segment Function In-Reply-To: References: Message-ID: <20131202192325.GC12474@barisone> On date Monday 2013-12-02 10:36:58 +0800, Krissa Carbon encoded: > Good day. > > I have been trying to implement a video segmenter in objective-c for an > application on iPhone. I see that the ffmpeg has all the things I need such > as encoders when used in a terminal of a pc. > > I have already ported the ffmpeg codes to be used in iOS. I would like to > ask if you can give me tips on how can I trace the encoding and > segmentation process in the ffmpeg code so I can mimic this process in iOS. > > the command I use to encode and segment my file using mac terminal is: > > ffmpeg -i -vcodec libx264 -acodec libfaac -r 29.97 -profile:v > baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k > -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f > segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts > -segment_list_type m3u8 segment%05d.ts > > or > > ffmpeg -i -c copy -bsf h264_mp4toannexb -r 29.97 -profile:v > baseline -b:v 2048k -maxrate 2048k -minrate 2048k -bufsize 2048k > -force_key_frames 'expr:gte(t,n_forced*1)' -map 0 -flags -global_header -f > segment -segment_list index.m3u8 -segment_time 1 -segment_format mpeg_ts > -segment_list_type m3u8 segment%05d.ts All the segmenter relevant code is in libavformat/segment.c, and it's relatively simple. -force_key_frames is implemented in ffmpeg.c, but you can easily emulate the behavior forcing the key_frame flag in the frame passed to the encoder according to custom application logic. Note that if you are using libavformat, you can directly use the segment muxer. From bruce at spearmorgan.com Mon Dec 2 22:46:47 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Mon, 2 Dec 2013 13:46:47 -0800 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: References: Message-ID: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> On Dec 1, 2013, at 2:43 AM, Adi Shavit wrote: > Does anyone have any insights or some references I should follow regarding this issue? Adi, are you aware that ffmpeg does/can employ multi-threaded decoding already? If you set the correct number of threads by setting thread_count in your avcodeccontext before opening the codec, it will do exactly what you propose. In effect, the first few decode calls will return immediately, then your frames will start to come out, having been delayed by the number of threads you requested. Bruce > > > On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit wrote: > Hi, > > I am consuming a multi-program transport stream with several video streams and decoding them simultaneously. This works well. > > I am currently doing it al on a single thread. > Each AVPacket received by av_read_frame() is checked for the relevant stream_index and passed to a corresponding decoder. > Hence, I have one AVCodecContext per decoded elementary stream. Each such AVCodecContext handles one elementary stream, calling avcodec_decode_video2() etc. > > The current single threaded design means that the next packet isn't decoded until the one before it is decoded. > I'd like to move to a multi-threaded design where each AVCodecContext resides in a separate thread with its own AVPacket (concurrent SPSC-)queue and the master thread calls av_read_frame() and inserts the coded packet into the relevant queue (Actor Model / Erlang style). > Note that each elementary stream is always decoded by the same single thread. > > Before I refactor my code to do this, I'd like to know if there is anything on the avlib side preventing me from implementing this approach. > AVPacket is a pointer to internal and external data. Are there any such data that are shared between elementary streams? > What should I beware of? > Please advise, > Thanks, > Adi > > > > _______________________________________________ > 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 chisholm at mitre.org Mon Dec 2 23:22:07 2013 From: chisholm at mitre.org (Michael Chisholm) Date: Mon, 2 Dec 2013 17:22:07 -0500 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> Message-ID: <529D080F.4020303@mitre.org> Sounds like he wants multiple decoders running simultaneously on different threads, and you're saying that a single decoder can use multiple threads. Not quite the same thing. I use multiple encoders, in my case, simultaneously in different threads, and it works fine. I think decoders should work fine too. One thing I do is register a custom locking function via av_lockmgr_register() just in case some bit of internal library code wants to serialize threads through a critical section. Regarding the packet question, I found the following commentary in avformat.h (from ffmpeg 2.0.1): * If AVPacket.buf is set on the returned packet, then the packet is * allocated dynamically and the user may keep it indefinitely. * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a * static storage somewhere inside the demuxer and the packet is only valid * until the next av_read_frame() call or closing the file. If the caller * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy * of it. * In both cases, the packet must be freed with av_free_packet() when it is no * longer needed. I think you can make this work. As far as I've seen, the code has been written with concurrency in mind. Andy On 12/2/2013 4:46 PM, Bruce Wheaton wrote: > On Dec 1, 2013, at 2:43 AM, Adi Shavit wrote: > >> Does anyone have any insights or some references I should follow regarding this issue? > > Adi, are you aware that ffmpeg does/can employ multi-threaded decoding already? If you set the correct number of threads by setting thread_count in your avcodeccontext before opening the codec, it will do exactly what you propose. > > In effect, the first few decode calls will return immediately, then your frames will start to come out, having been delayed by the number of threads you requested. > > Bruce > > >> >> >> On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit wrote: >> Hi, >> >> I am consuming a multi-program transport stream with several video streams and decoding them simultaneously. This works well. >> >> I am currently doing it al on a single thread. >> Each AVPacket received by av_read_frame() is checked for the relevant stream_index and passed to a corresponding decoder. >> Hence, I have one AVCodecContext per decoded elementary stream. Each such AVCodecContext handles one elementary stream, calling avcodec_decode_video2() etc. >> >> The current single threaded design means that the next packet isn't decoded until the one before it is decoded. >> I'd like to move to a multi-threaded design where each AVCodecContext resides in a separate thread with its own AVPacket (concurrent SPSC-)queue and the master thread calls av_read_frame() and inserts the coded packet into the relevant queue (Actor Model / Erlang style). >> Note that each elementary stream is always decoded by the same single thread. >> >> Before I refactor my code to do this, I'd like to know if there is anything on the avlib side preventing me from implementing this approach. >> AVPacket is a pointer to internal and external data. Are there any such data that are shared between elementary streams? >> What should I beware of? >> Please advise, >> Thanks, >> Adi >> >> >> >> _______________________________________________ >> 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 mtaha.ansari at gmail.com Tue Dec 3 06:30:59 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Tue, 3 Dec 2013 10:30:59 +0500 Subject: [Libav-user] Measure sent bytes to network In-Reply-To: References: Message-ID: When you call av_interleaved_write_frame(oc, &pkt), pkt.size contains the number of bytes sent/written, you can use/accumulate this on your end for a quicker implementation... On Mon, Dec 2, 2013 at 9:29 PM, Gyula Hataly?k wrote: > Hi! > > How do I measure sent bytes to network by avformat? > I am streaming out in flv (rtmp) format to a remote host. > I use av_interleaved_write_frame to write packets to flv format. > As I know av_interleaved_write_frame returns immediately. > So I don't know how much data have been actually sent to network by the > underlying levels in avformat. > Any best practice? > > Thanks in advance, > Gyula > > _______________________________________________ > 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 adishavit at gmail.com Tue Dec 3 08:12:14 2013 From: adishavit at gmail.com (Adi Shavit) Date: Tue, 3 Dec 2013 09:12:14 +0200 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> Message-ID: As Andy explained I want multiple decoders for different elementary streams running simultaneously on different threads. What you are suggesting should improve the performance of (each) single decoder. Thanks, Adi On Mon, Dec 2, 2013 at 11:46 PM, Bruce Wheaton wrote: > On Dec 1, 2013, at 2:43 AM, Adi Shavit wrote: > > Does anyone have any insights or some references I should follow regarding > this issue? > > > Adi, are you aware that ffmpeg does/can employ multi-threaded decoding > already? If you set the correct number of threads by setting thread_count in > your avcodeccontext before opening the codec, it will do exactly what you > propose. > > In effect, the first few decode calls will return immediately, then your > frames will start to come out, having been delayed by the number of threads > you requested. > > Bruce > > > > > On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit wrote: > >> Hi, >> >> I am consuming a multi-program transport stream with several video >> streams and decoding them simultaneously. This works well. >> >> I am currently doing it al on a single thread. >> Each AVPacket received by av_read_frame() is checked for the relevant >> stream_index and passed to a *corresponding* decoder. >> Hence, I have one AVCodecContext per decoded elementary stream. Each such >> AVCodecContext handles one elementary stream, calling >> avcodec_decode_video2() etc. >> >> The current single threaded design means that the next packet isn't >> decoded until the one before it is decoded. >> I'd like to move to a multi-threaded design where each AVCodecContext >> resides in a separate thread with its own AVPacket (concurrent SPSC-)queue >> and the master thread calls av_read_frame() and inserts the coded packet >> into the relevant queue (Actor Model / Erlang style). >> Note that each elementary stream is always decoded by the same single >> thread. >> >> Before I refactor my code to do this, I'd like to know if there is >> anything on the avlib side *preventing* me from implementing this >> approach. >> >> - AVPacket is a pointer to internal and external data. Are there any >> such data that are shared between elementary streams? >> - What should I beware of? >> >> Please advise, >> Thanks, >> Adi >> >> >> > _______________________________________________ > 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 adishavit at gmail.com Tue Dec 3 08:13:15 2013 From: adishavit at gmail.com (Adi Shavit) Date: Tue, 3 Dec 2013 09:13:15 +0200 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <529D080F.4020303@mitre.org> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> <529D080F.4020303@mitre.org> Message-ID: Then that sounds like it should work. Thanks! Adi On Tue, Dec 3, 2013 at 12:22 AM, Michael Chisholm wrote: > Sounds like he wants multiple decoders running simultaneously on different > threads, and you're saying that a single decoder can use multiple threads. > Not quite the same thing. > > I use multiple encoders, in my case, simultaneously in different threads, > and it works fine. I think decoders should work fine too. One thing I do > is register a custom locking function via av_lockmgr_register() just in > case some bit of internal library code wants to serialize threads through a > critical section. > > Regarding the packet question, I found the following commentary in > avformat.h (from ffmpeg 2.0.1): > > * If AVPacket.buf is set on the returned packet, then the packet is > * allocated dynamically and the user may keep it indefinitely. > * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a > * static storage somewhere inside the demuxer and the packet is only valid > * until the next av_read_frame() call or closing the file. If the caller > * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed > copy > * of it. > * In both cases, the packet must be freed with av_free_packet() when it is > no > * longer needed. > > I think you can make this work. As far as I've seen, the code has been > written with concurrency in mind. > > Andy > > > On 12/2/2013 4:46 PM, Bruce Wheaton wrote: > >> On Dec 1, 2013, at 2:43 AM, Adi Shavit wrote: >> >> Does anyone have any insights or some references I should follow >>> regarding this issue? >>> >> >> Adi, are you aware that ffmpeg does/can employ multi-threaded decoding >> already? If you set the correct number of threads by setting thread_count >> in your avcodeccontext before opening the codec, it will do exactly what >> you propose. >> >> In effect, the first few decode calls will return immediately, then your >> frames will start to come out, having been delayed by the number of threads >> you requested. >> >> Bruce >> >> >> >>> >>> On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit wrote: >>> Hi, >>> >>> I am consuming a multi-program transport stream with several video >>> streams and decoding them simultaneously. This works well. >>> >>> I am currently doing it al on a single thread. >>> Each AVPacket received by av_read_frame() is checked for the relevant >>> stream_index and passed to a corresponding decoder. >>> Hence, I have one AVCodecContext per decoded elementary stream. Each >>> such AVCodecContext handles one elementary stream, calling >>> avcodec_decode_video2() etc. >>> >>> The current single threaded design means that the next packet isn't >>> decoded until the one before it is decoded. >>> I'd like to move to a multi-threaded design where each AVCodecContext >>> resides in a separate thread with its own AVPacket (concurrent SPSC-)queue >>> and the master thread calls av_read_frame() and inserts the coded packet >>> into the relevant queue (Actor Model / Erlang style). >>> Note that each elementary stream is always decoded by the same single >>> thread. >>> >>> Before I refactor my code to do this, I'd like to know if there is >>> anything on the avlib side preventing me from implementing this approach. >>> AVPacket is a pointer to internal and external data. Are there any such >>> data that are shared between elementary streams? >>> What should I beware of? >>> Please advise, >>> Thanks, >>> Adi >>> >>> >>> >>> _______________________________________________ >>> 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 antoine at nagafix.co.uk Tue Dec 3 08:36:05 2013 From: antoine at nagafix.co.uk (Antoine Martin) Date: Tue, 03 Dec 2013 14:36:05 +0700 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <529D080F.4020303@mitre.org> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> <529D080F.4020303@mitre.org> Message-ID: <529D89E5.603@nagafix.co.uk> > I use multiple encoders, in my case, simultaneously in different > threads, and it works fine. I think decoders should work fine too. > One thing I do is register a custom locking function via > av_lockmgr_register() just in case some bit of internal library code > wants to serialize threads through a critical section. Can someone please clarify for me when using "av_lockmgr_register" is required as I am not 100% sure I understand: on what types of builds (win32threads? pthreads? all?) and under what circumstances? (encoders, decoders, both? type of streams?) Maybe it's always required and we've just not really hit the problem yet because we don't use multi-clients often.. (each client gets its own encoding thread). And multiple contexts from the same thread works just fine. Thanks Antoine > > Regarding the packet question, I found the following commentary in > avformat.h (from ffmpeg 2.0.1): > > * If AVPacket.buf is set on the returned packet, then the packet is > * allocated dynamically and the user may keep it indefinitely. > * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a > * static storage somewhere inside the demuxer and the packet is only > valid > * until the next av_read_frame() call or closing the file. If the caller > * requires a longer lifetime, av_dup_packet() will make an > av_malloc()ed copy > * of it. > * In both cases, the packet must be freed with av_free_packet() when > it is no > * longer needed. > > I think you can make this work. As far as I've seen, the code has > been written with concurrency in mind. > > Andy > > On 12/2/2013 4:46 PM, Bruce Wheaton wrote: >> On Dec 1, 2013, at 2:43 AM, Adi Shavit wrote: >> >>> Does anyone have any insights or some references I should follow >>> regarding this issue? >> >> Adi, are you aware that ffmpeg does/can employ multi-threaded >> decoding already? If you set the correct number of threads by setting >> thread_count in your avcodeccontext before opening the codec, it will >> do exactly what you propose. >> >> In effect, the first few decode calls will return immediately, then >> your frames will start to come out, having been delayed by the number >> of threads you requested. >> >> Bruce >> >> >>> >>> >>> On Tue, Nov 26, 2013 at 9:15 PM, Adi Shavit >>> wrote: >>> Hi, >>> >>> I am consuming a multi-program transport stream with several >>> video streams and decoding them simultaneously. This works well. >>> >>> I am currently doing it al on a single thread. >>> Each AVPacket received by av_read_frame() is checked for the >>> relevant stream_index and passed to a corresponding decoder. >>> Hence, I have one AVCodecContext per decoded elementary stream. Each >>> such AVCodecContext handles one elementary stream, calling >>> avcodec_decode_video2() etc. >>> >>> The current single threaded design means that the next packet isn't >>> decoded until the one before it is decoded. >>> I'd like to move to a multi-threaded design where each >>> AVCodecContext resides in a separate thread with its own AVPacket >>> (concurrent SPSC-)queue and the master thread calls av_read_frame() >>> and inserts the coded packet into the relevant queue (Actor Model / >>> Erlang style). >>> Note that each elementary stream is always decoded by the same >>> single thread. >>> >>> Before I refactor my code to do this, I'd like to know if there is >>> anything on the avlib side preventing me from implementing this >>> approach. >>> AVPacket is a pointer to internal and external data. Are there any >>> such data that are shared between elementary streams? >>> What should I beware of? >>> Please advise, >>> Thanks, >>> Adi >>> >>> >>> >>> _______________________________________________ >>> 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 From g.georgak at gmail.com Tue Dec 3 10:50:20 2013 From: g.georgak at gmail.com (george georgakarakos) Date: Tue, 3 Dec 2013 11:50:20 +0200 Subject: [Libav-user] multichannel decoding Message-ID: Hi, Does anybody know if it is possible to use multichannel decoding with ffmpeg? Multichannel meaning that i would like to invoke a video decoder and use different input streams and switch between them during decoding so that a decoder decodes one frame from a sequence then a frame from a second sequence etc... Thanks george -------------- next part -------------- An HTML attachment was scrubbed... URL: From adishavit at gmail.com Tue Dec 3 11:33:41 2013 From: adishavit at gmail.com (Adi Shavit) Date: Tue, 3 Dec 2013 12:33:41 +0200 Subject: [Libav-user] multichannel decoding In-Reply-To: References: Message-ID: See my previous thread(s). You need one decoder per-stream. On Tue, Dec 3, 2013 at 11:50 AM, george georgakarakos wrote: > Hi, > > Does anybody know if it is possible to use multichannel decoding with > ffmpeg? > > Multichannel meaning that i would like to invoke a video decoder and use > different input streams and switch between them during decoding so that a > decoder decodes one frame from a sequence then a frame from a second > sequence etc... > > Thanks > > george > > _______________________________________________ > 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 g.georgak at gmail.com Tue Dec 3 12:13:59 2013 From: g.georgak at gmail.com (george georgakarakos) Date: Tue, 3 Dec 2013 13:13:59 +0200 Subject: [Libav-user] multichannel decoding In-Reply-To: References: Message-ID: Hi, i would actually like to have one decoder for all streams with switching input per frame for example. is there a way to do it with ffmpeg? or then i can just create a mixed stream manually... On Tue, Dec 3, 2013 at 12:33 PM, Adi Shavit wrote: > See my previous thread(s). > You need one decoder per-stream. > > > On Tue, Dec 3, 2013 at 11:50 AM, george georgakarakos > wrote: > >> Hi, >> >> Does anybody know if it is possible to use multichannel decoding with >> ffmpeg? >> >> Multichannel meaning that i would like to invoke a video decoder and use >> different input streams and switch between them during decoding so that a >> decoder decodes one frame from a sequence then a frame from a second >> sequence etc... >> >> Thanks >> >> george >> >> _______________________________________________ >> 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 Dec 3 12:17:35 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 3 Dec 2013 11:17:35 +0000 (UTC) Subject: [Libav-user] multichannel decoding References: Message-ID: Adi Shavit writes: > See my previous thread(s). > You need one decoder per-stream. I don't disagree but I suspect this is not needed if the input stream is intra-only. Please do not top-post here, Carl Eugen From hatalyak.gyula at artklikk.hu Tue Dec 3 19:05:10 2013 From: hatalyak.gyula at artklikk.hu (=?ISO-8859-1?Q?Gyula_Hataly=E1k?=) Date: Tue, 3 Dec 2013 19:05:10 +0100 Subject: [Libav-user] Measure sent bytes to network In-Reply-To: References: Message-ID: Thanks for your reply, but this is not what I am looking for. Since I am streaming out to network, I want to know whether I overload (e.g. exceed) the network bandwith limit. So it would be useful to see/check how many packets/data have been succesfully written to the network. Should I examine the AVIOContext's buffer and related fields? I started to do this, but it is not that straightforward. Any extra hints? :) Thanks in advance, Gyula On Tue, Dec 3, 2013 at 6:30 AM, Taha Ansari wrote: > When you call av_interleaved_write_frame(oc, &pkt), pkt.size contains the > number of bytes sent/written, you can use/accumulate this on your end for a > quicker implementation... > > > On Mon, Dec 2, 2013 at 9:29 PM, Gyula Hataly?k > wrote: > >> Hi! >> >> How do I measure sent bytes to network by avformat? >> I am streaming out in flv (rtmp) format to a remote host. >> I use av_interleaved_write_frame to write packets to flv format. >> As I know av_interleaved_write_frame returns immediately. >> So I don't know how much data have been actually sent to network by the >> underlying levels in avformat. >> Any best practice? >> >> Thanks in advance, >> Gyula >> >> _______________________________________________ >> 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 chisholm at mitre.org Tue Dec 3 19:13:48 2013 From: chisholm at mitre.org (Michael Chisholm) Date: Tue, 3 Dec 2013 13:13:48 -0500 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <529D89E5.603@nagafix.co.uk> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> <529D080F.4020303@mitre.org> <529D89E5.603@nagafix.co.uk> Message-ID: <529E1F5C.4020105@mitre.org> On 12/3/2013 2:36 AM, Antoine Martin wrote: > >> I use multiple encoders, in my case, simultaneously in different >> threads, and it works fine. I think decoders should work fine too. >> One thing I do is register a custom locking function via >> av_lockmgr_register() just in case some bit of internal library code >> wants to serialize threads through a critical section. > Can someone please clarify for me when using "av_lockmgr_register" is > required as I am not 100% sure I understand: on what types of builds > (win32threads? pthreads? all?) and under what circumstances? (encoders, > decoders, both? type of streams?) > Maybe it's always required and we've just not really hit the problem yet > because we don't use multi-clients often.. (each client gets its own > encoding thread). And multiple contexts from the same thread works just > fine. > I can't give an official answer, but awhile back during development of my tool, I started seeing warning messages from ffmpeg about insufficient locking. I looked into the source and I remember there was a simple check: a counter incremented on entry to a function, and decremented on exit. If the counter ever went greater than 1, the warning was generated. It's a simple concurrency check, independent of thread library. That led me to the av_lockmgr_register() function, which I used to make the warning go away. I peeked into the ffmpeg source again, and I see it being used in avcodec_open2(), as an example. The doxygen docs say that function is not thread safe, but it appears to have some locking code which could make it thread-safe as long as you've registered a locking function. See libavcodec/utils.c. Andy From andrey.krieger.utkin at gmail.com Tue Dec 3 19:37:13 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Tue, 3 Dec 2013 20:37:13 +0200 Subject: [Libav-user] Multithreaded decoding of multi-program transport streams In-Reply-To: <529E1F5C.4020105@mitre.org> References: <4535F805-B414-4132-A4CE-0649436D0461@spearmorgan.com> <529D080F.4020303@mitre.org> <529D89E5.603@nagafix.co.uk> <529E1F5C.4020105@mitre.org> Message-ID: 2013/12/3 Michael Chisholm : > On 12/3/2013 2:36 AM, Antoine Martin wrote: >> Can someone please clarify for me when using "av_lockmgr_register" is >> required as I am not 100% sure I understand: on what types of builds >> (win32threads? pthreads? all?) and under what circumstances? (encoders, >> decoders, both? type of streams?) >> Maybe it's always required and we've just not really hit the problem yet >> because we don't use multi-clients often.. (each client gets its own >> encoding thread). And multiple contexts from the same thread works just >> fine. >> > > I can't give an official answer, but awhile back during development of my > tool, I started seeing warning messages from ffmpeg about insufficient > locking. I looked into the source and I remember there was a simple check: > a counter incremented on entry to a function, and decremented on exit. If > the counter ever went greater than 1, the warning was generated. It's a > simple concurrency check, independent of thread library. That led me to the > av_lockmgr_register() function, which I used to make the warning go away. > > I peeked into the ffmpeg source again, and I see it being used in > avcodec_open2(), as an example. The doxygen docs say that function is not > thread safe, but it appears to have some locking code which could make it > thread-safe as long as you've registered a locking function. See > libavcodec/utils.c. That's user-settable callback function to avoid implementing locking for all supported platforms inside of libavcodec. Used nearly the only thing - opening new AVCodecContext. -- Andrey Utkin From mtaha.ansari at gmail.com Wed Dec 4 07:16:24 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Wed, 4 Dec 2013 11:16:24 +0500 Subject: [Libav-user] Measure sent bytes to network In-Reply-To: References: Message-ID: On Tue, Dec 3, 2013 at 11:05 PM, Gyula Hataly?k wrote: > Thanks for your reply, but this is not what I am looking for. > Since I am streaming out to network, I want to know whether I overload > (e.g. exceed) the network bandwith limit. > Since in your original post, you mention: "I am streaming out in flv (rtmp) format to a remote host." RTMP uses TCP protocol, so transmission is guaranteed; so if library says bytes were written, we may assume they are. link: http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol > So it would be useful to see/check how many packets/data have been > succesfully written to the network. > Should I examine the AVIOContext's buffer and related fields? I started to > do this, but it is not that straightforward. > Any extra hints? :) > In case you want to implement more robust application for detecting packets transmission, you might try to use libpcap/winpcap library, which is designed for such kind of purposes. link: http://en.wikipedia.org/wiki/Winpcap > Thanks in advance, > Gyula > > > On Tue, Dec 3, 2013 at 6:30 AM, Taha Ansari wrote: > >> When you call av_interleaved_write_frame(oc, &pkt), pkt.size contains the >> number of bytes sent/written, you can use/accumulate this on your end for a >> quicker implementation... >> >> >> On Mon, Dec 2, 2013 at 9:29 PM, Gyula Hataly?k < >> hatalyak.gyula at artklikk.hu> wrote: >> >>> Hi! >>> >>> How do I measure sent bytes to network by avformat? >>> I am streaming out in flv (rtmp) format to a remote host. >>> I use av_interleaved_write_frame to write packets to flv format. >>> As I know av_interleaved_write_frame returns immediately. >>> So I don't know how much data have been actually sent to network by the >>> underlying levels in avformat. >>> Any best practice? >>> >>> Thanks in advance, >>> Gyula >>> >>> _______________________________________________ >>> 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 noreply+1282336166 at badoo.com Wed Dec 4 09:59:01 2013 From: noreply+1282336166 at badoo.com (Badoo) Date: Wed, 4 Dec 2013 08:59:01 +0000 Subject: [Libav-user] =?utf-8?q?=E2=98=85_This_list_is_about_using_libavco?= =?utf-8?q?dec=2C_libavformat=2C_libavutil=2C_libavdevice_and_libav?= =?utf-8?b?ZmlsdGVyLiwgQWx2aWQg0L7RgdGC0LDQstC40Lsg0LTQu9GPINCy0LA=?= =?utf-8?b?0YEg0YHQvtC+0LHRidC10L3QuNC1?= Message-ID: Alvid ??????? ??? ??? ????????? ?????????? ? ??????????? ????????? ????? ?????? ???. ?? ?????? ????????? ????????? ? ???????? ?? ???? ????? ??? ???. ????? ??????, ??? ??? ????????, ?????? ????????? ?? ??????: http://eu1.badoo.com/0348780594/in/cuDDlHUPHoo/?lang_id=2&g=57-0-4&m=21&mid=529eeed3000000000002000002af5bd301d7c8e70056 ??? ???? ??????? ? ????: ?????? (?????-?????????, ??????) Natasha (?????-?????????, ??????) ????????? (?????-?????????, ??????) http://eu1.badoo.com/0348780594/in/cuDDlHUPHoo/?lang_id=2&g=57-1-4&m=21&mid=529eeed3000000000002000002af5bd301d7c8e70056 ???? ?????? ?? ????????, ?????????? ? ???????? ?? ? ???????? ?????? ????????. ??? ?????? ???????? ?????? ????????? ???????? ????????? ?? Alvid. ???? ?? ???????? ??? ?????? ?? ??????, ?????? ?????????????? ???. ????? ????????? ????? ????????? ????? ???????. ?????! ??????? Badoo ?? ???????? ??? ?????? ?? Badoo Trading Limited (???????? ????? ????). ???? ?? ?? ?????? ???????? ??????????? ?? Badoo, ??????? ?????: https://eu1.badoo.com/impersonation.phtml?lang_id=2&email=libav-user%40ffmpeg.org&block_code=e2d241&m=21&mid=529eeed3000000000002000002af5bd301d7c8e70056&g=0-0-4. Badoo Trading Limited ???????????????? ? ?????? ? ?????? ??? ??????? CRN 7540255 ?? ???????????? ??????: Media Village, 131 - 151 Great Titchfield Street, London, W1W 5BB. -------------- next part -------------- An HTML attachment was scrubbed... URL: From arshdeep.kaur at drishinfo.com Wed Dec 4 11:30:15 2013 From: arshdeep.kaur at drishinfo.com (Arshdeep Kaur) Date: Wed, 04 Dec 2013 16:00:15 +0530 Subject: [Libav-user] extract the offset between the start of audio and first frame of video Message-ID: <529F0437.6050003@drishinfo.com> I am using ffmpeg library in vs 2010, I need to extract the offset between the start of audio and first frame of video. I am trying using:- | avcodec_decode_video2(pCodecCtx,pFrame,&got_picture,&pkt); av_read_frame(pFormatCtx,&pkt); av_free_packet(&pkt); int frrr=pkt.dts*timebase; //int *gptr=NULL; avcodec_decode_audio4(pCodecCtx,pFrame,&got_frame,&pkt); //avcodec_decode_video2(pCodecCtx,pFrame,&got_picture,&pkt); av_read_frame(pFormatCtx,&pkt);| AND then finding the difference between video and audio pts. But i am not getting correct value. Can anybody tell the correct way. -------------- next part -------------- An HTML attachment was scrubbed... URL: From hatalyak.gyula at artklikk.hu Wed Dec 4 17:16:50 2013 From: hatalyak.gyula at artklikk.hu (=?ISO-8859-1?Q?Gyula_Hataly=E1k?=) Date: Wed, 4 Dec 2013 17:16:50 +0100 Subject: [Libav-user] Measure sent bytes to network In-Reply-To: References: Message-ID: As I know every format has its own packet write function. Thus rtmp format has its own. It might be synchronous (blocking) or asynchronous (non-blocking). I assume a network format has an internal buffer as a FIFO queue to store packets and then send them to network as network capacity / bandwidth allows. I assume RTMP format has a non-blocking write function. Please agree or disagree if you know something certain about this. What I want to know whether this buffer is going to overflow or is in balance. Read-write flow must be balanced otherwise buffer will overflow. On Wed, Dec 4, 2013 at 7:16 AM, Taha Ansari wrote: > > > > On Tue, Dec 3, 2013 at 11:05 PM, Gyula Hataly?k < > hatalyak.gyula at artklikk.hu> wrote: > >> Thanks for your reply, but this is not what I am looking for. >> Since I am streaming out to network, I want to know whether I overload >> (e.g. exceed) the network bandwith limit. >> > > Since in your original post, you mention: > > > "I am streaming out in flv (rtmp) format to a remote host." > > RTMP uses TCP protocol, so transmission is guaranteed; so if library says > bytes were written, we may assume they are. link: > http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol > > >> So it would be useful to see/check how many packets/data have been >> succesfully written to the network. >> Should I examine the AVIOContext's buffer and related fields? I started >> to do this, but it is not that straightforward. >> Any extra hints? :) >> > > In case you want to implement more robust application for detecting > packets transmission, you might try to use libpcap/winpcap library, which > is designed for such kind of purposes. link: > http://en.wikipedia.org/wiki/Winpcap > > >> Thanks in advance, >> Gyula >> >> >> On Tue, Dec 3, 2013 at 6:30 AM, Taha Ansari wrote: >> >>> When you call av_interleaved_write_frame(oc, &pkt), pkt.size contains >>> the number of bytes sent/written, you can use/accumulate this on your end >>> for a quicker implementation... >>> >>> >>> On Mon, Dec 2, 2013 at 9:29 PM, Gyula Hataly?k < >>> hatalyak.gyula at artklikk.hu> wrote: >>> >>>> Hi! >>>> >>>> How do I measure sent bytes to network by avformat? >>>> I am streaming out in flv (rtmp) format to a remote host. >>>> I use av_interleaved_write_frame to write packets to flv format. >>>> As I know av_interleaved_write_frame returns immediately. >>>> So I don't know how much data have been actually sent to network by the >>>> underlying levels in avformat. >>>> Any best practice? >>>> >>>> Thanks in advance, >>>> Gyula >>>> >>>> _______________________________________________ >>>> 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 eric.beuque at gmail.com Thu Dec 5 10:33:11 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Thu, 5 Dec 2013 10:33:11 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close Message-ID: Hi, i'm using libavcodec from FFMpeg 1.1.2. I'm decoding MJPEG stream. My problem is that i need to keep a reference to the decoded frame, after the codec close. But when using avcodec_close, it freed the AVFrame data. Here a sample program showing the function i use: int main(int argc, char **argv) { int bGotPicture; avcodec_register_all(); AVCodec* pCodec = avcodec_find_decoder (CODEC_ID_MJPEG); AVCodecContext* pAVContext = avcodec_alloc_context3 (pCodec); avcodec_open2(pAVContext, pCodec, NULL); AVPacket packet; av_init_packet (&packet); size_t iSize; std::string content = get_file_contents("../img1.jpg", iSize); packet.data = (unsigned char*)content.c_str(); packet.size = iSize; AVFrame* pFrame = avcodec_alloc_frame(); avcodec_decode_video2 (pAVContext, pFrame, &bGotPicture, &packet); // Here pFrame->data is valid av_free_packet(&packet); avcodec_close(pAVContext); av_free(pAVContext); // Here pFrame->data has been freed, access may crash av_free(pFrame); pFrame = NULL; } How i can tell libavcodec that i want to become the owner of the data and be able to free it, to without codec context instance? I was thinking about using get/release_buffer functions, but i don't know how to compute size of the data. Is data memcpy the only way to do this? Note, that i also can't upgrade to new version of FFMPEG. Thanks for your help. -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Thu Dec 5 12:41:17 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 5 Dec 2013 12:41:17 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: Message-ID: On 12/5/13, Eric Beuque wrote: > Hi, i'm using libavcodec from FFMpeg 1.1.2. > > I'm decoding MJPEG stream. My problem is that i need to keep a reference to > the decoded frame, after the codec close. But when using avcodec_close, it > freed the AVFrame data. > > Here a sample program showing the function i use: > > int main(int argc, char **argv) > { > int bGotPicture; > > avcodec_register_all(); > > AVCodec* pCodec = avcodec_find_decoder (CODEC_ID_MJPEG); > AVCodecContext* pAVContext = avcodec_alloc_context3 (pCodec); > > avcodec_open2(pAVContext, pCodec, NULL); > > AVPacket packet; > av_init_packet (&packet); > > size_t iSize; > std::string content = get_file_contents("../img1.jpg", iSize); > packet.data = (unsigned char*)content.c_str(); > packet.size = iSize; > > AVFrame* pFrame = avcodec_alloc_frame(); > avcodec_decode_video2 (pAVContext, pFrame, &bGotPicture, &packet); > > // Here pFrame->data is valid > > av_free_packet(&packet); > avcodec_close(pAVContext); > av_free(pAVContext); > > // Here pFrame->data has been freed, access may crash > > av_free(pFrame); > pFrame = NULL; > } > > How i can tell libavcodec that i want to become the owner of the data and > be able to free it, to without codec context instance? I was thinking about > using get/release_buffer functions, but i don't know how to compute size of > the data. > > Is data memcpy the only way to do this? > > Note, that i also can't upgrade to new version of FFMPEG. > > Thanks for your help. > Use reference counting system. They you need to manually free frame once you will not need it (otherwise you leak memory), so you do not need to do copy. From perez.didac at gmail.com Thu Dec 5 12:52:57 2013 From: perez.didac at gmail.com (=?ISO-8859-1?Q?D=EDdac_P=E9rez?=) Date: Thu, 5 Dec 2013 12:52:57 +0100 Subject: [Libav-user] My code stops at avformat_find_stream_info() Message-ID: Dear all, I am using ffmpeg to retrieve the RTSP stream from a network IP camera, concretely a Bosch Dinion HD 720p. When I run my code, it stucks in *avformat_find_stream_info()* even if I set *context->max_analyze_duration = 0*. I would like to know: 1. how can I solve it? 2. why my code doesn't stop with an Axis network camera? 3. is it mandatory to use this method? Thank you so much! -- D?dac P?rez -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrew.sherepenko at gmail.com Thu Dec 5 13:01:38 2013 From: andrew.sherepenko at gmail.com (Andrew Sherepenko) Date: Thu, 05 Dec 2013 14:01:38 +0200 Subject: [Libav-user] Live video stream playback is too fast In-Reply-To: <52A06ACF.8070600@intropro.com> References: <52A06ACF.8070600@intropro.com> Message-ID: <52A06B22.4070903@gmail.com> Hi all, Now I'm working on live transcoding from MPEG-TS to MP4 and streaming output data into the browser and playing it in HTML video tag. I've already finished transcoding routine (video copying from ts container to mp4 in h264; audio converted from ac3 5.1 to mp3 stereo). But I have a problem with video playing speed in the browser (video playback is too fast) when I send transcoded data chunk by chunk (using Chunked HTTP header). I have read many forums and docs but I cannot found any solution. http://www.mail-archive.com/libav-user at ffmpeg.org/msg02263.html http://www.mail-archive.com/libav-user at ffmpeg.org/msg01833.html http://stackoverflow.com/questions/13504905/video-too-fast-ffmpeg http://stackoverflow.com/questions/19060253/files-created-with-a-direct-stream-copy-using-ffmpegs-libavformat-api-play-back You can see the links with smth similar. But these solutions don't help to me. And an interesting fact. When the same movie playing from the browser cache video playing speed is correct. So I think the problem can be in some metadata, that send in the end. For streaming I use fragmented MP4 format. May be somebody have the same problem or can give any advice how to find a solution. Thank you in advance, Andrew Sherepenko -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Dec 5 13:08:59 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 5 Dec 2013 12:08:59 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?My_code_stops_at_avformat=5Ffind=5Fstream?= =?utf-8?b?X2luZm8oKQ==?= References: Message-ID: D?dac P?rez writes: > I am using ffmpeg to retrieve the RTSP stream from a > network IP camera, concretely a Bosch Dinion HD 720p. > > When I run my code, it stucks in?avformat_find_stream_info() Is this reproducible with ffmpeg (the application)? Carl Eugen From perez.didac at gmail.com Thu Dec 5 13:26:16 2013 From: perez.didac at gmail.com (=?ISO-8859-1?Q?D=EDdac_P=E9rez?=) Date: Thu, 5 Dec 2013 13:26:16 +0100 Subject: [Libav-user] My code stops at avformat_find_stream_info() In-Reply-To: References: Message-ID: I am using the snapshot 20130706, Windows built from Zeranoe. Yes, ffplay is not able to play the stream, but VLC can play it! This is the output of ffplay. C:\Program Files\IMAGSA\AtalaiaControlSoftware\ffmpeg>ffplay rtsp:// 192.168.1.19 8/video ffplay version N-54499-g63d7684 Copyright (c) 2003-2013 the FFmpeg developers built on Jul 6 2013 10:32:51 with gcc 4.7.3 (GCC) configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --ena ble-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --e nable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --e nable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 38.100 / 52. 38.100 libavcodec 55. 18.102 / 55. 18.102 libavformat 55. 11.101 / 55. 11.101 libavdevice 55. 2.100 / 55. 2.100 libavfilter 3. 78.102 / 3. 78.102 libswscale 2. 3.100 / 2. 3.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 3.100 / 52. 3.100 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 -- D?dac P?rez 2013/12/5 Carl Eugen Hoyos > D?dac P?rez writes: > > > I am using ffmpeg to retrieve the RTSP stream from a > > network IP camera, concretely a Bosch Dinion HD 720p. > > > > When I run my code, it stucks in avformat_find_stream_info() > > Is this reproducible with ffmpeg (the application)? > > 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 eric.beuque at gmail.com Thu Dec 5 13:33:18 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Thu, 5 Dec 2013 13:33:18 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: Message-ID: On Thu, Dec 5, 2013 at 12:41 PM, Paul B Mahol wrote: > On 12/5/13, Eric Beuque wrote: > > Hi, i'm using libavcodec from FFMpeg 1.1.2. > > > > I'm decoding MJPEG stream. My problem is that i need to keep a reference > to > > the decoded frame, after the codec close. But when using avcodec_close, > it > > freed the AVFrame data. > > > > Here a sample program showing the function i use: > > > > int main(int argc, char **argv) > > { > > int bGotPicture; > > > > avcodec_register_all(); > > > > AVCodec* pCodec = avcodec_find_decoder (CODEC_ID_MJPEG); > > AVCodecContext* pAVContext = avcodec_alloc_context3 (pCodec); > > > > avcodec_open2(pAVContext, pCodec, NULL); > > > > AVPacket packet; > > av_init_packet (&packet); > > > > size_t iSize; > > std::string content = get_file_contents("../img1.jpg", iSize); > > packet.data = (unsigned char*)content.c_str(); > > packet.size = iSize; > > > > AVFrame* pFrame = avcodec_alloc_frame(); > > avcodec_decode_video2 (pAVContext, pFrame, &bGotPicture, &packet); > > > > // Here pFrame->data is valid > > > > av_free_packet(&packet); > > avcodec_close(pAVContext); > > av_free(pAVContext); > > > > // Here pFrame->data has been freed, access may crash > > > > av_free(pFrame); > > pFrame = NULL; > > } > > > > How i can tell libavcodec that i want to become the owner of the data and > > be able to free it, to without codec context instance? I was thinking > about > > using get/release_buffer functions, but i don't know how to compute size > of > > the data. > > > > Is data memcpy the only way to do this? > > > > Note, that i also can't upgrade to new version of FFMPEG. > > > > Thanks for your help. > > > > Use reference counting system. > They you need to manually free frame once you will not need it > (otherwise you leak memory), so you do not need to do copy. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > Thank you for your answer, i saw that av_frame_ref/av_frame_unref is avaliable in FFMpeg 2.0, but i'm using 1.1.2, and I don't find any way to use reference couting in this version. Is this feature available in 1.1.x throught some others functions? -------------- next part -------------- An HTML attachment was scrubbed... URL: From perez.didac at gmail.com Thu Dec 5 13:42:03 2013 From: perez.didac at gmail.com (=?ISO-8859-1?Q?D=EDdac_P=E9rez?=) Date: Thu, 5 Dec 2013 13:42:03 +0100 Subject: [Libav-user] My code stops at avformat_find_stream_info() In-Reply-To: References: Message-ID: Carl, I missed one line before nan : 0.000 fd= ...................: UPD timeout, retrying with TCP= 0KB vq = 0KB sq= 0KB f=0/0. I have an exact camera in my office and it works: Input #0, rtsp, from 'rtsp://192.168.1.198/video':sq= 0B f=0/0 Metadata: title : LIVE VIEW Duration: N/A, start: 0.266644, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 7.50 tbr, 90k tbn, 180k tbc 8.64 M-V: -0.043 fd= 15 aq= 0KB vq= 159KB sq= 0B f=1/0 I don't understand what is happening. It's not a network issue since VLC is playing the video... -- D?dac P?rez 2013/12/5 D?dac P?rez > I am using the snapshot 20130706, Windows built from Zeranoe. > Yes, ffplay is not able to play the stream, but VLC can play it! This is > the output of ffplay. > > C:\Program Files\IMAGSA\AtalaiaControlSoftware\ffmpeg>ffplay rtsp:// > 192.168.1.19 > 8/video > ffplay version N-54499-g63d7684 Copyright (c) 2003-2013 the FFmpeg > developers > built on Jul 6 2013 10:32:51 with gcc 4.7.3 (GCC) > configuration: --disable-static --enable-shared --enable-gpl > --enable-version3 > --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig > --ena > ble-frei0r --enable-gnutls --enable-iconv --enable-libass > --enable-libbluray --e > nable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc > --enable-lib > modplug --enable-libmp3lame --enable-libopencore-amrnb > --enable-libopencore-amrw > b --enable-libopenjpeg --enable-libopus --enable-librtmp > --enable-libschroedinge > r --enable-libsoxr --enable-libspeex --enable-libtheora > --enable-libtwolame --en > able-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis > --enable-libvpx --e > nable-libx264 --enable-libxavs --enable-libxvid --enable-zlib > libavutil 52. 38.100 / 52. 38.100 > libavcodec 55. 18.102 / 55. 18.102 > libavformat 55. 11.101 / 55. 11.101 > libavdevice 55. 2.100 / 55. 2.100 > libavfilter 3. 78.102 / 3. 78.102 > libswscale 2. 3.100 / 2. 3.100 > libswresample 0. 17.102 / 0. 17.102 > libpostproc 52. 3.100 / 52. 3.100 > nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0 > > -- > D?dac P?rez > > > > 2013/12/5 Carl Eugen Hoyos > >> D?dac P?rez writes: >> >> > I am using ffmpeg to retrieve the RTSP stream from a >> > network IP camera, concretely a Bosch Dinion HD 720p. >> > >> > When I run my code, it stucks in avformat_find_stream_info() >> >> Is this reproducible with ffmpeg (the application)? >> >> 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 h.leppkes at gmail.com Thu Dec 5 13:45:48 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 5 Dec 2013 13:45:48 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: Message-ID: On Thu, Dec 5, 2013 at 1:33 PM, Eric Beuque wrote: > > Thank you for your answer, i saw that av_frame_ref/av_frame_unref is > avaliable in FFMpeg 2.0, but i'm using 1.1.2, and I don't find any way to > use reference couting in this version. Is this feature available in 1.1.x > throught some others functions? > > No, reference counting is a new feature in 2.0 You could implement it yourself by providing a custom get_buffer implementation, but it requires a lot of plumbing code. Consider upgrading to 2.0? :) From eric.beuque at gmail.com Thu Dec 5 14:02:52 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Thu, 5 Dec 2013 14:02:52 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: Message-ID: On Thu, Dec 5, 2013 at 1:45 PM, Hendrik Leppkes wrote: > On Thu, Dec 5, 2013 at 1:33 PM, Eric Beuque wrote: > > > > Thank you for your answer, i saw that av_frame_ref/av_frame_unref is > > avaliable in FFMpeg 2.0, but i'm using 1.1.2, and I don't find any way to > > use reference couting in this version. Is this feature available in 1.1.x > > throught some others functions? > > > > > > No, reference counting is a new feature in 2.0 > You could implement it yourself by providing a custom get_buffer > implementation, but it requires a lot of plumbing code. Consider > upgrading to 2.0? :) > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > Cannot upgrade to 2.0 API until it is included in linux distribution repositories by default like Debian stable. If no other solution, I will deal with buffer copy. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Dec 5 14:17:28 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 5 Dec 2013 13:17:28 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?My_code_stops_at_avformat=5Ffind=5Fstream?= =?utf-8?b?X2luZm8oKQ==?= References: Message-ID: D?dac P?rez writes: > ffplay rtsp://192.168.1.198/video Please try ffplay rtsp://192.168.1.19?tcp Please do not top-post here, it is considered rude, Carl Eugen From cehoyos at ag.or.at Thu Dec 5 16:59:09 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 5 Dec 2013 15:59:09 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?My_code_stops_at_avformat=5Ffind=5Fstream?= =?utf-8?b?X2luZm8oKQ==?= References: Message-ID: Carl Eugen Hoyos writes: > D?dac P?rez ...> writes: > > > ffplay rtsp://192.168.1.198/video > > Please try ffplay rtsp://192.168.1.19?tcp Should have been: ffplay rtsp://192.168.1.198/video?tcp (Consider forcing your mailer to text-only.) Sorry, Carl Eugen From perez.didac at gmail.com Thu Dec 5 17:15:26 2013 From: perez.didac at gmail.com (=?ISO-8859-1?Q?D=EDdac_P=E9rez?=) Date: Thu, 5 Dec 2013 17:15:26 +0100 Subject: [Libav-user] My code stops at avformat_find_stream_info() In-Reply-To: References: Message-ID: Carl, Sorry for the formatted text. I realized that it works with any param with VLC: /video, /video?tcp, /video/upd, /foo, /bar, but still not work with ffplay. I am really confused. I don't have any idea about what's going on. -- D?dac P?rez 2013/12/5 Carl Eugen Hoyos > Carl Eugen Hoyos writes: > > > D?dac P?rez ...> writes: > > > > > ffplay rtsp://192.168.1.198/video > > > > Please try ffplay rtsp://192.168.1.19?tcp > > Should have been: > ffplay rtsp://192.168.1.198/video?tcp > > (Consider forcing your mailer to text-only.) > > Sorry, 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 andrey.krieger.utkin at gmail.com Thu Dec 5 17:54:56 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Thu, 5 Dec 2013 18:54:56 +0200 Subject: [Libav-user] Live video stream playback is too fast In-Reply-To: <52A06B22.4070903@gmail.com> References: <52A06ACF.8070600@intropro.com> <52A06B22.4070903@gmail.com> Message-ID: 2013/12/5 Andrew Sherepenko : > May be somebody have the same problem or can give any advice how to find a > solution. Hard to tell on such level of details. Did you try to produce output file using ffmpeg tool instead of your app? It is often possible. If you give minimal code snippet to reproduce the problem, helping would be easier. -- Andrey Utkin From bruce at spearmorgan.com Thu Dec 5 19:53:37 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Thu, 5 Dec 2013 10:53:37 -0800 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: Message-ID: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: > On 12/5/13, Eric Beuque wrote: >> How i can tell libavcodec that i want to become the owner of the data and >> be able to free it, to without codec context instance? I was thinking about >> using get/release_buffer functions, but i don't know how to compute size of >> the data. >> >> Is data memcpy the only way to do this? >> >> Note, that i also can't upgrade to new version of FFMPEG. >> >> Thanks for your help. >> > > Use reference counting system. > They you need to manually free frame once you will not need it > (otherwise you leak memory), so you do not need to do copy. In my recent experiments, it seemed that closing the codec actually frees all buffers, regardless of reference count. That makes sense - if the codec is gone, what would detect the decreased reference count? Bruce From onemda at gmail.com Thu Dec 5 21:22:04 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 5 Dec 2013 21:22:04 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> Message-ID: On 12/5/13, Bruce Wheaton wrote: > On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: > >> On 12/5/13, Eric Beuque wrote: >>> How i can tell libavcodec that i want to become the owner of the data >>> and >>> be able to free it, to without codec context instance? I was thinking >>> about >>> using get/release_buffer functions, but i don't know how to compute size >>> of >>> the data. >>> >>> Is data memcpy the only way to do this? >>> >>> Note, that i also can't upgrade to new version of FFMPEG. >>> >>> Thanks for your help. >>> >> >> Use reference counting system. >> They you need to manually free frame once you will not need it >> (otherwise you leak memory), so you do not need to do copy. > > > In my recent experiments, it seemed that closing the codec actually frees > all buffers, regardless of reference count. That makes sense - if the codec > is gone, what would detect the decreased reference count? That sound wrong to me, either when decoding or encoding frames should not be freed if frame is still used. > > Bruce > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From Rajkumar.Prakash at lntinfotech.com Wed Dec 4 11:20:06 2013 From: Rajkumar.Prakash at lntinfotech.com (Rajkumar Prakash) Date: Wed, 4 Dec 2013 15:50:06 +0530 Subject: [Libav-user] Query regarding water on video Message-ID: Hi Team, I am developing an application in .NET for applying watermark on video. I chose MediaHandler library (.NET assembly) by MediSoft company. They are using FFmpeg for applying watermark on video. In their package they gave "ffmpeg_july_2012" build, which inclused ffmpeg.exe, ffplay.exe and ffprobe.exe in bin folder. Version details in readme.txt shows "2012-07-13 git-cb59e62" For watermark stuff, what all libraries needs to be enabled with FFPEM build. Kindly provide your help. Thanks! Regards, ______________________________________________________ Rajkumar Prakash. J | ?: +91 44 2253 8796 | ?: +91 98408 27406 Email: Rajkumar.Prakash at lntinfotech.com | Website: www.lntinfotech.com --------------------------------------------------------------- ________________________________ The contents of this e-mail and any attachment(s) may contain confidential or privileged information for the intended recipient(s). Unintended recipients are prohibited from taking action on the basis of information in this e-mail and using or disseminating the information, and must notify the sender and delete it from their system. L&T Infotech will not accept responsibility or liability for the accuracy or completeness of, or the presence of any virus or disabling code in this e-mail" ************************************************************************* This email and attachments have been scanned for potential proprietary or sensitive information leakage. Websense Data Security, Protecting Your Information from the Inside Out. www.websense.com ************************************************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From aantonov at neterra.net Thu Dec 5 12:15:14 2013 From: aantonov at neterra.net (Anton Antonov) Date: Thu, 05 Dec 2013 13:15:14 +0200 Subject: [Libav-user] ffmpeg burst traffic problem Message-ID: <52A06042.3060208@neterra.net> Hi ffmpeg team, I am new in ffmpeg and I have a problem that I can't solve. I use ffmpeg for live encoding of SD mpeg2 channels to SD h264. To do that I use the following ffmpeg version and command line: ffmpeg version N-40926-gfa6fa21 Copyright (c) 2000-2013 the FFmpeg developers built on Oct 31 2013 14:36:27 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-3) configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 libavutil 52. 48.100 / 52. 48.100 libavcodec 55. 39.100 / 55. 39.100 libavformat 55. 19.104 / 55. 19.104 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 90.100 / 3. 90.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 libpostproc 52. 3.100 / 52. 3.100 Hyper fast Audio and Video encoder /root/bin/ffmpeg -i udp://239.10.1.169:30000 -vcodec libx264 -profile high -r 25 -g 150 -vb 1000k -minrate 1000k -maxrate 1000k -bufsize 300k -strict experimental -partitions all -acodec aac -ab 96000 -ar 48000 -ac 2 -vbsf h264_mp4toannexb -f mpegts -threads 16 -async 48000 -vsync 1 -deinterlace udp://229.9.23.1:39271?pkt_size=1316 The encoded output looks fine. There is a problem with micro bursts in output traffic. As an attachment I sent two pictures of captured traffic from ffmpeg and elecard encoder. On the pictures there is analyzed traffic by wireshark. On elecard picture you can see that traffic is leveled and on equal intervals. On ffmpef picture traffic is on bursts. On command line above I tried to deal with parameter "bufsize" but the result was nearly the same. Could you help me to make ffmpeg output traffic to run without burst? -------------- next part -------------- A non-text attachment was scrubbed... Name: ffmpeg.GIF Type: image/gif Size: 24120 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: elecard.GIF Type: image/gif Size: 27123 bytes Desc: not available URL: From andrey.krieger.utkin at gmail.com Thu Dec 5 21:53:14 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Thu, 5 Dec 2013 22:53:14 +0200 Subject: [Libav-user] [FFmpeg-user] ffmpeg burst traffic problem In-Reply-To: <52A06042.3060208@neterra.net> References: <52A06042.3060208@neterra.net> Message-ID: ffmpeg lacks UDP output speed smoothing functionality. You can see in libavformat/udp.c in circular_buffer_task() that data is output as soon as it appears. To eliminate bursty output it is needed either to patch ffmpeg or to substitute ffmpeg output facility with another application's one, e.g. you could do ffmpeg (...options...) -f mpegts - | pv -L $BITRATE | socat (...options...) -- Andrey Utkin From srosca at bu.edu Fri Dec 6 02:21:50 2013 From: srosca at bu.edu (Alexandru Rosca) Date: Fri, 6 Dec 2013 14:21:50 +1300 Subject: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT Message-ID: I am decoding audio and trying to convert it from the planar format to just FLT (packed?). I am making a library which when used will return the buffer with the data. I am using swr_convert but if I pass it frame.extended_data, it crashes. If I just pass it frame.data[0] I get really crackly audio on the other end. I suspect the problem is converting between these formats? Setting request_sample_fmt to av_sample_flt doesnt work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mtaha.ansari at gmail.com Fri Dec 6 06:44:04 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Fri, 6 Dec 2013 10:44:04 +0500 Subject: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT In-Reply-To: References: Message-ID: On Fri, Dec 6, 2013 at 6:21 AM, Alexandru Rosca wrote: > I am decoding audio and trying to convert it from the planar format to > just FLT (packed?). I am making a library which when used will return the > buffer with the data. I am using swr_convert but if I pass it > frame.extended_data, it crashes. > Yes, swr_convert functions should be able to do this without any problem. > If I just pass it frame.data[0] I get really crackly audio on the other > end. I suspect the problem is converting between these formats? Setting > request_sample_fmt to av_sample_flt doesnt work. > > You might want to share some workable sample code, otherwise it is pure guessing. > _______________________________________________ > 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 eric.beuque at gmail.com Fri Dec 6 09:17:17 2013 From: eric.beuque at gmail.com (Eric Beuque) Date: Fri, 6 Dec 2013 09:17:17 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> Message-ID: On Thu, Dec 5, 2013 at 9:22 PM, Paul B Mahol wrote: > On 12/5/13, Bruce Wheaton wrote: > > On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: > > > >> On 12/5/13, Eric Beuque wrote: > >>> How i can tell libavcodec that i want to become the owner of the data > >>> and > >>> be able to free it, to without codec context instance? I was thinking > >>> about > >>> using get/release_buffer functions, but i don't know how to compute > size > >>> of > >>> the data. > >>> > >>> Is data memcpy the only way to do this? > >>> > >>> Note, that i also can't upgrade to new version of FFMPEG. > >>> > >>> Thanks for your help. > >>> > >> > >> Use reference counting system. > >> They you need to manually free frame once you will not need it > >> (otherwise you leak memory), so you do not need to do copy. > > > > > > In my recent experiments, it seemed that closing the codec actually frees > > all buffers, regardless of reference count. That makes sense - if the > codec > > is gone, what would detect the decreased reference count? > > That sound wrong to me, either when decoding or encoding frames should > not be freed if frame is still used. > I agree with Paul. I think this is the expected behavior for developers. > > > > > Bruce > > _______________________________________________ > > 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 bruce at spearmorgan.com Fri Dec 6 17:06:48 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Fri, 6 Dec 2013 08:06:48 -0800 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> Message-ID: <0EE94203-414C-401A-9810-259427686DA9@spearmorgan.com> > On Dec 6, 2013, at 0:17, Eric Beuque wrote: > > >> On Thu, Dec 5, 2013 at 9:22 PM, Paul B Mahol wrote: >> On 12/5/13, Bruce Wheaton wrote: >> > On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: >> > >> >> On 12/5/13, Eric Beuque wrote: >> >>> How i can tell libavcodec that i want to become the owner of the data >> >>> and >> >>> be able to free it, to without codec context instance? I was thinking >> >>> about >> >>> using get/release_buffer functions, but i don't know how to compute size >> >>> of >> >>> the data. >> >>> >> >>> Is data memcpy the only way to do this? >> >>> >> >>> Note, that i also can't upgrade to new version of FFMPEG. >> >>> >> >>> Thanks for your help. >> >>> >> >> >> >> Use reference counting system. >> >> They you need to manually free frame once you will not need it >> >> (otherwise you leak memory), so you do not need to do copy. >> > >> > >> > In my recent experiments, it seemed that closing the codec actually frees >> > all buffers, regardless of reference count. That makes sense - if the codec >> > is gone, what would detect the decreased reference count? >> >> That sound wrong to me, either when decoding or encoding frames should >> not be freed if frame is still used. > > I agree with Paul. I think this is the expected behavior for developers. Let's say I agree with both of you. Nonetheless, a frame's ref count is a variable, not a function. After it gets decremented to mark you don't want it, something that runs (presumably that had been run by your code, such as a decode function) must then detect that and reuse the frame. I know that if you break down the whole chain (codecs and the format context) the frames get removed - deleting the frames triggers a signal on double free. I was speculating that the frame 'belong' to the codec, which generated them. So whatever we wish happened - you can't keep the frames you get from decoding indefinitely. You can probably keep something else alive just to keep them in play. > >> >> > >> > Bruce >> > _______________________________________________ >> > 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 george at nsup.org Fri Dec 6 18:02:50 2013 From: george at nsup.org (Nicolas George) Date: Fri, 6 Dec 2013 18:02:50 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: <0EE94203-414C-401A-9810-259427686DA9@spearmorgan.com> References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> <0EE94203-414C-401A-9810-259427686DA9@spearmorgan.com> Message-ID: <20131206170250.GA29293@phare.normalesup.org> Le sextidi 16 frimaire, an CCXXII, Bruce Wheaton a ?crit?: > Nonetheless, a frame's ref count is a variable, not a function. It is a structure member that should not be modified directly but only through the reference counting API. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From ndato at 3way.com.ar Fri Dec 6 19:30:53 2013 From: ndato at 3way.com.ar (=?ISO-8859-1?Q?Nicol=E1s_Dato?=) Date: Fri, 6 Dec 2013 16:30:53 -0200 Subject: [Libav-user] Identical timestamps for different frames Message-ID: Hi, I have an MPEG TS file in which the H264 video stream has the following PTS/DTS pattern: F1 -> PTS: 4470324556 DTS: - F2 -> PTS: 4470326057 DTS: - F3 -> PTS: 4470333565 DTS: 4470327559 F4 -> PTS: 4470335066 DTS: 4470329060 F5 -> *PTS: 4470330562* DTS: - F6 -> PTS: 4470332063 DTS: - F7 -> PTS: 4470345577 *DTS: 4470330562* F8 -> PTS: 4470347078 DTS: 4470332063 F9 -> PTS: 4470336568 DTS: - F10 -> PTS: 4470338069 DTS: - F11 -> PTS: 4470339571 DTS: - If you pay attention to to the starred timestamps, you'll notice they are the same. According to my knowledge (ISO 13818-1:2007 Annex D.0.2) , if a video frame doesn't have DTS, the PTS can be interpreted as being both the PTS and DTS. So, how should I provide these frames to the decoder? Does avcodec_decode_videoX() require the input frames to be reordered so as to have the DTSs be monotonically incremental? This issue happens repeatedly in this file. If needed, I could provide a sample file with this pattern. Thanks in advance. -- Nicolas Dato Investigaci?n y Desarrollo Tel. Interno: 110 www.3way.com.ar Av. Rivadavia 2431 Ent. 4 Of. 5 Pasaje Colombo (C1034ACD) Cap. Fed. Argentina Tel.: +54-11-5217-3330 Fax: +54-11-4953-6319 ISO 9001:2008 ID 9105026071 Certified since 2004 From nfxjfg at googlemail.com Sat Dec 7 01:39:45 2013 From: nfxjfg at googlemail.com (wm4) Date: Sat, 7 Dec 2013 01:39:45 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> Message-ID: <20131207013945.05ddd75a@debian> On Thu, 5 Dec 2013 10:53:37 -0800 Bruce Wheaton wrote: > On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: > > > On 12/5/13, Eric Beuque wrote: > >> How i can tell libavcodec that i want to become the owner of the data and > >> be able to free it, to without codec context instance? I was thinking about > >> using get/release_buffer functions, but i don't know how to compute size of > >> the data. > >> > >> Is data memcpy the only way to do this? > >> > >> Note, that i also can't upgrade to new version of FFMPEG. > >> > >> Thanks for your help. > >> > > > > Use reference counting system. > > They you need to manually free frame once you will not need it > > (otherwise you leak memory), so you do not need to do copy. > > > In my recent experiments, it seemed that closing the codec actually frees all buffers, regardless of reference count. That makes sense - if the codec is gone, what would detect the decreased reference count? Did you set AVCodecContext.refcounted_frames to 1? There are other weird requirements to use refcounting, such as allocating AVFrames with av_frame_alloc() instead of avcodec_frame_alloc() (or whatever it was). From vinvinod at gmail.com Sat Dec 7 10:26:02 2013 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Sat, 7 Dec 2013 14:56:02 +0530 Subject: [Libav-user] Audio Transcoding Message-ID: Hi, I am writing an audio transcoding application using ffmpeg libraries. Here is my code - http://pastebin.com/6aaa8C53 The input file i used was - https://stream-m.googlecode.com/files/univac.webm The output file is playable and its of the same duration as the input file. But its completely noisy. I guess I am not handling the pts and dts properly..! but dont know how to do it.! I checked the example folder of ffmpeg sources. But I am not able to figure where i went wrong. Can someone tell me where I am doing it wrong..! -- Vinod -------------- next part -------------- An HTML attachment was scrubbed... URL: From fkwatson at aol.com Sat Dec 7 14:52:27 2013 From: fkwatson at aol.com (fkwatson at aol.com) Date: Sat, 7 Dec 2013 08:52:27 -0500 (EST) Subject: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT In-Reply-To: References: Message-ID: <8D0C16AB33737FA-1950-181F4@webmail-d268.sysops.aol.com> From: Taha Ansari To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Sent: Sat, Dec 7, 2013 6:00 am Subject: Re: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT On Fri, Dec 6, 2013 at 6:21 AM, Alexandru Rosca wrote: I am decoding audio and trying to convert it from the planar format to just FLT (packed?). I am making a library which when used will return the buffer with the data. I am using swr_convert but if I pass it frame.extended_data, it crashes. Yes, swr_convert functions should be able to do this without any problem. If I just pass it frame.data[0] I get really crackly audio on the other end. I suspect the problem is converting between these formats? Setting request_sample_fmt to av_sample_flt doesnt work. You might want to share some workable sample code, otherwise it is pure guessing. >>>>>>> I do not use sws_convert to do this because there is no real conversion necessary, just copying. Since I have to copy data from frame.data[] anyway, I do a simple copy for non planar format. But with planar format, channel 1's samples are in frame.data[0] and channel 2's samples are in frame.data[1]. You just need to copy the 4-byte samples from the two buffers to your single output buffer interleaved, i.e., channel 1 - sample 0, channel 2 - sample 0, channel 1 - sample 1, channel 2 - sample 1, ... -Felix _______________________________________________ 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 srosca at bu.edu Sat Dec 7 22:57:02 2013 From: srosca at bu.edu (Alexandru Rosca) Date: Sun, 8 Dec 2013 10:57:02 +1300 Subject: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_FLT In-Reply-To: <8D0C16AB33737FA-1950-181F4@webmail-d268.sysops.aol.com> References: <8D0C16AB33737FA-1950-181F4@webmail-d268.sysops.aol.com> Message-ID: Awesome, this is the answer I was looking for. I will try it out and reply with the result. Thanks On Sun, Dec 8, 2013 at 2:52 AM, wrote: > > From: Taha Ansari > To: This list is about using libavcodec, libavformat, libavutil, > libavdevice > and libavfilter. > Sent: Sat, Dec 7, 2013 6:00 am > Subject: Re: [Libav-user] Converting from AV_SAMPLE_FMT_FLTP to > AV_SAMPLE_FMT_FLT > > On Fri, Dec 6, 2013 at 6:21 AM, Alexandru Rosca wrote: > >> I am decoding audio and trying to convert it from the planar format to >> just FLT (packed?). I am making a library which when used will return the >> buffer with the data. I am using swr_convert but if I pass it >> frame.extended_data, it crashes. >> > > Yes, swr_convert functions should be able to do this without any problem. > > >> If I just pass it frame.data[0] I get really crackly audio on the other >> end. I suspect the problem is converting between these formats? Setting >> request_sample_fmt to av_sample_flt doesnt work. >> >> > You might want to share some workable sample code, otherwise it is pure > guessing. > > > >>>>>>> > > I do not use sws_convert to do this because there is no real conversion > necessary, just copying. Since I have to copy data from frame.data[] > anyway, I do a simple copy for non planar format. But with planar format, > channel 1's samples are in frame.data[0] and channel 2's samples are in > frame.data[1]. You just need to copy the 4-byte samples from the two > buffers to your single output buffer interleaved, i.e., channel 1 - sample > 0, channel 2 - sample 0, channel 1 - sample 1, channel 2 - sample 1, ... > > -Felix > > > > _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > _______________________________________________ > Libav-user mailing listLibav-user at ffmpeg.orghttp://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 bruce at spearmorgan.com Sun Dec 8 07:16:41 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Sat, 7 Dec 2013 22:16:41 -0800 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: <20131207013945.05ddd75a@debian> References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> <20131207013945.05ddd75a@debian> Message-ID: On Dec 6, 2013, at 4:39 PM, wm4 wrote: > On Thu, 5 Dec 2013 10:53:37 -0800 > Bruce Wheaton wrote: > >> On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: >> >>> On 12/5/13, Eric Beuque wrote: >>>> How i can tell libavcodec that i want to become the owner of the data and >>>> be able to free it, to without codec context instance? I was thinking about >>>> using get/release_buffer functions, but i don't know how to compute size of >>>> the data. >>>> >>>> Is data memcpy the only way to do this? >>>> >>>> Note, that i also can't upgrade to new version of FFMPEG. >>>> >>>> Thanks for your help. >>>> >>> >>> Use reference counting system. >>> They you need to manually free frame once you will not need it >>> (otherwise you leak memory), so you do not need to do copy. >> >> >> In my recent experiments, it seemed that closing the codec actually frees all buffers, regardless of reference count. That makes sense - if the codec is gone, what would detect the decreased reference count? > > Did you set AVCodecContext.refcounted_frames to 1? There are other > weird requirements to use refcounting, such as allocating AVFrames with > av_frame_alloc() instead of avcodec_frame_alloc() (or whatever it was). Yes, I followed all the directions I could find, including those two. In the end, memory kept increasing, and I found that I couldn't keep buffers longer than i had the codec and context open. It was also quite a memory hog. Saving the copy turned out to have some downsides. Bruce > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From jpboard2 at yahoo.com Sun Dec 8 23:40:57 2013 From: jpboard2 at yahoo.com (James Board) Date: Sun, 8 Dec 2013 14:40:57 -0800 (PST) Subject: [Libav-user] Blue-ish tint to pixels when using raw uncompressed output codec Message-ID: <1386542457.87308.YahooMailNeo@web164704.mail.gq1.yahoo.com> I wrote a libAV-based C program for video editing.? It takes a video file as input and produces a video file as output.? The input file is AVI container, yuv422p pixels, and is ffvhuff compressed.? I want the output file to also be AVI, yuv422p pixels, but uncompressed video (not ffvhuff).? What should I set the output format to in my libAV program?? Currently I'm setting it to AV_CODEC_ID_RAWVIDEO like this ??? AVOutputFormat *OutFormat; ??? OutFormat->video_codec = AV_CODEC_ID_RAWVIDEO; However, when I do the above, the output pixels are blue-ish.? If I instead set the output file video_codec to AV_CODEC_ID_FFVHUFF, the pixels look correct.? But if AV_CODEC_ID_RAWVIDEO, then all pixels have a blue tint.? What should I set the output codec to? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrfun.china at gmail.com Mon Dec 9 01:17:10 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Mon, 9 Dec 2013 11:17:10 +1100 Subject: [Libav-user] decode interlaced MJPEG video Message-ID: Hi friends, May anyone help to tell me how can I decode an interlaced MPEG video correct? My application uses basic ffmpeg functions like av_read_frame and avcodec_decode_video2 to get frames and then render them to screen. Since my application has no special treatment for interlaced video. Is it possible to set some flags somewhere so that avcodec_decode_video2 can directly return an deinterlaced frame? Great thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Dec 9 01:34:08 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 9 Dec 2013 00:34:08 +0000 (UTC) Subject: [Libav-user] decode interlaced MJPEG video References: Message-ID: YIRAN LI writes: > Is it possible to set some flags somewhere so that > avcodec_decode_video2 can directly return an > deinterlaced frame? Deinterlace filters exist in libavfilters, yadif is recommended. Carl Eugen From mrfun.china at gmail.com Mon Dec 9 01:39:17 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Mon, 9 Dec 2013 11:39:17 +1100 Subject: [Libav-user] decode interlaced MJPEG video In-Reply-To: References: Message-ID: Hi Carl, Is there any documentation on how to use filter pragmatically ? Thanks 2013/12/9 Carl Eugen Hoyos > YIRAN LI writes: > > > Is it possible to set some flags somewhere so that > > avcodec_decode_video2 can directly return an > > deinterlaced frame? > > Deinterlace filters exist in libavfilters, yadif is > recommended. > > 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 mrfun.china at gmail.com Mon Dec 9 03:44:25 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Mon, 9 Dec 2013 13:44:25 +1100 Subject: [Libav-user] a question for av_seek_frame Message-ID: Hi friends Here I have a question about av_seek_frame. For example if I have a video stream of time stamps 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. and only frame at 0 is a key frame. if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) and then av_read_frame, the first frame I get will be frame 6, is this correct? then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) and then av_read_frame, then the first frame I get will be frame 1, is this correct? and if both can seek to a frame and first one can get a frame quicker, in what circumstance should I use the second one? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From donmoir at comcast.net Wed Dec 4 13:00:09 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:00:09 -0500 Subject: [Libav-user] a question for av_seek_frame References: Message-ID: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> >----- Original Message ----- >From: YIRAN LI >To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. >Sent: Sunday, December 08, 2013 9:44 PM >Subject: [Libav-user] a question for av_seek_frame >Hi friends >Here I have a question about av_seek_frame. >For example if I have a video stream of time stamps 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. and only frame at 0 is a key frame. >if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) and then av_read_frame, the first frame I get will be frame 6, is this correct? >then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) and then av_read_frame, then the first frame I get will be frame 1, is this correct? >and if both can seek to a frame and first one can get a frame quicker, in what circumstance should I use the second one? >Thanks Non key frames require the previous key frame in order to be decoded correctly. So if you skip past the key frame to frame 6, then the decoded image will most likely be incorrect. While your first example may be quicker, it will not be correct. Best to stay away from AVSEEK_FLAG_ANY for normal display purposes. Proper seeking to frame 6 would require a seek to frame 1 and then read and decode to frame 6. AVSEEK_FLAG_ANY can be useful in some cases but generally not for normal display. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrfun.china at gmail.com Mon Dec 9 05:23:06 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Mon, 9 Dec 2013 15:23:06 +1100 Subject: [Libav-user] a question for av_seek_frame In-Reply-To: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> References: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> Message-ID: Thanks Don, So in order to get a correct image, I must not use AVSEEK_FLAG_ANY so that av_seek_frame by default will seek to a key frame. And I should continue to read from that point and decode until I get a frame with the timestamp I want. Do you know if all demuxers can support av_seek_frame() correctly so that as long as there's a key frame before the position I pass to the function, they all can correctly seek to that key frame? Thanks 2013/12/4 Don Moir > >----- Original Message ----- > >From: YIRAN LI > >To: This list is about using libavcodec, libavformat, > libavutil,libavdevice and libavfilter. > >Sent: Sunday, December 08, 2013 9:44 PM > >Subject: [Libav-user] a question for av_seek_frame > > >Hi friends > > >Here I have a question about av_seek_frame. > > >For example if I have a video stream of time stamps 0, 1, 2, 3, 4, 5, 6, > 7, 8, 9, 10. and only frame at 0 is a key frame. > > >if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) > and then av_read_frame, the first frame I get will be frame 6, is this > correct? > > >then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) and then > av_read_frame, then the first frame I get will be frame 1, is this correct? > > >and if both can seek to a frame and first one can get a frame quicker, in > what circumstance should I use the second one? > > >Thanks > > Non key frames require the previous key frame in order to be decoded > correctly. So if you skip past the key frame to frame 6, then the decoded > image will most likely be incorrect. > > While your first example may be quicker, it will not be correct. Best to > stay away from AVSEEK_FLAG_ANY for normal display purposes. Proper seeking > to frame 6 would require a seek to frame 1 and then read and decode to > frame 6. AVSEEK_FLAG_ANY can be useful in some cases but generally not > for normal display. > > _______________________________________________ > 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 mrfun.china at gmail.com Mon Dec 9 05:29:40 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Mon, 9 Dec 2013 15:29:40 +1100 Subject: [Libav-user] a question for av_seek_frame In-Reply-To: References: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> Message-ID: And I have another question: If an AVPacket object has AV_PKT_FLAG_KEY bit set in flags, does that mean this packet when passed into avcodec_decode_video2 can always get a complete frame (I mean by calling avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet) the 3rd argument set to true)? Thanks 2013/12/9 YIRAN LI > Thanks Don, > > So in order to get a correct image, I must not use AVSEEK_FLAG_ANY so > that av_seek_frame by default will seek to a key frame. And I should > continue to read from that point and decode until I get a frame with the > timestamp I want. > > Do you know if all demuxers can support av_seek_frame() correctly so that > as long as there's a key frame before the position I pass to the function, > they all can correctly seek to that key frame? > > Thanks > > > 2013/12/4 Don Moir > >> >----- Original Message ----- >> >From: YIRAN LI >> >To: This list is about using libavcodec, libavformat, >> libavutil,libavdevice and libavfilter. >> >Sent: Sunday, December 08, 2013 9:44 PM >> >Subject: [Libav-user] a question for av_seek_frame >> >> >Hi friends >> >> >Here I have a question about av_seek_frame. >> >> >For example if I have a video stream of time stamps 0, 1, 2, 3, 4, 5, 6, >> 7, 8, 9, 10. and only frame at 0 is a key frame. >> >> >if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) >> and then av_read_frame, the first frame I get will be frame 6, is this >> correct? >> >> >then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) and then >> av_read_frame, then the first frame I get will be frame 1, is this correct? >> >> >and if both can seek to a frame and first one can get a frame quicker, >> in what circumstance should I use the second one? >> >> >Thanks >> >> Non key frames require the previous key frame in order to be decoded >> correctly. So if you skip past the key frame to frame 6, then the decoded >> image will most likely be incorrect. >> >> While your first example may be quicker, it will not be correct. Best to >> stay away from AVSEEK_FLAG_ANY for normal display purposes. Proper seeking >> to frame 6 would require a seek to frame 1 and then read and decode to >> frame 6. AVSEEK_FLAG_ANY can be useful in some cases but generally not >> for normal display. >> >> _______________________________________________ >> 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 donmoir at comcast.net Wed Dec 4 13:33:55 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:33:55 -0500 Subject: [Libav-user] a question for av_seek_frame References: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> Message-ID: <9FC3F1CE00DC4D3A888763D557F76DFD@MANLAP> >>2013/12/4 Don Moir >>>----- Original Message ----- >>>From: YIRAN LI >>>To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. >>>Sent: Sunday, December 08, 2013 9:44 PM >>>Subject: [Libav-user] a question for av_seek_frame >>>Hi friends >>>Here I have a question about av_seek_frame. >>>For example if I have a video stream of time stamps 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. and only frame at 0 is a key frame. >>>if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) and then av_read_frame, the first frame I get will be frame 6, is this correct? >>>then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) and then av_read_frame, then the first frame I get will be frame 1, is this correct? >>>and if both can seek to a frame and first one can get a frame quicker, in what circumstance should I use the second one? >>>Thanks >>Non key frames require the previous key frame in order to be decoded correctly. So if you skip past the key frame to frame 6, then the decoded image will most likely be incorrect. >>While your first example may be quicker, it will not be correct. Best to stay away from AVSEEK_FLAG_ANY for normal display purposes. Proper seeking to frame 6 would require a seek to frame 1 and then read and decode to frame 6. AVSEEK_FLAG_ANY can be useful in some cases but generally not for normal display. >So in order to get a correct image, I must not use AVSEEK_FLAG_ANY so that av_seek_frame by default will seek to a key frame. And I should continue to read from that point and decode until I get a frame with the timestamp I want. Right and this takes some care. >Do you know if all demuxers can support av_seek_frame() correctly so that as long as there's a key frame before the position I pass to the function, they all can correctly seek to that key frame? Pretty much. You might have a problem with some mpeg files not seeking to key frame but otherwise works pretty well. You need to be careful about audio being in sync after a seek for some files as well. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kevin.kratzer at uei.co.jp Mon Dec 9 05:37:09 2013 From: kevin.kratzer at uei.co.jp (Kevin Kratzer) Date: Mon, 09 Dec 2013 13:37:09 +0900 Subject: [Libav-user] LGPL and Android's apk file format Message-ID: <52A548F5.2090606@uei.co.jp> Hello, I have a library which uses dynamic linking to integrate libav into a library which is not licensed under the LGPL. Is it allowed to distribute an application which integrates the libav library and my library together in an archive file where it is possible to replace the libav libraries with a modified version? In particular, the libraries are contained within an Android .apk file which is an Android executable. However, the executable object code and the libraries are separated within the .apk file and the libraries can be replaced with a simple archive tool like 7zip. Within the .apk file there is a folder lib which contains the dynamically linked FFmpeg libraries e.g. libavcodec.so. I'm not sure if section 6 b) of the LGPL can be applied in this case becasue of (1). Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. I'm aware of the LGPL-Java note http://www.gnu.org/licenses/lgpl-java.html However, this case is not covered there so I'm still unsure. Thank you Kevin -------------- next part -------------- An HTML attachment was scrubbed... URL: From safiuddinkhan at gmail.com Mon Dec 9 07:24:15 2013 From: safiuddinkhan at gmail.com (Safi ud Din Khan) Date: Mon, 09 Dec 2013 11:24:15 +0500 Subject: [Libav-user] a question for av_seek_frame In-Reply-To: References: <5B2EEDE6E3DC45DE9A277955A7EF1070@MANLAP> Message-ID: <52A5620F.2040007@gmail.com> refer to this if u wanna understand what really keyframe is http://en.wikipedia.org/wiki/Video_compression_picture_types also do remember it was also quiet confusing for me av_seek_frame seek stream by DTS (Decode Time Stamp) and not by PTS (Presentation Time Stamp) so when you seek you are'nt going get to the accurate position of the stream On 12/09/2013 09:29 AM, YIRAN LI wrote: > And I have another question: If an AVPacket object has AV_PKT_FLAG_KEY > bit set in flags, does that mean this packet when passed into > avcodec_decode_video2 can always get a complete frame (I mean by > calling avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, > &packet) the 3rd argument set to true)? > > Thanks > > > 2013/12/9 YIRAN LI > > > Thanks Don, > > So in order to get a correct image, I must not use AVSEEK_FLAG_ANY > so that av_seek_frame by default will seek to a key frame. And I > should continue to read from that point and decode until I get a > frame with the timestamp I want. > > Do you know if all demuxers can support av_seek_frame() correctly > so that as long as there's a key frame before the position I pass > to the function, they all can correctly seek to that key frame? > > Thanks > > > 2013/12/4 Don Moir > > > >----- Original Message ----- > >From: YIRAN LI > >To: This list is about using libavcodec, libavformat, > libavutil,libavdevice and libavfilter. > >Sent: Sunday, December 08, 2013 9:44 PM > >Subject: [Libav-user] a question for av_seek_frame > >Hi friends > >Here I have a question about av_seek_frame. > >For example if I have a video stream of time stamps 0, 1, 2, > 3, 4, 5, 6, 7, 8, 9, 10. and only frame at 0 is a key frame. > >if I call av_seek_frame(x,x,5, AVSEEK_FLAG_BACKWARD | > AVSEEK_FLAG_ANY) and then av_read_frame, the first frame I get > will be frame 6, is this correct? > >then if I call av_seek_frame(x, x, 5, AVSEEK_FLAG_BACKWARD) > and then av_read_frame, then the first frame I get will be > frame 1, is this correct? > >and if both can seek to a frame and first one can get a frame > quicker, in what circumstance should I use the second one? > >Thanks > Non key frames require the previous key frame in order to be > decoded correctly. So if you skip past the key frame to frame > 6, then the decoded image will most likely be incorrect. > While your first example may be quicker, it will not be > correct. Best to stay away from AVSEEK_FLAG_ANY for normal > display purposes. Proper seeking to frame 6 would require a > seek to frame 1 and then read and decode to frame 6. > AVSEEK_FLAG_ANY can be useful in some cases but generally not > for normal display. > > _______________________________________________ > 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 mtaha.ansari at gmail.com Mon Dec 9 10:55:14 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Mon, 9 Dec 2013 14:55:14 +0500 Subject: [Libav-user] ASS subtitle header missing while encoding Message-ID: Hi all! I am writing a small test program that will convert .SRT subtitle file to .ASS format. original SRT file (subtitle.srt): 1 00:00:02,000 --> 00:00:06,000 Hello 2 00:00:15,000 --> 00:00:20,000 World 3 00:01:00,000 --> 00:01:10,000 !!Again!! Demo code: #include "stdafx.h" //using namespace std; #include #include #include #include #include //#include #include #include #include #include #include #include #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" #include "libavutil/dict.h" #include "libavutil/error.h" #include "libavutil/opt.h" #include #include #include #include #include #include #include #include "libavfilter/avfiltergraph.h" #include "libavfilter/avcodec.h" #include "libavfilter/buffersink.h" #include "libavfilter/buffersrc.h" #include } //++decoder++// AVFormatContext *pFormatCtx = 0; int subtitleIndex = -1; AVPacket packet; AVCodecContext *pCodecCtxSubtitle = 0; AVCodec *pCodecSubtitle = 0; AVSubtitle subtitle; //--decoder-- //++encoder++ AVFormatContext *pOutputFormatCtx=0; AVStream *subtitle_st=0; AVOutputFormat *outputFmt=0; AVCodec *subtitle_codec=0; /* Add an output stream. */ AVStream *add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) { AVCodecContext *c; AVStream *st; /* find the encoder */ *codec = avcodec_find_encoder(codec_id); if (!(*codec)) { fprintf(stderr, "Could not find encoder for '%s'\n", avcodec_get_name(codec_id)); exit(1); } st = avformat_new_stream(oc, *codec); if (!st) { fprintf(stderr, "Could not allocate stream\n"); exit(1); } st->id = oc->nb_streams-1; c = st->codec; avcodec_get_context_defaults3( c, *codec); switch ((*codec)->type) { case AVMEDIA_TYPE_SUBTITLE: break; default: break; } /* Some formats want stream headers to be separate. */ if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } void open_subtitle(AVFormatContext *oc, AVCodec *codec, AVStream *st) { int ret; AVCodecContext *c = st->codec; /* open the codec */ ret = avcodec_open2(c, codec, NULL); if (ret < 0) { exit(1); } } //--encoder-- int main (int argc, char **argv) { av_register_all(); avcodec_register_all(); avfilter_register_all(); char inputFilename[90]="subtitle.srt"; char outputFilename[90]="temp.ass"; int rv = 0; // ++decoder++ int got_subtitle = 0; pFormatCtx = avformat_alloc_context(); rv = avformat_open_input(&pFormatCtx, inputFilename, NULL, NULL); for(int i=0; i < pFormatCtx->nb_streams; i++) { if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_SUBTITLE) { subtitleIndex = i; } } if ( subtitleIndex >= 0 ) { pCodecCtxSubtitle=pFormatCtx->streams[subtitleIndex]->codec; pCodecSubtitle = avcodec_find_decoder(pCodecCtxSubtitle->codec_id); if(pCodecSubtitle==NULL) { return -1; // Codec not found } // Open codec AVDictionary *codecDictOptions = NULL; if(avcodec_open2(pCodecCtxSubtitle, pCodecSubtitle, &codecDictOptions) < 0 )//error { } } //--decoder-- //++encoder++ int ret; avformat_alloc_output_context2(&pOutputFormatCtx, NULL, NULL, outputFilename); if (!pOutputFormatCtx) { rv = 1; } //outputFmt = pOutputFormatCtx->oformat; outputFmt = av_guess_format( NULL, outputFilename, NULL ); if (outputFmt->subtitle_codec != AV_CODEC_ID_NONE) { subtitle_st = add_stream(pOutputFormatCtx, &subtitle_codec, outputFmt->subtitle_codec); } if (subtitle_st) open_subtitle(pOutputFormatCtx, subtitle_codec, subtitle_st); av_dump_format(pOutputFormatCtx, 0, outputFilename, 1); /* open the output file, if needed */ if (!(outputFmt->flags & AVFMT_NOFILE)) { if (avio_open(&pOutputFormatCtx->pb, outputFilename, AVIO_FLAG_WRITE) < 0) { rv = 1; } else { /* Write the stream header, if any. */ if (avformat_write_header(pOutputFormatCtx, NULL) < 0) { rv = 1; } } } AVCodecContext *c = subtitle_st->codec; //--encoder-- while( av_read_frame( pFormatCtx, &packet ) >= 0 ) { if(packet.stream_index != subtitle_st->index) continue; int gotSubtitle = 0; rv = avcodec_decode_subtitle2( pCodecCtxSubtitle, &subtitle, &gotSubtitle, &packet ); uint64_t bufferSize = 1024 * 1024 ; uint8_t *buffer = new uint8_t[bufferSize]; memset(buffer, 0, bufferSize); if( rv >= 0 ) { rv = avcodec_encode_subtitle( subtitle_st->codec, buffer, bufferSize, &subtitle ); if ( rv >= 0 ) { AVPacket outPacket; av_init_packet(&outPacket); outPacket.data = buffer; outPacket.size = strlen((const char*)buffer); rv = av_interleaved_write_frame(pOutputFormatCtx, &outPacket); av_free_packet(&outPacket); } } delete [] buffer; } if ( pCodecCtxSubtitle) { avcodec_close(pCodecCtxSubtitle); pCodecCtxSubtitle= NULL; } if ( pCodecSubtitle ) { av_free(pCodecSubtitle); pCodecSubtitle= NULL; } if ( pFormatCtx ) { avformat_close_input(&pFormatCtx); avformat_free_context(pFormatCtx); pFormatCtx = NULL; } avcodec_close(subtitle_st->codec); return rv; } PTS values are not calculated still, it is work in progress; but the above code gives me this output: output temp.ass file: Dialogue: 0,0:00:00.00,0:00:00.00,Default,Hello Dialogue: 0,0:00:00.00,0:00:00.00,Default,World Dialogue: 0,0:00:00.00,0:00:00.00,Default,!!Again!! It is clearly missing all header information. When i run ffmpeg command line to convert orignal SRT file using: ffmpeg -i subtitle.srt temp.ass I get: [Script Info] ScriptType: v4.00+ [V4+ Styles] Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding Style: Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,1,1,0,2,10,10,10,0,0 [Events] Format: Layer, Start, End, Style, Text Dialogue: 0,0:00:02.00,0:00:06.00,Default,Hello Dialogue: 0,0:00:15.00,0:00:20.00,Default,World Dialogue: 0,0:01:00.00,0:01:10.00,Default,!!Again!! so my question is, even though I am calling avformat_write_header() function, why isn't this header information being written through my code? Thanks in advance... -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Dec 9 11:14:46 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 9 Dec 2013 10:14:46 +0000 (UTC) Subject: [Libav-user] LGPL and Android's apk file format References: <52A548F5.2090606@uei.co.jp> Message-ID: Kevin Kratzer writes: > Is it allowed to distribute an application which > integrates the libav library and my library together > in an archive file where it is possible to replace > the libav libraries with a modified version? IANAL. Are your users able to replace the FFmpeg libraries that you ship with (a different) one that they compiled themselves? If yes, I don't think it matters if you call it "static linking" or "dynamic linking" or if it isn't 100% clear. Or in other words: It definitely makes much more sense to try to follow the spirit of the LGPL / any contract than to try to proof that every word still fits into current (changed) technology. Please do not forget to provide the whole, unchanged FFmpeg source code (do not just link to ffmpeg.org) that you used together with some notes on how you compiled FFmpeg. Carl Eugen From mtaha.ansari at gmail.com Mon Dec 9 14:49:27 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Mon, 9 Dec 2013 18:49:27 +0500 Subject: [Libav-user] ASS subtitle header missing while encoding In-Reply-To: References: Message-ID: On Mon, Dec 9, 2013 at 2:55 PM, Taha Ansari wrote: > Hi all! > > I am writing a small test program that will convert .SRT subtitle file to > .ASS format. > > original SRT file (subtitle.srt): > > 1 > 00:00:02,000 --> 00:00:06,000 > Hello > > 2 > 00:00:15,000 --> 00:00:20,000 > World > > 3 > 00:01:00,000 --> 00:01:10,000 > !!Again!! > > Demo code: > > #include "stdafx.h" > > //using namespace std; > > #include > #include > > #include > #include > #include > //#include > #include > > #include > #include > > #include > #include > #include > #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 > extern "C" > { > #include "libavcodec/avcodec.h" > #include "libavformat/avformat.h" > #include "libavdevice/avdevice.h" > #include "libswscale/swscale.h" > #include "libavutil/dict.h" > #include "libavutil/error.h" > #include "libavutil/opt.h" > #include > #include > #include > #include > #include > #include > #include > #include "libavfilter/avfiltergraph.h" > #include "libavfilter/avcodec.h" > #include "libavfilter/buffersink.h" > #include "libavfilter/buffersrc.h" > > #include > } > > //++decoder++// > AVFormatContext *pFormatCtx = 0; > int subtitleIndex = -1; > AVPacket packet; > AVCodecContext *pCodecCtxSubtitle = 0; > AVCodec *pCodecSubtitle = 0; > AVSubtitle subtitle; > //--decoder-- > > //++encoder++ > AVFormatContext *pOutputFormatCtx=0; > AVStream *subtitle_st=0; > AVOutputFormat *outputFmt=0; > AVCodec *subtitle_codec=0; > /* Add an output stream. */ > AVStream *add_stream(AVFormatContext *oc, AVCodec **codec, > enum AVCodecID codec_id) > { > AVCodecContext *c; > AVStream *st; > > /* find the encoder */ > *codec = avcodec_find_encoder(codec_id); > if (!(*codec)) { > fprintf(stderr, "Could not find encoder for '%s'\n", > avcodec_get_name(codec_id)); > exit(1); > } > > st = avformat_new_stream(oc, *codec); > if (!st) { > fprintf(stderr, "Could not allocate stream\n"); > exit(1); > } > st->id = oc->nb_streams-1; > c = st->codec; > > avcodec_get_context_defaults3( c, *codec); > > switch ((*codec)->type) > { > case AVMEDIA_TYPE_SUBTITLE: > break; > default: > break; > } > > /* Some formats want stream headers to be separate. */ > if (oc->oformat->flags & AVFMT_GLOBALHEADER) > c->flags |= CODEC_FLAG_GLOBAL_HEADER; > > return st; > } > > void open_subtitle(AVFormatContext *oc, AVCodec *codec, AVStream *st) > { > int ret; > AVCodecContext *c = st->codec; > > /* open the codec */ > ret = avcodec_open2(c, codec, NULL); > if (ret < 0) > { > exit(1); > } > } > //--encoder-- > > int main (int argc, char **argv) > { > av_register_all(); > avcodec_register_all(); > avfilter_register_all(); > > char inputFilename[90]="subtitle.srt"; > char outputFilename[90]="temp.ass"; > int rv = 0; > > // ++decoder++ > int got_subtitle = 0; > pFormatCtx = avformat_alloc_context(); > > rv = avformat_open_input(&pFormatCtx, inputFilename, NULL, NULL); > > for(int i=0; i < pFormatCtx->nb_streams; i++) > { > > if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_SUBTITLE) > { > subtitleIndex = i; > } > } > if ( subtitleIndex >= 0 ) > { > pCodecCtxSubtitle=pFormatCtx->streams[subtitleIndex]->codec; > > pCodecSubtitle = avcodec_find_decoder(pCodecCtxSubtitle->codec_id); > if(pCodecSubtitle==NULL) > { > return -1; // Codec not found > } > // Open codec > AVDictionary *codecDictOptions = NULL; > if(avcodec_open2(pCodecCtxSubtitle, pCodecSubtitle, > &codecDictOptions) < 0 )//error > { > } > } > //--decoder-- > > //++encoder++ > int ret; > avformat_alloc_output_context2(&pOutputFormatCtx, NULL, NULL, > outputFilename); > if (!pOutputFormatCtx) > { > rv = 1; > } > //outputFmt = pOutputFormatCtx->oformat; > outputFmt = av_guess_format( NULL, outputFilename, NULL ); > if (outputFmt->subtitle_codec != AV_CODEC_ID_NONE) > { > subtitle_st = add_stream(pOutputFormatCtx, &subtitle_codec, > outputFmt->subtitle_codec); > } > > if (subtitle_st) > open_subtitle(pOutputFormatCtx, subtitle_codec, subtitle_st); > > av_dump_format(pOutputFormatCtx, 0, outputFilename, 1); > /* open the output file, if needed */ > if (!(outputFmt->flags & AVFMT_NOFILE)) > { > if (avio_open(&pOutputFormatCtx->pb, outputFilename, > AVIO_FLAG_WRITE) < 0) > { > rv = 1; > } > else > { > /* Write the stream header, if any. */ > if (avformat_write_header(pOutputFormatCtx, NULL) < 0) > { > rv = 1; > } > } > } > > AVCodecContext *c = subtitle_st->codec; > //--encoder-- > > while( av_read_frame( pFormatCtx, &packet ) >= 0 ) > { > if(packet.stream_index != subtitle_st->index) > continue; > int gotSubtitle = 0; > rv = avcodec_decode_subtitle2( pCodecCtxSubtitle, &subtitle, > &gotSubtitle, &packet ); > uint64_t bufferSize = 1024 * 1024 ; > uint8_t *buffer = new uint8_t[bufferSize]; > memset(buffer, 0, bufferSize); > if( rv >= 0 ) > { > rv = avcodec_encode_subtitle( subtitle_st->codec, buffer, > bufferSize, &subtitle ); > if ( rv >= 0 ) > { > AVPacket outPacket; > av_init_packet(&outPacket); > outPacket.data = buffer; > outPacket.size = strlen((const char*)buffer); > rv = av_interleaved_write_frame(pOutputFormatCtx, > &outPacket); > av_free_packet(&outPacket); > } > } > delete [] buffer; > } > > if ( pCodecCtxSubtitle) > { > avcodec_close(pCodecCtxSubtitle); > pCodecCtxSubtitle= NULL; > } > if ( pCodecSubtitle ) > { > av_free(pCodecSubtitle); > pCodecSubtitle= NULL; > } > if ( pFormatCtx ) > { > avformat_close_input(&pFormatCtx); > avformat_free_context(pFormatCtx); > pFormatCtx = NULL; > } > avcodec_close(subtitle_st->codec); > return rv; > } > > PTS values are not calculated still, it is work in progress; but the above > code gives me this output: > > output temp.ass file: > > Dialogue: 0,0:00:00.00,0:00:00.00,Default,Hello > Dialogue: 0,0:00:00.00,0:00:00.00,Default,World > Dialogue: 0,0:00:00.00,0:00:00.00,Default,!!Again!! > > It is clearly missing all header information. > > When i run ffmpeg command line to convert orignal SRT file using: > > ffmpeg -i subtitle.srt temp.ass > > I get: > > [Script Info] > ScriptType: v4.00+ > > [V4+ Styles] > Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, > OutlineColour, BackColour, Bold, Italic, Underline, BorderStyle, Outline, > Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding > Style: > Default,Arial,16,&Hffffff,&Hffffff,&H0,&H0,0,0,0,1,1,0,2,10,10,10,0,0 > > [Events] > Format: Layer, Start, End, Style, Text > Dialogue: 0,0:00:02.00,0:00:06.00,Default,Hello > Dialogue: 0,0:00:15.00,0:00:20.00,Default,World > Dialogue: 0,0:01:00.00,0:01:10.00,Default,!!Again!! > > so my question is, even though I am calling avformat_write_header() > function, why isn't this header information being written through my code? > > Thanks in advance... > Perhaps some code was missing in my original email, which I have added: if (pCodecCtxSubtitle && pCodecCtxSubtitle->subtitle_header) { /* ASS code assumes this buffer is null terminated so add extra byte. */ subtitle_st->codec->subtitle_header = (uint8_t*) av_mallocz(pCodecCtxSubtitle->subtitle_header_size + 1); if (!subtitle_st->codec->subtitle_header) { ret = AVERROR(ENOMEM); //goto dump_format; } memcpy(subtitle_st->codec->subtitle_header, pCodecCtxSubtitle->subtitle_header, pCodecCtxSubtitle->subtitle_header_size); subtitle_st->codec->subtitle_header_size = pCodecCtxSubtitle->subtitle_header_size; } So, final code now looks like this: #include "stdafx.h" //using namespace std; #include #include #include #include #include //#include #include #include #include #include #include #include #define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 extern "C" { #include "libavcodec/avcodec.h" #include "libavformat/avformat.h" #include "libavdevice/avdevice.h" #include "libswscale/swscale.h" #include "libavutil/dict.h" #include "libavutil/error.h" #include "libavutil/opt.h" #include #include #include #include #include #include #include #include "libavfilter/avfiltergraph.h" #include "libavfilter/avcodec.h" #include "libavfilter/buffersink.h" #include "libavfilter/buffersrc.h" #include } //++decoder++// AVFormatContext *pFormatCtx = 0; int subtitleIndex = -1; AVPacket packet; AVCodecContext *pCodecCtxSubtitle = 0; AVCodec *pCodecSubtitle = 0; AVSubtitle subtitle; //--decoder-- //++encoder++ AVFormatContext *pOutputFormatCtx=0; AVStream *subtitle_st=0; AVOutputFormat *outputFmt=0; AVCodec *subtitle_codec=0; /* Add an output stream. */ AVStream *add_stream(AVFormatContext *oc, AVCodec **codec, enum AVCodecID codec_id) { AVCodecContext *c; AVStream *st; /* find the encoder */ *codec = avcodec_find_encoder(codec_id); if (!(*codec)) { fprintf(stderr, "Could not find encoder for '%s'\n", avcodec_get_name(codec_id)); exit(1); } st = avformat_new_stream(oc, *codec); if (!st) { fprintf(stderr, "Could not allocate stream\n"); exit(1); } st->id = oc->nb_streams-1; c = st->codec; avcodec_get_context_defaults3( c, *codec); switch ((*codec)->type) { case AVMEDIA_TYPE_SUBTITLE: break; default: break; } /* Some formats want stream headers to be separate. */ if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } void open_subtitle(AVFormatContext *oc, AVCodec *codec, AVStream *st) { int ret; AVCodecContext *c = st->codec; /* open the codec */ ret = avcodec_open2(c, codec, NULL); if (ret < 0) { exit(1); } } //--encoder-- int main (int argc, char **argv) { av_register_all(); avcodec_register_all(); avfilter_register_all(); char inputFilename[90]="subtitle.srt"; char outputFilename[90]="temp.ass"; int rv = 0; // ++decoder++ int got_subtitle = 0; pFormatCtx = avformat_alloc_context(); rv = avformat_open_input(&pFormatCtx, inputFilename, NULL, NULL); for(int i=0; i < pFormatCtx->nb_streams; i++) { if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_SUBTITLE) { subtitleIndex = i; } } if ( subtitleIndex >= 0 ) { pCodecCtxSubtitle=pFormatCtx->streams[subtitleIndex]->codec; pCodecSubtitle = avcodec_find_decoder(pCodecCtxSubtitle->codec_id); if(pCodecSubtitle==NULL) { return -1; // Codec not found } // Open codec AVDictionary *codecDictOptions = NULL; if(avcodec_open2(pCodecCtxSubtitle, pCodecSubtitle, &codecDictOptions) < 0 )//error { } } //--decoder-- //++encoder++ int ret; avformat_alloc_output_context2(&pOutputFormatCtx, NULL, NULL, outputFilename); if (!pOutputFormatCtx) { rv = 1; } //outputFmt = pOutputFormatCtx->oformat; outputFmt = av_guess_format( NULL, outputFilename, NULL ); if (outputFmt->subtitle_codec != AV_CODEC_ID_NONE) { subtitle_st = add_stream(pOutputFormatCtx, &subtitle_codec, outputFmt->subtitle_codec); } if (subtitle_st) open_subtitle(pOutputFormatCtx, subtitle_codec, subtitle_st); if (pCodecCtxSubtitle && pCodecCtxSubtitle->subtitle_header) { /* ASS code assumes this buffer is null terminated so add extra byte. */ subtitle_st->codec->subtitle_header = (uint8_t*) av_mallocz(pCodecCtxSubtitle->subtitle_header_size + 1); if (!subtitle_st->codec->subtitle_header) { ret = AVERROR(ENOMEM); //goto dump_format; } memcpy(subtitle_st->codec->subtitle_header, pCodecCtxSubtitle->subtitle_header, pCodecCtxSubtitle->subtitle_header_size); subtitle_st->codec->subtitle_header_size = pCodecCtxSubtitle->subtitle_header_size; } av_dump_format(pOutputFormatCtx, 0, outputFilename, 1); /* open the output file, if needed */ if (!(outputFmt->flags & AVFMT_NOFILE)) { if (avio_open(&pOutputFormatCtx->pb, outputFilename, AVIO_FLAG_WRITE) < 0) { rv = 1; } else { /* Write the stream header, if any. */ if (avformat_write_header(pOutputFormatCtx, NULL) < 0) { rv = 1; } } } AVCodecContext *c = subtitle_st->codec; //--encoder-- while( av_read_frame( pFormatCtx, &packet ) >= 0 ) { if(packet.stream_index != subtitle_st->index) continue; int gotSubtitle = 0; rv = avcodec_decode_subtitle2( pCodecCtxSubtitle, &subtitle, &gotSubtitle, &packet ); uint64_t bufferSize = 1024 * 1024 ; uint8_t *buffer = new uint8_t[bufferSize]; memset(buffer, 0, bufferSize); if( rv >= 0 ) { rv = avcodec_encode_subtitle( subtitle_st->codec, buffer, bufferSize, &subtitle ); if ( rv >= 0 ) { AVPacket outPacket; av_init_packet(&outPacket); outPacket.data = buffer; outPacket.size = strlen((const char*)buffer); rv = av_interleaved_write_frame(pOutputFormatCtx, &outPacket); av_free_packet(&outPacket); } } delete [] buffer; } if ( pCodecCtxSubtitle) { avcodec_close(pCodecCtxSubtitle); pCodecCtxSubtitle= NULL; } if ( pCodecSubtitle ) { av_free(pCodecSubtitle); pCodecSubtitle= NULL; } if ( pFormatCtx ) { avformat_close_input(&pFormatCtx); avformat_free_context(pFormatCtx); pFormatCtx = NULL; } avcodec_close(subtitle_st->codec); return rv; } Still, based on scenario posted with 1st email, it is not working. Hope to get some answers soon... Thanks... -------------- next part -------------- An HTML attachment was scrubbed... URL: From nfxjfg at googlemail.com Mon Dec 9 19:41:40 2013 From: nfxjfg at googlemail.com (wm4) Date: Mon, 9 Dec 2013 19:41:40 +0100 Subject: [Libav-user] How to keep AVFrame data after codec close In-Reply-To: References: <87C3DAE1-3780-4AD2-B967-5880DA22F9EE@spearmorgan.com> <20131207013945.05ddd75a@debian> Message-ID: <20131209194140.1bfb5fc4@debian> On Sat, 7 Dec 2013 22:16:41 -0800 Bruce Wheaton wrote: > On Dec 6, 2013, at 4:39 PM, wm4 wrote: > > > On Thu, 5 Dec 2013 10:53:37 -0800 > > Bruce Wheaton wrote: > > > >> On Dec 5, 2013, at 3:41 AM, Paul B Mahol wrote: > >> > >>> On 12/5/13, Eric Beuque wrote: > >>>> How i can tell libavcodec that i want to become the owner of the data and > >>>> be able to free it, to without codec context instance? I was thinking about > >>>> using get/release_buffer functions, but i don't know how to compute size of > >>>> the data. > >>>> > >>>> Is data memcpy the only way to do this? > >>>> > >>>> Note, that i also can't upgrade to new version of FFMPEG. > >>>> > >>>> Thanks for your help. > >>>> > >>> > >>> Use reference counting system. > >>> They you need to manually free frame once you will not need it > >>> (otherwise you leak memory), so you do not need to do copy. > >> > >> > >> In my recent experiments, it seemed that closing the codec actually frees all buffers, regardless of reference count. That makes sense - if the codec is gone, what would detect the decreased reference count? > > > > Did you set AVCodecContext.refcounted_frames to 1? There are other > > weird requirements to use refcounting, such as allocating AVFrames with > > av_frame_alloc() instead of avcodec_frame_alloc() (or whatever it was). > > Yes, I followed all the directions I could find, including those two. In the end, memory kept increasing, and I found that I couldn't keep buffers longer than i had the codec and context open. > > It was also quite a memory hog. Saving the copy turned out to have some downsides. This should not happen. Others (including myself) are using refcounting successfully. Are you unreffing the AVFrame before passing it do the decoder? Are you sure you're not using avcodec_free_frame() etc.? From mtaha.ansari at gmail.com Tue Dec 10 08:12:43 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Tue, 10 Dec 2013 12:12:43 +0500 Subject: [Libav-user] ASS subtitle header missing while encoding In-Reply-To: References: Message-ID: Thanks for the help, problem is fixed. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrfun.china at gmail.com Tue Dec 10 08:14:28 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Tue, 10 Dec 2013 18:14:28 +1100 Subject: [Libav-user] about video duration Message-ID: Hi friends, I'm now checking a duration issue of a video file. Here is some trace print out when file is opened, so we can know the dts of last AVPacket is 167542, and the last frame time stamp = 167376, and coded_picture_num = 4013 Line 100: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 0, Packet.pts = -9223372036854775808 Line 101: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 42, Packet.pts = -9223372036854775808 Line 102: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 83, Packet.pts = -9223372036854775808 Line 103: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 125, Packet.pts = -9223372036854775808 Line 104: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 167, Packet.pts = -9223372036854775808 Line 105: 00:00:33.400 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 0, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 0, pFrame->coded_picture_number = 0 Line 107: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 209, Packet.pts = -9223372036854775808 Line 108: 00:00:33.400 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 42, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 42, pFrame->coded_picture_number = 1 Line 110: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 250, Packet.pts = -9223372036854775808 Line 111: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 83, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 83, pFrame->coded_picture_number = 2 Line 113: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 292, Packet.pts = -9223372036854775808 Line 114: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 125, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 125, pFrame->coded_picture_number = 3 Line 116: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 334, Packet.pts = -9223372036854775808 Line 117: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 167, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 167, pFrame->coded_picture_number = 4 Line 119: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 375, Packet.pts = -9223372036854775808 Line 120: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 209, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 209, pFrame->coded_picture_number = 5 Line 122: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 417, Packet.pts = -9223372036854775808 Line 123: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 250, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 250, pFrame->coded_picture_number = 6 Line 125: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 459, Packet.pts = -9223372036854775808 Line 126: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 292, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 292, pFrame->coded_picture_number = 7 Line 128: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 501, Packet.pts = -9223372036854775808 Line 129: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 334, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 334, pFrame->coded_picture_number = 8 Line 131: 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 542, Packet.pts = -9223372036854775808 Line 132: 00:00:33.416 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 375, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 375, pFrame->coded_picture_number = 9 Line 12134: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167417, Packet.pts = -9223372036854775808 Line 12135: 00:00:51.168 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 167250, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 167250, pFrame->coded_picture_number = 4010 Line 12137: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167459, Packet.pts = -9223372036854775808 Line 12138: 00:00:51.168 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 167292, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 167292, pFrame->coded_picture_number = 4011 Line 12140: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167501, Packet.pts = -9223372036854775808 Line 12141: 00:00:51.168 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 167334, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 167334, pFrame->coded_picture_number = 4012 Line 12143: 00:00:51.184 MAIN rhbc73 process packet, Packet.dts = 167542, Packet.pts = -9223372036854775808 Line 12144: 00:00:51.184 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = 167376, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = 167376, pFrame->coded_picture_number = 4013 But when I check the file using ffprobe -show_frames -select_streams v input I could see [FRAME] media_type=video key_frame=0 pkt_pts=N/A pkt_pts_time=N/A pkt_dts=167501 pkt_dts_time=167.501000 pkt_duration=N/A pkt_duration_time=N/A pkt_pos=103794518 pkt_size=74 width=1920 height=1080 pix_fmt=yuv420p sample_aspect_ratio=1:1 pict_type=P coded_picture_number=4016 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 [/FRAME] [FRAME] media_type=video key_frame=0 pkt_pts=N/A pkt_pts_time=N/A pkt_dts=167542 pkt_dts_time=167.542000 pkt_duration=N/A pkt_duration_time=N/A pkt_pos=103794920 pkt_size=74 width=1920 height=1080 pix_fmt=yuv420p sample_aspect_ratio=1:1 pict_type=P coded_picture_number=4017 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 [/FRAME] the ffprobe and ffmpeg libs were built from same latest source, so I'd like to know why ffprobe could dump a last frame of timestamp 167542 but av_read_frame + avcodec_decode_video2 couldn't Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From safiuddinkhan at gmail.com Tue Dec 10 13:59:40 2013 From: safiuddinkhan at gmail.com (Safi ud Din Khan) Date: Tue, 10 Dec 2013 17:59:40 +0500 Subject: [Libav-user] about video duration In-Reply-To: References: Message-ID: <52A7103C.60400@gmail.com> I can understand its all extremely confusing .... i have also been to this stuff it took me 5 moths just to understand how everything worked ..... my advice to you you is that you should atlest read about how mpeg 2 compression works .... mpeg4 , h264 and other compression are quiet complex but at their core they work pretty much like mpeg 2 compression atlest concern mpeg2 part in this book its bit out dated but you would understand that how everything works https://dl.dropboxusercontent.com/u/15671916/video%20compression/DigitalVideoAndHDTVAlgorithmsAndInterfaces.pdf you dont need to have to go too deep to understand video decoding/encoding ... ffmpeg library will do much for you ... just get some of how mpeg 2 codec works On 12/10/2013 12:14 PM, YIRAN LI wrote: > Hi friends, > > > I'm now checking a duration issue of a video file. > Here is some trace print out when file is opened, so we can know the > dts of last AVPacket is 167542, and the last frame time stamp = > 167376, and coded_picture_num = 4013 > > > Line 100: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 0, > Packet.pts = -9223372036854775808 Line 101: 00:00:33.384 MAIN rhbc73 > process packet, Packet.dts = 42, Packet.pts = -9223372036854775808 > Line 102: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 83, > Packet.pts = -9223372036854775808 Line 103: 00:00:33.400 MAIN rhbc73 > process packet, Packet.dts = 125, Packet.pts = -9223372036854775808 > Line 104: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 167, > Packet.pts = -9223372036854775808 Line 105: 00:00:33.400 MAIN rhbc73 > -- get a full frame, pFrame->pkt_dts = 0, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 0, > pFrame->coded_picture_number = 0 Line 107: 00:00:33.400 MAIN rhbc73 > process packet, Packet.dts = 209, Packet.pts = -9223372036854775808 > Line 108: 00:00:33.400 MAIN rhbc73 -- get a full frame, > pFrame->pkt_dts = 42, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 42, pFrame->coded_picture_number = 1 Line 110: > 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 250, Packet.pts > = -9223372036854775808 Line 111: 00:00:33.416 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 83, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 83, > pFrame->coded_picture_number = 2 Line 113: 00:00:33.416 MAIN rhbc73 > process packet, Packet.dts = 292, Packet.pts = -9223372036854775808 > Line 114: 00:00:33.416 MAIN rhbc73 -- get a full frame, > pFrame->pkt_dts = 125, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 125, pFrame->coded_picture_number = 3 Line 116: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 334, Packet.pts > = -9223372036854775808 Line 117: 00:00:33.416 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 167, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167, > pFrame->coded_picture_number = 4 Line 119: 00:00:33.416 MAIN rhbc73 > process packet, Packet.dts = 375, Packet.pts = -9223372036854775808 > Line 120: 00:00:33.416 MAIN rhbc73 -- get a full frame, > pFrame->pkt_dts = 209, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 209, pFrame->coded_picture_number = 5 Line 122: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 417, Packet.pts > = -9223372036854775808 Line 123: 00:00:33.416 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 250, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 250, > pFrame->coded_picture_number = 6 Line 125: 00:00:33.416 MAIN rhbc73 > process packet, Packet.dts = 459, Packet.pts = -9223372036854775808 > Line 126: 00:00:33.416 MAIN rhbc73 -- get a full frame, > pFrame->pkt_dts = 292, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 292, pFrame->coded_picture_number = 7 Line 128: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 501, Packet.pts > = -9223372036854775808 Line 129: 00:00:33.416 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 334, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 334, > pFrame->coded_picture_number = 8 Line 131: 00:00:33.416 MAIN rhbc73 > process packet, Packet.dts = 542, Packet.pts = -9223372036854775808 > Line 132: 00:00:33.416 MAIN rhbc73 -- get a full frame, > pFrame->pkt_dts = 375, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 375, pFrame->coded_picture_number = 9 Line > 12134: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167417, > Packet.pts = -9223372036854775808 Line 12135: 00:00:51.168 MAIN rhbc73 > -- get a full frame, pFrame->pkt_dts = 167250, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167250, > pFrame->coded_picture_number = 4010 Line 12137: 00:00:51.168 MAIN > rhbc73 process packet, Packet.dts = 167459, Packet.pts = > -9223372036854775808 Line 12138: 00:00:51.168 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 167292, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167292, > pFrame->coded_picture_number = 4011 Line 12140: 00:00:51.168 MAIN > rhbc73 process packet, Packet.dts = 167501, Packet.pts = > -9223372036854775808 Line 12141: 00:00:51.168 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 167334, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167334, > pFrame->coded_picture_number = 4012 Line 12143: 00:00:51.184 MAIN > rhbc73 process packet, Packet.dts = 167542, Packet.pts = > -9223372036854775808 Line 12144: 00:00:51.184 MAIN rhbc73 -- get a > full frame, pFrame->pkt_dts = 167376, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167376, > pFrame->coded_picture_number = 4013 > > But when I check the file using ffprobe -show_frames -select_streams v > input I could see > > [FRAME] > media_type=video > key_frame=0 > pkt_pts=N/A > pkt_pts_time=N/A > pkt_dts=167501 > pkt_dts_time=167.501000 > pkt_duration=N/A > pkt_duration_time=N/A > pkt_pos=103794518 > pkt_size=74 > width=1920 > height=1080 > pix_fmt=yuv420p > sample_aspect_ratio=1:1 > pict_type=P > coded_picture_number=4016 > display_picture_number=0 > interlaced_frame=0 > top_field_first=0 > repeat_pict=0 > [/FRAME] > [FRAME] > media_type=video > key_frame=0 > pkt_pts=N/A > pkt_pts_time=N/A > pkt_dts=167542 > pkt_dts_time=167.542000 > pkt_duration=N/A > pkt_duration_time=N/A > pkt_pos=103794920 > pkt_size=74 > width=1920 > height=1080 > pix_fmt=yuv420p > sample_aspect_ratio=1:1 > pict_type=P > coded_picture_number=4017 > display_picture_number=0 > interlaced_frame=0 > top_field_first=0 > repeat_pict=0 > [/FRAME] > > the ffprobe and ffmpeg libs were built from same latest source, so I'd > like to know why ffprobe could dump a last frame of timestamp 167542 > but av_read_frame + avcodec_decode_video2 > couldn't > > > Thanks > > > _______________________________________________ > 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 vinvinod at gmail.com Tue Dec 10 15:00:19 2013 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Tue, 10 Dec 2013 19:30:19 +0530 Subject: [Libav-user] about video duration In-Reply-To: <52A7103C.60400@gmail.com> References: <52A7103C.60400@gmail.com> Message-ID: It would be better if you can give a link to the test video file also. On Tue, Dec 10, 2013 at 6:29 PM, Safi ud Din Khan wrote: > I can understand its all extremely confusing .... i have also been to > this stuff it took me 5 moths just to understand how everything worked > ..... > > my advice to you you is that you should atlest read about how mpeg 2 > compression works .... mpeg4 , h264 and other compression are quiet complex > but at their core they work pretty much like mpeg 2 compression > > atlest concern mpeg2 part in this book its bit out dated but you would > understand that how everything works > > > https://dl.dropboxusercontent.com/u/15671916/video%20compression/DigitalVideoAndHDTVAlgorithmsAndInterfaces.pdf > > you dont need to have to go too deep to understand video decoding/encoding > ... ffmpeg library will do much for you ... just get some of how mpeg 2 > codec works > > On 12/10/2013 12:14 PM, YIRAN LI wrote: > > Hi friends, > > > I'm now checking a duration issue of a video file. > Here is some trace print out when file is opened, so we can know the dts > of last AVPacket is 167542, and the last frame time stamp = 167376, and > coded_picture_num = 4013 > > > Line 100: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 0, > Packet.pts = -9223372036854775808 Line 101: 00:00:33.384 MAIN rhbc73 > process packet, Packet.dts = 42, Packet.pts = -9223372036854775808 Line > 102: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 83, Packet.pts = > -9223372036854775808 Line 103: 00:00:33.400 MAIN rhbc73 process packet, > Packet.dts = 125, Packet.pts = -9223372036854775808 Line 104: 00:00:33.400 > MAIN rhbc73 process packet, Packet.dts = 167, Packet.pts = > -9223372036854775808 Line 105: 00:00:33.400 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 0, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 0, pFrame->coded_picture_number = 0 Line 107: > 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 209, Packet.pts = > -9223372036854775808 Line 108: 00:00:33.400 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 42, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 42, pFrame->coded_picture_number = 1 Line 110: > 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 250, Packet.pts = > -9223372036854775808 Line 111: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 83, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 83, pFrame->coded_picture_number = 2 Line 113: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 292, Packet.pts = > -9223372036854775808 Line 114: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 125, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 125, pFrame->coded_picture_number = 3 Line 116: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 334, Packet.pts = > -9223372036854775808 Line 117: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 167, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 167, pFrame->coded_picture_number = 4 Line 119: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 375, Packet.pts = > -9223372036854775808 Line 120: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 209, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 209, pFrame->coded_picture_number = 5 Line 122: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 417, Packet.pts = > -9223372036854775808 Line 123: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 250, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 250, pFrame->coded_picture_number = 6 Line 125: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 459, Packet.pts = > -9223372036854775808 Line 126: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 292, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 292, pFrame->coded_picture_number = 7 Line 128: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 501, Packet.pts = > -9223372036854775808 Line 129: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 334, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 334, pFrame->coded_picture_number = 8 Line 131: > 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 542, Packet.pts = > -9223372036854775808 Line 132: 00:00:33.416 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 375, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 375, pFrame->coded_picture_number = 9 Line 12134: > 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167417, Packet.pts = > -9223372036854775808 Line 12135: 00:00:51.168 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 167250, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 167250, pFrame->coded_picture_number = 4010 Line > 12137: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167459, > Packet.pts = -9223372036854775808 Line 12138: 00:00:51.168 MAIN rhbc73 -- > get a full frame, pFrame->pkt_dts = 167292, pFrame->pkt_pts = > -9223372036854775808, BestEffortTimeStamp = 167292, > pFrame->coded_picture_number = 4011 Line 12140: 00:00:51.168 MAIN rhbc73 > process packet, Packet.dts = 167501, Packet.pts = -9223372036854775808 Line > 12141: 00:00:51.168 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = > 167334, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = > 167334, pFrame->coded_picture_number = 4012 Line 12143: 00:00:51.184 MAIN > rhbc73 process packet, Packet.dts = 167542, Packet.pts = > -9223372036854775808 Line 12144: 00:00:51.184 MAIN rhbc73 -- get a full > frame, pFrame->pkt_dts = 167376, pFrame->pkt_pts = -9223372036854775808, > BestEffortTimeStamp = 167376, pFrame->coded_picture_number = 4013 > > But when I check the file using ffprobe -show_frames -select_streams v > input I could see > > [FRAME] > media_type=video > key_frame=0 > pkt_pts=N/A > pkt_pts_time=N/A > pkt_dts=167501 > pkt_dts_time=167.501000 > pkt_duration=N/A > pkt_duration_time=N/A > pkt_pos=103794518 > pkt_size=74 > width=1920 > height=1080 > pix_fmt=yuv420p > sample_aspect_ratio=1:1 > pict_type=P > coded_picture_number=4016 > display_picture_number=0 > interlaced_frame=0 > top_field_first=0 > repeat_pict=0 > [/FRAME] > [FRAME] > media_type=video > key_frame=0 > pkt_pts=N/A > pkt_pts_time=N/A > pkt_dts=167542 > pkt_dts_time=167.542000 > pkt_duration=N/A > pkt_duration_time=N/A > pkt_pos=103794920 > pkt_size=74 > width=1920 > height=1080 > pix_fmt=yuv420p > sample_aspect_ratio=1:1 > pict_type=P > coded_picture_number=4017 > display_picture_number=0 > interlaced_frame=0 > top_field_first=0 > repeat_pict=0 > [/FRAME] > > the ffprobe and ffmpeg libs were built from same latest source, so I'd > like to know why ffprobe could dump a last frame of timestamp 167542 but > av_read_frame + avcodec_decode_video2 > couldn't > > > Thanks > > > _______________________________________________ > Libav-user mailing listLibav-user at ffmpeg.orghttp://ffmpeg.org/mailman/listinfo/libav-user > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Vinod H I -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrfun.china at gmail.com Tue Dec 10 23:29:34 2013 From: mrfun.china at gmail.com (YIRAN LI) Date: Wed, 11 Dec 2013 09:29:34 +1100 Subject: [Libav-user] about video duration In-Reply-To: References: <52A7103C.60400@gmail.com> Message-ID: Hi friends, The test video I used is a bit large, it's about 100 MB https://dl.dropboxusercontent.com/u/89678527/Threw%20It%20On%20The%20Ground.avi 2013/12/11 ?????? Vinod H I > It would be better if you can give a link to the test video file also. > > > On Tue, Dec 10, 2013 at 6:29 PM, Safi ud Din Khan > wrote: > >> I can understand its all extremely confusing .... i have also been to >> this stuff it took me 5 moths just to understand how everything worked >> ..... >> >> my advice to you you is that you should atlest read about how mpeg 2 >> compression works .... mpeg4 , h264 and other compression are quiet complex >> but at their core they work pretty much like mpeg 2 compression >> >> atlest concern mpeg2 part in this book its bit out dated but you would >> understand that how everything works >> >> >> https://dl.dropboxusercontent.com/u/15671916/video%20compression/DigitalVideoAndHDTVAlgorithmsAndInterfaces.pdf >> >> you dont need to have to go too deep to understand video >> decoding/encoding ... ffmpeg library will do much for you ... just get some >> of how mpeg 2 codec works >> >> On 12/10/2013 12:14 PM, YIRAN LI wrote: >> >> Hi friends, >> >> >> I'm now checking a duration issue of a video file. >> Here is some trace print out when file is opened, so we can know the dts >> of last AVPacket is 167542, and the last frame time stamp = 167376, and >> coded_picture_num = 4013 >> >> >> Line 100: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 0, >> Packet.pts = -9223372036854775808 Line 101: 00:00:33.384 MAIN rhbc73 >> process packet, Packet.dts = 42, Packet.pts = -9223372036854775808 Line >> 102: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 83, Packet.pts = >> -9223372036854775808 Line 103: 00:00:33.400 MAIN rhbc73 process packet, >> Packet.dts = 125, Packet.pts = -9223372036854775808 Line 104: 00:00:33.400 >> MAIN rhbc73 process packet, Packet.dts = 167, Packet.pts = >> -9223372036854775808 Line 105: 00:00:33.400 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 0, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 0, pFrame->coded_picture_number = 0 Line 107: >> 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 209, Packet.pts = >> -9223372036854775808 Line 108: 00:00:33.400 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 42, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 42, pFrame->coded_picture_number = 1 Line 110: >> 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 250, Packet.pts = >> -9223372036854775808 Line 111: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 83, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 83, pFrame->coded_picture_number = 2 Line 113: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 292, Packet.pts = >> -9223372036854775808 Line 114: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 125, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 125, pFrame->coded_picture_number = 3 Line 116: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 334, Packet.pts = >> -9223372036854775808 Line 117: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 167, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 167, pFrame->coded_picture_number = 4 Line 119: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 375, Packet.pts = >> -9223372036854775808 Line 120: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 209, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 209, pFrame->coded_picture_number = 5 Line 122: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 417, Packet.pts = >> -9223372036854775808 Line 123: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 250, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 250, pFrame->coded_picture_number = 6 Line 125: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 459, Packet.pts = >> -9223372036854775808 Line 126: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 292, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 292, pFrame->coded_picture_number = 7 Line 128: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 501, Packet.pts = >> -9223372036854775808 Line 129: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 334, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 334, pFrame->coded_picture_number = 8 Line 131: >> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 542, Packet.pts = >> -9223372036854775808 Line 132: 00:00:33.416 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 375, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 375, pFrame->coded_picture_number = 9 Line 12134: >> 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167417, Packet.pts = >> -9223372036854775808 Line 12135: 00:00:51.168 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 167250, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 167250, pFrame->coded_picture_number = 4010 Line >> 12137: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167459, >> Packet.pts = -9223372036854775808 Line 12138: 00:00:51.168 MAIN rhbc73 -- >> get a full frame, pFrame->pkt_dts = 167292, pFrame->pkt_pts = >> -9223372036854775808, BestEffortTimeStamp = 167292, >> pFrame->coded_picture_number = 4011 Line 12140: 00:00:51.168 MAIN rhbc73 >> process packet, Packet.dts = 167501, Packet.pts = -9223372036854775808 Line >> 12141: 00:00:51.168 MAIN rhbc73 -- get a full frame, pFrame->pkt_dts = >> 167334, pFrame->pkt_pts = -9223372036854775808, BestEffortTimeStamp = >> 167334, pFrame->coded_picture_number = 4012 Line 12143: 00:00:51.184 MAIN >> rhbc73 process packet, Packet.dts = 167542, Packet.pts = >> -9223372036854775808 Line 12144: 00:00:51.184 MAIN rhbc73 -- get a full >> frame, pFrame->pkt_dts = 167376, pFrame->pkt_pts = -9223372036854775808, >> BestEffortTimeStamp = 167376, pFrame->coded_picture_number = 4013 >> >> But when I check the file using ffprobe -show_frames -select_streams v >> input I could see >> >> [FRAME] >> media_type=video >> key_frame=0 >> pkt_pts=N/A >> pkt_pts_time=N/A >> pkt_dts=167501 >> pkt_dts_time=167.501000 >> pkt_duration=N/A >> pkt_duration_time=N/A >> pkt_pos=103794518 >> pkt_size=74 >> width=1920 >> height=1080 >> pix_fmt=yuv420p >> sample_aspect_ratio=1:1 >> pict_type=P >> coded_picture_number=4016 >> display_picture_number=0 >> interlaced_frame=0 >> top_field_first=0 >> repeat_pict=0 >> [/FRAME] >> [FRAME] >> media_type=video >> key_frame=0 >> pkt_pts=N/A >> pkt_pts_time=N/A >> pkt_dts=167542 >> pkt_dts_time=167.542000 >> pkt_duration=N/A >> pkt_duration_time=N/A >> pkt_pos=103794920 >> pkt_size=74 >> width=1920 >> height=1080 >> pix_fmt=yuv420p >> sample_aspect_ratio=1:1 >> pict_type=P >> coded_picture_number=4017 >> display_picture_number=0 >> interlaced_frame=0 >> top_field_first=0 >> repeat_pict=0 >> [/FRAME] >> >> the ffprobe and ffmpeg libs were built from same latest source, so I'd >> like to know why ffprobe could dump a last frame of timestamp 167542 but >> av_read_frame + avcodec_decode_video2 >> couldn't >> >> >> Thanks >> >> >> _______________________________________________ >> Libav-user mailing listLibav-user at ffmpeg.orghttp://ffmpeg.org/mailman/listinfo/libav-user >> >> >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > > > -- > Vinod H I > > > _______________________________________________ > 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 Dec 11 00:12:30 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 10 Dec 2013 23:12:30 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?packet_flag_AV=5FPKT=5FFLAG=5FKEY?= References: Message-ID: Don Moir writes: > Not sure what AV_PKT_FLAG_KEY is supposed to mean. > The assumption to me early on is it represented a key > frame but not necessarily. Apart from the fact that I simply don't understand the second sentence: What is missing here imo is what is unclear in your opinion about the documentation (or for which input stream the documentation does not match the behaviour). Note that valid H.264 streams do not necessarily contain keyframes and therefore do not necessarily contain packets with this flag set. Carl Eugen From donmoir at comcast.net Wed Dec 4 13:41:39 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:41:39 -0500 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: Message-ID: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP> ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Tuesday, December 10, 2013 6:12 PM Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > Don Moir writes: > >> Not sure what AV_PKT_FLAG_KEY is supposed to mean. >> The assumption to me early on is it represented a key >> frame but not necessarily. > > Apart from the fact that I simply don't understand the > second sentence: Hard to understand is right and still tring to understand. > What is missing here imo is what is unclear in your opinion > about the documentation (or for which input stream the > documentation does not match the behaviour). > Note that valid H.264 streams do not necessarily contain > keyframes and therefore do not necessarily contain packets > with this flag set. > > Carl Eugen Yes I understand about H.264. The confusion is when there are known key frame index_entries and these do represent at least a start point for a key frame. Now seems AV_PKT_FLAG_KEY should dovetail with those entries but it does not. If you look around some you find confusion about the usage of AV_PKT_FLAG_KEY. If this is used internally for some special case, then IMO another flag should have been used. The intent of the flag is just not documented well. Ideally I think it should mark the start of a key frame and at least dovetail with index_entries but I am sure it goes deeper than that. From yamusanivinay at gmail.com Wed Dec 11 07:43:16 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Wed, 11 Dec 2013 12:13:16 +0530 Subject: [Libav-user] Song Duration Message-ID: Hi All, How to get duration of song in milliseconds.Is there any method available to get meta data of song. Thanks & Regards, Bitfield. -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Wed Dec 11 08:07:31 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Wed, 11 Dec 2013 08:07:31 +0100 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY In-Reply-To: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP> References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP> Message-ID: On Wed, Dec 4, 2013 at 1:41 PM, Don Moir wrote: > > ----- Original Message ----- From: "Carl Eugen Hoyos" > To: > Sent: Tuesday, December 10, 2013 6:12 PM > > Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > > >> Don Moir writes: >> >>> Not sure what AV_PKT_FLAG_KEY is supposed to mean. >>> The assumption to me early on is it represented a key >>> frame but not necessarily. >> >> >> Apart from the fact that I simply don't understand the >> second sentence: > > > Hard to understand is right and still tring to understand. > > >> What is missing here imo is what is unclear in your opinion >> about the documentation (or for which input stream the >> documentation does not match the behaviour). >> Note that valid H.264 streams do not necessarily contain >> keyframes and therefore do not necessarily contain packets >> with this flag set. >> >> Carl Eugen > > > Yes I understand about H.264. The confusion is when there are known key > frame index_entries and these do represent at least a start point for a key > frame. Now seems AV_PKT_FLAG_KEY should dovetail with those entries but it > does not. > > If you look around some you find confusion about the usage of > AV_PKT_FLAG_KEY. If this is used internally for some special case, then IMO > another flag should have been used. The intent of the flag is just not > documented well. Ideally I think it should mark the start of a key frame and > at least dovetail with index_entries but I am sure it goes deeper than that. The index usually comes directly from the source file. Its not generated by avformat. (avformat has some limited index generation functionality, but only for content you already read from the file, so its kinda worthless) The key flag comes either from the file as well, or its filled by the codec parser. In the first case, its up to the file if it matches to an index entry, in the second, there is no guarantee whatsoever. If i take MKV as an example, index entries correspond to the Cue elements in the file. While the position pointed to by a Cue should start with a keyframe, there is no rule whatsoever that every keyframe also needs to have a Cue element. In short, as with many things in avformat, it just gives you the data as it was stored in the file. If that doesn't match your expectations, blame the file. From donmoir at comcast.net Wed Dec 4 13:53:30 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:53:30 -0500 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP> Message-ID: <2547CD7D78C045C89CB9ED1D111F649C@MANLAP> ----- Original Message ----- From: "Hendrik Leppkes" To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." Sent: Wednesday, December 11, 2013 2:07 AM Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > On Wed, Dec 4, 2013 at 1:41 PM, Don Moir wrote: >> >> ----- Original Message ----- From: "Carl Eugen Hoyos" >> To: >> Sent: Tuesday, December 10, 2013 6:12 PM >> >> Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY >> >> >>> Don Moir writes: >>> >>>> Not sure what AV_PKT_FLAG_KEY is supposed to mean. >>>> The assumption to me early on is it represented a key >>>> frame but not necessarily. >>> >>> >>> Apart from the fact that I simply don't understand the >>> second sentence: >> >> >> Hard to understand is right and still tring to understand. >> >> >>> What is missing here imo is what is unclear in your opinion >>> about the documentation (or for which input stream the >>> documentation does not match the behaviour). >>> Note that valid H.264 streams do not necessarily contain >>> keyframes and therefore do not necessarily contain packets >>> with this flag set. >>> >>> Carl Eugen >> >> >> Yes I understand about H.264. The confusion is when there are known key >> frame index_entries and these do represent at least a start point for a key >> frame. Now seems AV_PKT_FLAG_KEY should dovetail with those entries but it >> does not. >> >> If you look around some you find confusion about the usage of >> AV_PKT_FLAG_KEY. If this is used internally for some special case, then IMO >> another flag should have been used. The intent of the flag is just not >> documented well. Ideally I think it should mark the start of a key frame and >> at least dovetail with index_entries but I am sure it goes deeper than that. > > > The index usually comes directly from the source file. Its not > generated by avformat. (avformat has some limited index generation > functionality, but only for content you already read from the file, so > its kinda worthless) Might be useful to add entries at times like for scrubbing. App could add the entries with care. > The key flag comes either from the file as well, or its filled by the > codec parser. In the first case, its up to the file if it matches to > an index entry, in the second, there is no guarantee whatsoever. > > If i take MKV as an example, index entries correspond to the Cue > elements in the file. While the position pointed to by a Cue should > start with a keyframe, there is no rule whatsoever that every keyframe > also needs to have a Cue element. Yeah just trying to understand that connection if any. > In short, as with many things in avformat, it just gives you the data > as it was stored in the file. If that doesn't match your expectations, > blame the file. I suppose my only initial expectation long ago was that AVDISCARD_NONKEY worked as expected. I see its gotten better in some areas but not in others. Haven't tested it too much lately though. Even if AVDISCARD_NONKEY was dependable, I like the better control you get with AV_PKT_FLAG_KEY as long that works as it should. Thanks for the info. From cehoyos at ag.or.at Wed Dec 11 12:16:27 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 11 Dec 2013 11:16:27 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?packet_flag_AV=5FPKT=5FFLAG=5FKEY?= References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP> <2547CD7D78C045C89CB9ED1D111F649C@MANLAP> Message-ID: Don Moir writes: > I suppose my only initial expectation long ago was that > AVDISCARD_NONKEY worked as expected. I see its gotten > better in some areas but not in others. Please provide samples for which AVDISCARD_NONKEY does not work correctly (but remember that there are valid H.264 streams for which it correctly discards all frames). Carl Eugen From andrey.krieger.utkin at gmail.com Wed Dec 11 13:06:32 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Wed, 11 Dec 2013 14:06:32 +0200 Subject: [Libav-user] Song Duration In-Reply-To: References: Message-ID: 2013/12/11 Yamusani Vinay : > Hi All, > > How to get duration of song in milliseconds.Is there any method available to > get meta data of song. AFAIR AVFormatContext.duration. -- Andrey Utkin From Ioan.Stan at accesa.eu Wed Dec 11 16:15:47 2013 From: Ioan.Stan at accesa.eu (Ioan Stan) Date: Wed, 11 Dec 2013 15:15:47 +0000 Subject: [Libav-user] Licensing question Message-ID: <253315DA14D1B845989E427C7EA0BFE2284807AD@SRV001.misoft-systems.net> Hi, I want to use FFmpeg library in a closed-source application on windows and I have some questions regarded to licensing: 1. Let's suppose that I have a library a.dll that is linked statically or dynamically (uses some functionality) with FFmpeg. Another library b.dll is linked dynamically with a.dll. An application App.exe uses b.dll as a plug-in (loads the plug-in at runtime). In this scenario does a.dll, b.dll or App.exe become under LGPLv2.1 or later ? Does the source code corresponding to a.dll, b.dll and App.exe become under LGPLv2.1 or later ? In case the answer is yes, which of these libraries becomes under LGPLv2.1 or later ? Which part of the source code (used to compile above libraries) become under LGPLv2.1 or later? 2. Also, if we want to provide, together with our application, a not-modified copy of FFmpeg, took from your FFmpeg's web page or compiled and linked by us, can our work still be considered a "work that uses the library" ? Thank you, Ioan Best regards, Ioan Stan senior software developer T : [ro] +40 3645 607 20; [de] +49 89 2154 892 20 E : Ioan.Stan at accesa.eu Check our Accesa Rebranding Event pictures here ... M?nchen | Cluj Napoca | Oradea | www.accesa.eu | [LinkedIn] [Xing] [Facebook] -------------- next part -------------- An HTML attachment was scrubbed... URL: From perez.didac at gmail.com Wed Dec 11 16:22:43 2013 From: perez.didac at gmail.com (=?ISO-8859-1?Q?D=EDdac_P=E9rez?=) Date: Wed, 11 Dec 2013 16:22:43 +0100 Subject: [Libav-user] Saving a range of frames from a network camera (RTSP) to a mp4 file Message-ID: Hi all, I am quite confused about how to save a video stream into a mp4 file. Let me explain the problem: 1. I connect to a network camera via RTSP (H.264 stream) with avformat_open_input(), avformat_find_stream_info(), av_read_play(), and I get frames with av_read_frame(). 2. Each time I get a frame with av_read_frame(), I store the corresponding AVPacket in a circular buffer. 3. In some points in my application, a range of this circular buffer is selected. I find a key frame used to start from. 4. Once I have a list of AVPacket's starting from a key frame, I write header, frames, and tail, as I described below in the code. The problem is that the resulting mp4 video has artifacts if I try to watch it using VLC, Windows Media Player, or another one. I have also realized that the pts of that packets are not continuous, while dts are continuous. I know about B frames, but is this a problem in my case? // Prepare the output AVFormatContext* oc = avformat_alloc_context(); oc->oformat = av_guess_format(NULL, "video.mp4", NULL); // Must write header, packets, and trailing avio_open2(&oc->pb, "video.mp4", AVIO_FLAG_WRITE, NULL, NULL); // Write header AVStream* stream = avformat_new_stream(oc, (AVCodec*) context->streams[video_stream_index]->codec->codec); avcodec_copy_context(stream->codec, context->streams[video_stream_index]->codec); stream->sample_aspect_ratio = context->streams[video_stream_index]->codec->sample_aspect_ratio; avformat_write_header(oc, NULL); // FOR EACH FRAME... ... av_write_frame(oc, circular[k]); ... // Write trailer and close the file av_write_trailer(oc); avcodec_close(stream->codec); avio_close(oc->pb); avformat_free_context(oc); Thank you so much, -- D?dac P?rez -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Dec 11 16:47:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 11 Dec 2013 15:47:19 +0000 (UTC) Subject: [Libav-user] Licensing question References: <253315DA14D1B845989E427C7EA0BFE2284807AD@SRV001.misoft-systems.net> Message-ID: Ioan Stan writes: > 2.?????? > Also, if we want to provide, together with our application, > a not-modified copy of FFmpeg, took from your FFmpeg?s web > page or compiled and linked by us, can our work still be > considered a ?work that uses the library? ?? IANAL. Do you mean FFmpeg or ffmpeg? If you mean ffmpeg (the application) and if your application is not linked to libavcodec etc. but if your application simply calls ("exec") ffmpeg, then none of the usual obligations are relevant for your application. Don't forget that if you distribute ffmpeg (the application) you are responsible for providing the exact source code you used to compile the executable (we do not offer executables, you therefore cannot download them from FFmpeg's web page) and you have to make sure that your users know that ffmpeg was installed and under which license it was installed. (Please don't claim that you "own" FFmpeg, we read this in practically every EULA.) Concerning "not-modified" (just to make 100% sure): You have the right to modify FFmpeg, it makes no difference if you modify it or not. (I am just adding this because some people seem to believe that it does make a difference and your question could imply that you also think so.) Concerning your first question: I suspect it also contains a typo, at least I cannot parse it, please try to ask again with a little more information. Carl Eugen From Ioan.Stan at accesa.eu Wed Dec 11 17:08:56 2013 From: Ioan.Stan at accesa.eu (Ioan Stan) Date: Wed, 11 Dec 2013 16:08:56 +0000 Subject: [Libav-user] Licensing question In-Reply-To: References: <253315DA14D1B845989E427C7EA0BFE2284807AD@SRV001.misoft-systems.net> Message-ID: <253315DA14D1B845989E427C7EA0BFE228481804@SRV001.misoft-systems.net> Hi, I meant FFmpeg library (not application) in both questions. Also I updated question 1. Hope is more clear now. Thank you, Ioan 1. Let?s suppose that I own a library named "a.dll" that is linked statically or dynamically with FFmpeg library. Another library owned by me and named "b.dll" is linked dynamically with "a.dll". A plug-in based application owned by me and named "App.exe" uses "b.dll" as a plug-in (loads the plug-in at runtime). In this scenario does "a.dll", "b.dll" or "App.exe" become under LGPLv2.1 or later ? Does the source code corresponding to "a.dll", "b.dll" and "App.exe" become under LGPLv2.1 or later ? In case the answer is yes, which of these libraries/executable becomes under LGPLv2.1 or later ? Which part of the source code owned by me and used to compile above libraries become under LGPLv2.1 or later? Best regards, Ioan Stan senior software developer T : [ro] +40 3645 607 20; [de] +49 89 2154 892 20 E : Ioan.Stan at accesa.eu M?nchen | Cluj Napoca | Oradea | www.accesa.eu -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: Wednesday, December 11, 2013 5:47 PM To: libav-user at ffmpeg.org Subject: Re: [Libav-user] Licensing question Ioan Stan writes: > 2. > Also, if we want to provide, together with our application, a > not-modified copy of FFmpeg, took from your FFmpeg?s web page or > compiled and linked by us, can our work still be considered a ?work > that uses the library? ? IANAL. Do you mean FFmpeg or ffmpeg? If you mean ffmpeg (the application) and if your application is not linked to libavcodec etc. but if your application simply calls ("exec") ffmpeg, then none of the usual obligations are relevant for your application. Don't forget that if you distribute ffmpeg (the application) you are responsible for providing the exact source code you used to compile the executable (we do not offer executables, you therefore cannot download them from FFmpeg's web page) and you have to make sure that your users know that ffmpeg was installed and under which license it was installed. (Please don't claim that you "own" FFmpeg, we read this in practically every EULA.) Concerning "not-modified" (just to make 100% sure): You have the right to modify FFmpeg, it makes no difference if you modify it or not. (I am just adding this because some people seem to believe that it does make a difference and your question could imply that you also think so.) Concerning your first question: I suspect it also contains a typo, at least I cannot parse it, please try to ask again with a little more information. Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From andrey.krieger.utkin at gmail.com Wed Dec 11 19:47:31 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Wed, 11 Dec 2013 20:47:31 +0200 Subject: [Libav-user] Saving a range of frames from a network camera (RTSP) to a mp4 file In-Reply-To: References: Message-ID: It would be easier to check if you make up a minimal but complete application that reproduces issue in stable way, and a sample source file or URL. -- Andrey Utkin From donmoir at comcast.net Wed Dec 4 13:23:13 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:23:13 -0500 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP> Message-ID: <7AD1227005F1464F9904E75CA408B271@MANLAP> ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Wednesday, December 11, 2013 6:16 AM Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > Don Moir writes: > >> I suppose my only initial expectation long ago was that >> AVDISCARD_NONKEY worked as expected. I see its gotten >> better in some areas but not in others. > > Please provide samples for which AVDISCARD_NONKEY does > not work correctly (but remember that there are valid > H.264 streams for which it correctly discards all frames). > > Carl Eugen All of the theora files I have discard all frames when using AVDISCARD_NONKEY. But these work fine when using AV_PKT_FLAG_KEY technique for keyframe display. Heres a sample: http://sms.pangolin.com/temp/BigBuckBunny.ogv If you want to open a ticket on it, CC me and I will add other failing samples when I get around to testing it. Keep in mind that I don't have much interest in AVDISCARD_NONKEY but others will, and will test all the files I have in that regard soon. From donmoir at comcast.net Wed Dec 4 13:35:04 2013 From: donmoir at comcast.net (Don Moir) Date: Wed, 4 Dec 2013 07:35:04 -0500 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP> <7AD1227005F1464F9904E75CA408B271@MANLAP> Message-ID: <1C5D27EA138E4B3B8C7AF454AE775821@MANLAP> > ----- Original Message ----- > From: "Carl Eugen Hoyos" > To: > Sent: Wednesday, December 11, 2013 6:16 AM > Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > > >> Don Moir writes: >> >>> I suppose my only initial expectation long ago was that >>> AVDISCARD_NONKEY worked as expected. I see its gotten >>> better in some areas but not in others. >> >> Please provide samples for which AVDISCARD_NONKEY does >> not work correctly (but remember that there are valid >> H.264 streams for which it correctly discards all frames). >> >> Carl Eugen > > All of the theora files I have discard all frames when using AVDISCARD_NONKEY. But these work fine when using AV_PKT_FLAG_KEY > technique for keyframe display. > > Heres a sample: > > http://sms.pangolin.com/temp/BigBuckBunny.ogv > > If you want to open a ticket on it, CC me and I will add other failing samples when I get around to testing it. Keep in mind that > I don't have much interest in AVDISCARD_NONKEY but others will, and will test all the files I have in that regard soon. This sample CODEC_ID_VP6F seems to completely ignore AVDISCARD_NONKEY and all frames are delivered. Again works fine with AV_PKT_FLAG_KEY. http://sms.pangolin.com/temp/20051210-w50s.flv This sample CODEC_ID_INDEO5 seems to ignore AVDISCARD_NONKEY as well. Works fine with AV_PKT_FLAG_KEY. http://sms.pangolin.com/temp/toonumentary-skieth.avi From yamusanivinay at gmail.com Thu Dec 12 07:26:54 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Thu, 12 Dec 2013 11:56:54 +0530 Subject: [Libav-user] Song Duration In-Reply-To: References: Message-ID: AVFormatContext fmt_ctx; fmt_ctx->duration ...the duration what i got from my java application and from ffmpeg is totally different On Wed, Dec 11, 2013 at 5:36 PM, Andrey Utkin < andrey.krieger.utkin at gmail.com> wrote: > 2013/12/11 Yamusani Vinay : > > Hi All, > > > > How to get duration of song in milliseconds.Is there any method > available to > > get meta data of song. > > AFAIR AVFormatContext.duration. > > -- > Andrey Utkin > _______________________________________________ > 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 Dec 12 08:46:47 2013 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Thu, 12 Dec 2013 08:46:47 +0100 Subject: [Libav-user] Song Duration In-Reply-To: References: Message-ID: On Thu, Dec 12, 2013 at 7:26 AM, Yamusani Vinay wrote: > AVFormatContext fmt_ctx; > > fmt_ctx->duration ...the duration what i got from my java application and > from ffmpeg is totally different if you suspect the duration is wrong, try to reproduce with ffmpeg or ffprobe and file a bug report with command line and sample. It can be either a bug or a known inaccuracy (i.e. in some cases ffmpeg only estimates the duration from the bitrate and may be far off). From yamusanivinay at gmail.com Thu Dec 12 12:21:02 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Thu, 12 Dec 2013 16:51:02 +0530 Subject: [Libav-user] Serious Issue Message-ID: Hi All, I am using ffmpeg..in my android application..The main problem what I am facing is if I navigate to another application or if do another activity..the song breaks means i will get some shutters and pops in the song.So Please let me know how to resolve this issue.. I am facing this issue when I am applying filters ln my code..If I do not apply any filters and play normally it is working fine..Even I checked my code inside a thread still I am facing problem. So please resolve this issue.. Thanks & Regards, Bitfield. -------------- next part -------------- An HTML attachment was scrubbed... URL: From koby at zemingo.com Thu Dec 12 15:38:34 2013 From: koby at zemingo.com (Koby Maman) Date: Thu, 12 Dec 2013 16:38:34 +0200 Subject: [Libav-user] Playback operations on RTSP stream Message-ID: Hi I am using FFMPEG to play a video file over RTSP. I am wondering If I can use ffmpeg for playback operation. I know I have av_read_play and av_read_pause for play/pause I also have av_seek_frame which I guess is for seeking Is there something I can use to control playback speed? forward and rewind? -- *Koby Maman* VP R&D Zemingo Ltd. (+972) 54.5678.379 www.zemingo.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From peter.wiersema at nl.thalesgroup.com Fri Dec 13 15:32:25 2013 From: peter.wiersema at nl.thalesgroup.com (WIERSEMA Peter) Date: Fri, 13 Dec 2013 14:32:25 +0000 Subject: [Libav-user] True zero latency H264 encoding and decoding Message-ID: <2BC3436A3B0DC14CB303F7A2EE8D80FE683BE2E6@spvw1971.ONE-05.GRP> Hi, I'm trying to create an application where the video of a camera is encoded and transported to a client via a LAN (UDP), with as less latency as possible. I use the FFMpeg API on both the server and client side. The source has a rate of 50 Hz. I've opted for the following: * encoder: libx264 (tune zerolatency, preset ultrafast, sliced threads; about 4 threads seems optimal) * protocol: UDP (either uni-cast or muli-cast) * format/muxer: mpegts The ultimate goal is to have the picture on the screen of the client in only a few tens of milliseconds (lets say 100ms max). I've read a lot of guides resulting in that there is no added latency on the server side, i.e. an encoded H264 frame gets transported immediately; Great! On the client side, however, one frame is always held back. It seems that the mpegts demuxer is the cause. I'm using av_read_frame() to read a complete frame. Consequently, the mpegts demuxer needs to be able to find the end of a frame in the bitstream. From looking at the code, i think the mpegts demuxer returns a complete frame, only when the beginning of the next frame is received, hence the extra latency of one frame. Is there a way the eliminate the extra delay of one frame when demuxing? Possibly using a different muxer/demuxer? Any other advice? I'm using the latest FFmpeg 2.2.1 and libx264 20131210-2245-stable. Peter This mail contains only Unclassified information. ------------------------------------------------------------------------------------------------------------ Disclaimer: If you are not the intended recipient of this email, please notify the sender and delete it. Any unauthorized copying, disclosure or distribution of this email or its attachment(s) is forbidden. Thales Nederland BV will not accept liability for any damage caused by this email or its attachment(s). Thales Nederland BV is seated in Hengelo and is registered at the Chamber of Commerce under number 06061578. ------------------------------------------------------------------------------------------------------------ From alexcohn at netvision.net.il Fri Dec 13 21:14:35 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 13 Dec 2013 22:14:35 +0200 Subject: [Libav-user] Serious Issue In-Reply-To: References: Message-ID: On Thu, Dec 12, 2013 at 1:21 PM, Yamusani Vinay wrote: > Hi All, > > I am using ffmpeg..in my android application..The main problem what I am > facing is if I navigate to another application or if do another > activity..the song breaks means i will get some shutters and pops in the > song.So Please let me know how to resolve this issue.. > > I am facing this issue when I am applying filters ln my code..If I do not > apply any filters and play normally it is working fine..Even I checked my > code inside a thread still I am facing problem. > > So please resolve this issue.. > > Thanks & Regards, > Bitfield. There is very little that ffmpeg libraries can do to help you here. Probably, filters require more CPU than normal playback. You can keep the thread priority high, even if the app that hosts it goes to background, but that's an entirely Android-specific issue. BR, Alex Cohn From alexcohn at netvision.net.il Fri Dec 13 21:34:32 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 13 Dec 2013 22:34:32 +0200 Subject: [Libav-user] Licensing question In-Reply-To: <253315DA14D1B845989E427C7EA0BFE228481804@SRV001.misoft-systems.net> References: <253315DA14D1B845989E427C7EA0BFE2284807AD@SRV001.misoft-systems.net> <253315DA14D1B845989E427C7EA0BFE228481804@SRV001.misoft-systems.net> Message-ID: On Wed, Dec 11, 2013 at 6:08 PM, Ioan Stan wrote: > Let?s suppose that I own a library named "a.dll" that is linked statically or dynamically with FFmpeg library. Another library owned by me and named "b.dll" is linked dynamically with "a.dll". A plug-in based application owned by me and named "App.exe" uses "b.dll" as a plug-in (loads the plug-in at runtime). > In this scenario does "a.dll", "b.dll" or "App.exe" become under LGPLv2.1 or later ? Does the source code corresponding to "a.dll", "b.dll" and "App.exe" become under LGPLv2.1 or later ? > In case the answer is yes, which of these libraries/executable becomes under LGPLv2.1 or later ? Which part of the source code owned by me and used to compile above libraries become under LGPLv2.1 or later? By "becomes under LGPL v2.1 or later" you probably mean "I am obliged to publish full source code of". Otherwise your question makes little sense. Actually, whatever you choose to do in relation to FFmpeg libraries, inevitably falls "under LGPL v2.1 or above", only in some cases there is nothing you should do or worry about. If your "a.dll" is linked dynamically with FFmpeg libraries, you only have to publish the exact source and instructions of how you built these FFmpeg libraries. You cannot simply point to the FFmpeg website. If "a.dll" is linked statically with FFmpeg libraries, you probably should publish the source code and instructions of how you build this dll. IANAL, and there are some special situations, but this is the general direction of LGPL. SIncerely, Alex Cohn From alexcohn at netvision.net.il Fri Dec 13 22:05:16 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 13 Dec 2013 23:05:16 +0200 Subject: [Libav-user] LGPL and Android's apk file format In-Reply-To: <52A548F5.2090606@uei.co.jp> References: <52A548F5.2090606@uei.co.jp> Message-ID: On Mon, Dec 9, 2013 at 6:37 AM, Kevin Kratzer wrote: > Is it allowed to distribute an application which integrates the libav > library and my library together in an archive file where it is possible to > replace the libav libraries with a modified version? IMHO, the life would be much easier if there were an official distribution of FFmpeg libraries for Android, like there is for some (other) flavours of Linux, or at least a de facto standard distribution, similar to Zeranoe builds for Windows. I believe that until then, too many electrons and developer effort are wasted for maintenance of these libraries by each individual Android developer, and many people are stuck with obsolete, buggy versions of FFmpeg libraries on their devices, sometimes posing security risks. It's nice that, thanks to LGPL, any person may reverse engineer the application and replace the libraries if they wish. But 99% or more of the users are not developers, and don't have the skills to undertake such job, or even to understand that there may be a good reason to do so (e.g. a buffer overflow bug found in the protocol that they actually use in an app they installed on their device). Note that quite often Android apps are abandoned by their developers, but still remain installed on end-user devices or even available for download from the official PlayStore. Luckily, Android system allows independent distribution of libraries, although this is less obvious than for (other) Linux distros. Unfortunately, I don't see significant interest among ffmpeg developers (see e.g. http://ffmpeg.org/pipermail/ffmpeg-devel/2013-November/151352.html). Sincerely, Alex Cohn From cehoyos at ag.or.at Sat Dec 14 01:30:46 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 14 Dec 2013 00:30:46 +0000 (UTC) Subject: [Libav-user] Licensing question References: <253315DA14D1B845989E427C7EA0BFE2284807AD@SRV001.misoft-systems.net> <253315DA14D1B845989E427C7EA0BFE228481804@SRV001.misoft-systems.net> Message-ID: Ioan Stan writes: > 1. Let?s suppose that I own a library named "a.dll" I already fail to parse the word "own" in this sentence;-( Let me try it differently: If you distribute binaries that contain code from the FFmpeg project, you have to tell your users that they install FFmpeg and you have to tell them about their rights (you have to show them the LGPL). You have to offer them the exact source code that you used to compile, that means that the users have to be able to download the source code from your server (not from the FFmpeg server). You should add some information on how you compiled the source code. Note that all the above is not related to static or dynamic linking. The idea is now that if your users wish to change something about the FFmpeg library that you installed on their computer, it has to be possible: That means that either - if you provided FFmpeg as a dynamic library - they must be able to make modifications to the source code you provided, and replace the binary that you installed with one that they compiled. If you used static linking, you have to provide object files (of your code, not the FFmpeg code) that allow them to relink. For technical reasons, the above requires you not to forbid your users to reverse engineer your software (it is needed for debugging if the above process fails). Now, if you ask yourself "is it possible that my users update FFmpeg without additional help" and the answer is yes, then I suspect you comply with all requirements. If you asked to find a way around it, you are probably wrong here. We made a page to simplify the process, if you consider it unclear, please tell us: http://ffmpeg.org/legal.html Please remember that I am not a (and not your) lawyer! Please do not top-post here, it is considered rude. Hope that helps, Carl Eugen From cehoyos at ag.or.at Sat Dec 14 01:36:41 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 14 Dec 2013 00:36:41 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?packet_flag_AV=5FPKT=5FFLAG=5FKEY?= References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP> <7AD1227005F1464F9904E75CA408B271@MANLAP> Message-ID: Don Moir writes: > > Please provide samples for which AVDISCARD_NONKEY does > > not work correctly > Heres a sample: > > http://sms.pangolin.com/temp/BigBuckBunny.ogv Works fine here. Carl Eugen From cehoyos at ag.or.at Sat Dec 14 01:54:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 14 Dec 2013 00:54:05 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?packet_flag_AV=5FPKT=5FFLAG=5FKEY?= References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP> <7AD1227005F1464F9904E75CA408B271@MANLAP> <1C5D27EA138E4B3B8C7AF454AE775821@MANLAP> Message-ID: Don Moir writes: > >> Please provide samples for which AVDISCARD_NONKEY does > >> not work correctly (but remember that there are valid > >> H.264 streams for which it correctly discards all frames). > This sample CODEC_ID_VP6F seems to completely ignore AVDISCARD_NONKEY > This sample CODEC_ID_INDEO5 seems to ignore AVDISCARD_NONKEY as well. Sorry, I missed that the discard feature is not generic but implemented for some codecs (like theora) but not others like vp5/vp6 and indeo4/indeo5. Carl Eugen From cehoyos at ag.or.at Sat Dec 14 02:00:14 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 14 Dec 2013 01:00:14 +0000 (UTC) Subject: [Libav-user] LGPL and Android's apk file format References: <52A548F5.2090606@uei.co.jp> Message-ID: Alex Cohn writes: > IMHO, the life would be much easier if there were an official > distribution of FFmpeg libraries for Android, like there is for some > (other) flavours of Linux, or at least a de facto standard > distribution, similar to Zeranoe builds for Windows. Please be assured that there is neither an "official distribution of FFmpeg" for Linux nor for Windows - assuming you mean a binary distribution, there is of course the (same) official source code. (And be it only because FFmpeg does not ship "products".) > I believe that until then, too many electrons and developer effort are > wasted for maintenance of these libraries by each individual Android > developer, and many people are stuck with obsolete, buggy versions of > FFmpeg libraries on their devices, sometimes posing security risks. I probably misunderstand: Is there a (specific) problem using FFmpeg on Android devices? I don't remember an Android- specific but report atm but I thought we had fate-tests. > Unfortunately, I don't see significant interest among ffmpeg > developers (see e.g. > http://ffmpeg.org/pipermail/ffmpeg-devel/2013-November/151352.html) I honestly wonder what you mean... Be assured that if you like to help (for example with a fate client), we would very much welcome this! Carl Eugen From donmoir at comcast.net Sat Dec 14 02:30:17 2013 From: donmoir at comcast.net (Don Moir) Date: Sat, 14 Dec 2013 01:30:17 -0000 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP><7AD1227005F1464F9904E75CA408B271@MANLAP> Message-ID: ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Friday, December 13, 2013 7:36 PM Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > Don Moir writes: > >> > Please provide samples for which AVDISCARD_NONKEY does >> > not work correctly > >> Heres a sample: >> >> http://sms.pangolin.com/temp/BigBuckBunny.ogv > > Works fine here. > > Carl Eugen What did you use to test it ? I don't see AVDISCARD_NONKEY used anywhere in ffplay.c or ffmpeg.c For me, I don't ever get a finished frame from avcodec_decode_video2 when using AVDISCARD_NONKEY for theora. From donmoir at comcast.net Sat Dec 14 02:35:35 2013 From: donmoir at comcast.net (Don Moir) Date: Sat, 14 Dec 2013 01:35:35 -0000 Subject: [Libav-user] packet flag AV_PKT_FLAG_KEY References: <21764B0E12BE4D57951CEF7EEC9056C9@MANLAP><2547CD7D78C045C89CB9ED1D111F649C@MANLAP><7AD1227005F1464F9904E75CA408B271@MANLAP><1C5D27EA138E4B3B8C7AF454AE775821@MANLAP> Message-ID: <5A8CA30E9AD6456B89B2EF955A223371@MANLAP> ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Friday, December 13, 2013 7:54 PM Subject: Re: [Libav-user] packet flag AV_PKT_FLAG_KEY > Don Moir writes: > >> >> Please provide samples for which AVDISCARD_NONKEY does >> >> not work correctly (but remember that there are valid >> >> H.264 streams for which it correctly discards all frames). > >> This sample CODEC_ID_VP6F seems to completely ignore AVDISCARD_NONKEY >> This sample CODEC_ID_INDEO5 seems to ignore AVDISCARD_NONKEY as well. > > Sorry, I missed that the discard feature is not generic but > implemented for some codecs (like theora) but not others > like vp5/vp6 and indeo4/indeo5. Is it flagged anywhere when it is not available for a codec? From vahid at kowsari.com Sat Dec 14 19:56:28 2013 From: vahid at kowsari.com (Vahid Kowsari) Date: Sat, 14 Dec 2013 10:56:28 -0800 Subject: [Libav-user] AVFrame Queue and multithreading Message-ID: <69BEFBC6-FBCF-47EB-9DAF-6925F5A09179@kowsari.com> Hi I am using ffmpeg 1.2 libraries to create an application that reads and decodes frames for processing. It is handling MPEG2/H264 from UDP or file. I have been using a multi-threaded application where the frames are read from one thread, then the AVFrames are put in a queue (I memcopy the AVFrame* and not the frame data). In another thread I loop and remove AVFrames * from the queue and run the processing that I have to do. This seems to work most of the time but I think sometimes the frames maybe garbled up. My question is what is the proper way to create an AVFrame queue? What I would rather not do is do a memcopy of the frame (actual image) data. It seems to me that the pointers to the data of the frame seem to be re-cycling every 10 frames. FFMPEG is internally re-using the same buffers. Do I have to use reference counting? or write my own AVFrame allocation/freeing routines? Any help is appreciated. Thanks From ramitbhalla at gmail.com Sun Dec 15 07:23:21 2013 From: ramitbhalla at gmail.com (Ramit Bhalla) Date: Sun, 15 Dec 2013 01:23:21 -0500 Subject: [Libav-user] ffmpeg not able to build latest git commit Message-ID: Anyone else facing this problem? libavcodec/libvpxenc.c:123:6: error: 'VP9E_SET_TILE_COLUMNS' undeclared here (not in a function) [VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS", ^ libavcodec/libvpxenc.c:123:5: error: array index in initializer not of integer type [VP9E_SET_TILE_COLUMNS] = "VP9E_SET_TILE_COLUMNS", ^ libavcodec/libvpxenc.c:123:5: error: (near initialization for 'ctlidstr') libavcodec/libvpxenc.c:124:6: error: 'VP9E_SET_TILE_ROWS' undeclared here (not in a function) [VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS", ^ libavcodec/libvpxenc.c:124:5: error: array index in initializer not of integer type [VP9E_SET_TILE_ROWS] = "VP9E_SET_TILE_ROWS", ^ libavcodec/libvpxenc.c:124:5: error: (near initialization for 'ctlidstr') libavcodec/libvpxenc.c:125:6: error: 'VP9E_SET_FRAME_PARALLEL_DECODING' undeclared here (not in a function) [VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING", ^ libavcodec/libvpxenc.c:125:5: error: array index in initializer not of integer type [VP9E_SET_FRAME_PARALLEL_DECODING] = "VP9E_SET_FRAME_PARALLEL_DECODING", ^ libavcodec/libvpxenc.c:125:5: error: (near initialization for 'ctlidstr') libavcodec/libvpxenc.c: In function 'dump_enc_cfg': This started today while trying to build the latest ffmpeg. Any idea why this is happening? I'm using the following configure line: ./configure --arch=x86 --target-os=mingw32 --cross-prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filter=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --extra-cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-libvpx --enable-libilbc --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libmodplug --extra-libs=-lstdc++ --enable-libzvbi --enable-libcaca --prefix=/home/mcebuddy/Software/ffmpeg/sandbox/mingw-w64-i686/i686-w64-mingw32 --enable-static --disable-shared --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --enable-libbluray --extra-cflags= --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect -------------- next part -------------- An HTML attachment was scrubbed... URL: From hungnt at hiworld.com.vn Sat Dec 14 07:30:50 2013 From: hungnt at hiworld.com.vn (khoahung) Date: Fri, 13 Dec 2013 22:30:50 -0800 (PST) Subject: [Libav-user] please support about IO-Context reading customer Raw buffer data Message-ID: <1387002634849-4659026.post@n4.nabble.com> why i'm can't call avformat_open_input(&pFormatCtx,"", NULL, NULL).my program alway crash when call this function for Open Custom buff.my Buffer is Raw Data video input here -(id)initWithBuffer:(void*)buff size:(int)buff_size{ AVCodec *pCodec; avcodec_register_all(); // Register all formats and codecs av_register_all(); // av_init_packet(&packet); if(avformat_network_init()!=0){ goto initError; // Couldn't init new work } uint8_t* pBuffer=av_malloc(buff_size*sizeof(uint8_t)); pFormatCtx = avformat_alloc_context(); AVIOContext* pIOCtx = avio_alloc_context(pBuffer,buff_size + FF_INPUT_BUFFER_PADDING_SIZE,0,buff,&read_packet, NULL, NULL); pIOCtx->seekable = 0; pFormatCtx->iformat=av_find_input_format("h264"); pFormatCtx->flags = AVFMT_FLAG_CUSTOM_IO; pFormatCtx->iformat->flags=AVFMT_NOFILE; pFormatCtx->pb=pIOCtx; /** * Return the LIBAVFORMAT_VERSION_INT constant. */ printf("======>FFmpeg Version:%d \n ", avformat_version()); /** * Return the libavformat build-time configuration. */ printf("========>FFmpeg libavformat Configuration:%s \n ",avformat_configuration()); /** * Return the libavformat license. */ printf("=========>FFmpeg libavformat license:%s \n",avformat_license()); // Retrieve stream information if(avformat_open_input(&pFormatCtx,"", NULL, NULL)<0) goto initError; if(avformat_find_stream_info(pFormatCtx,NULL)<0){ goto initError; // Couldn't find stream information } streamNo=-1; // Find the first video stream if ((streamNo = av_find_best_stream(pFormatCtx,AVMEDIA_TYPE_VIDEO, -1, -1, &pCodec, 0)) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input file %d\n",streamNo); goto initError; } // Get a pointer to the codec context for the video stream pCodecCtx=pFormatCtx->streams[streamNo]->codec; // Find the decoder for the video stream pCodec=avcodec_find_decoder(pCodecCtx->codec_id); // pCodec=avcodec_find_decoder(AV_CODEC_ID_FLV1); if(pCodec==NULL) goto initError; // Codec not found // Open codec if(avcodec_open2(pCodecCtx, pCodec, NULL)<0) goto initError; // Could not open codec // Allocate video frame pFrame = avcodec_alloc_frame(); if(pFrame==NULL) goto initError; // Not Found Frame uint8_t *buffer; int numBytes; // Determine required buffer size and allocate buffer //numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, // pCodecCtx->height); numBytes=avpicture_get_size(PIX_FMT_YUYV422, pCodecCtx->width, pCodecCtx->height); buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); outputWidth = pCodecCtx->width; outputHeight = pCodecCtx->height; avformat_free_context(pFormatCtx); return self; initError: av_log(NULL, AV_LOG_ERROR,"====>Error %d \n", pFormatCtx->pb->error); NSLog(@"initError in VideoFrameExtractor"); avformat_free_context(pFormatCtx); return nil; } -- View this message in context: http://libav-users.943685.n4.nabble.com/please-support-about-IO-Context-reading-customer-Raw-buffer-data-tp4659026.html Sent from the libav-users mailing list archive at Nabble.com. From fkwatson at aol.com Sun Dec 15 19:59:21 2013 From: fkwatson at aol.com (fkwatson at aol.com) Date: Sun, 15 Dec 2013 13:59:21 -0500 (EST) Subject: [Libav-user] please support about IO-Context reading customer Raw buffer data In-Reply-To: <1387002634849-4659026.post@n4.nabble.com> References: <1387002634849-4659026.post@n4.nabble.com> Message-ID: <8D0C7DEE5FA84CB-A18-11D1F@webmail-d283.sysops.aol.com> -----Original Message----- From: khoahung To: libav-user Sent: Sun, Dec 15, 2013 1:18 pm Subject: [Libav-user] please support about IO-Context reading customer Raw buffer data why i'm can't call avformat_open_input(&pFormatCtx,"", NULL, NULL).my program alway crash when call this function for Open Custom buff.my Buffer is Raw Data video input here -(id)initWithBuffer:(void*)buff size:(int)buff_size{ AVCodec *pCodec; avcodec_register_all(); // Register all formats and codecs av_register_all(); // av_init_packet(&packet); if(avformat_network_init()!=0){ goto initError; // Couldn't init new work } uint8_t* pBuffer=av_malloc(buff_size*sizeof(uint8_t)); pFormatCtx = avformat_alloc_context(); AVIOContext* pIOCtx = avio_alloc_context(pBuffer,buff_size + FF_INPUT_BUFFER_PADDING_SIZE,0,buff,&read_packet, NULL, NULL); pIOCtx->seekable = 0; pFormatCtx->iformat=av_find_input_format("h264"); pFormatCtx->flags = AVFMT_FLAG_CUSTOM_IO; pFormatCtx->iformat->flags=AVFMT_NOFILE; pFormatCtx->pb=pIOCtx; /** * Return the LIBAVFORMAT_VERSION_INT constant. */ printf("======>FFmpeg Version:%d \n ", avformat_version()); /** * Return the libavformat build-time configuration. */ printf("========>FFmpeg libavformat Configuration:%s \n ",avformat_configuration()); /** * Return the libavformat license. */ printf("=========>FFmpeg libavformat license:%s \n",avformat_license()); // Retrieve stream information if(avformat_open_input(&pFormatCtx,"", NULL, NULL)<0) goto initError; if(avformat_find_stream_info(pFormatCtx,NULL)<0){ goto initError; // Couldn't find stream information } streamNo=-1; // Find the first video stream if ((streamNo = av_find_best_stream(pFormatCtx,AVMEDIA_TYPE_VIDEO, -1, -1, &pCodec, 0)) < 0) { av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input file %d\n",streamNo); goto initError; } // Get a pointer to the codec context for the video stream pCodecCtx=pFormatCtx->streams[streamNo]->codec; // Find the decoder for the video stream pCodec=avcodec_find_decoder(pCodecCtx->codec_id); // pCodec=avcodec_find_decoder(AV_CODEC_ID_FLV1); if(pCodec==NULL) goto initError; // Codec not found // Open codec if(avcodec_open2(pCodecCtx, pCodec, NULL)<0) goto initError; // Could not open codec // Allocate video frame pFrame = avcodec_alloc_frame(); if(pFrame==NULL) goto initError; // Not Found Frame uint8_t *buffer; int numBytes; // Determine required buffer size and allocate buffer //numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width, // pCodecCtx->height); numBytes=avpicture_get_size(PIX_FMT_YUYV422, pCodecCtx->width, pCodecCtx->height); buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); outputWidth = pCodecCtx->width; outputHeight = pCodecCtx->height; avformat_free_context(pFormatCtx); return self; initError: av_log(NULL, AV_LOG_ERROR,"====>Error %d \n", pFormatCtx->pb->error); NSLog(@"initError in VideoFrameExtractor"); avformat_free_context(pFormatCtx); return nil; } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Do not use this: pFormatCtx->iformat->flags=AVFMT_NOFILE; with custom I/0. -Felix -- View this message in context: http://libav-users.943685.n4.nabble.com/please-support-about-IO-Context-reading-customer-Raw-buffer-data-tp4659026.html Sent from the libav-users mailing list archive at Nabble.com. _______________________________________________ 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 Mon Dec 16 10:39:18 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 16 Dec 2013 09:39:18 +0000 (UTC) Subject: [Libav-user] ffmpeg not able to build latest git commit References: Message-ID: Ramit Bhalla writes: > libavcodec/libvpxenc.c:123:6: error: 'VP9E_SET_TILE_COLUMNS' > undeclared here (not in a function) This should be "fixed", you have to update libvpx. Thank you for the report, Carl Eugen From kevin.c.dixon at gmail.com Mon Dec 16 20:54:26 2013 From: kevin.c.dixon at gmail.com (Kevin Dixon) Date: Mon, 16 Dec 2013 11:54:26 -0800 Subject: [Libav-user] Serious Issue In-Reply-To: References: Message-ID: On Fri, Dec 13, 2013 at 12:14 PM, Alex Cohn wrote: > On Thu, Dec 12, 2013 at 1:21 PM, Yamusani Vinay wrote: >> Hi All, >> >> I am using ffmpeg..in my android application..The main problem what I am >> facing is if I navigate to another application or if do another >> activity..the song breaks means i will get some shutters and pops in the >> song.So Please let me know how to resolve this issue.. >> >> I am facing this issue when I am applying filters ln my code..If I do not >> apply any filters and play normally it is working fine..Even I checked my >> code inside a thread still I am facing problem. >> >> So please resolve this issue.. >> >> Thanks & Regards, >> Bitfield. > > There is very little that ffmpeg libraries can do to help you here. > Probably, filters require more CPU than normal playback. You can keep > the thread priority high, even if the app that hosts it goes to > background, but that's an entirely Android-specific issue. > > BR, > Alex Cohn > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user Hi Yamusani, You should consider putting your audio processing in an Android Service http://developer.android.com/reference/android/app/Service.html You can even run the Service as a separate process if that is not good enough for you, by assigning the android:process="..." attribute in the AndroidManifest.xml for your element. I suspect that when your activity is backgrounded, the context switch is very expensive. You might see messages in logcat from Choreographer process complaining about dropping frames Kevin From kevin.kratzer at uei.co.jp Tue Dec 17 02:19:18 2013 From: kevin.kratzer at uei.co.jp (Kevin Kratzer) Date: Tue, 17 Dec 2013 10:19:18 +0900 Subject: [Libav-user] LGPL and Android's apk file format In-Reply-To: References: <52A548F5.2090606@uei.co.jp> Message-ID: <52AFA696.3060400@uei.co.jp> Thank you very much for your point of view on that issue Carl Eugen. Kevin Am 2013/12/09 19:14, schrieb Carl Eugen Hoyos: > Kevin Kratzer writes: > >> Is it allowed to distribute an application which >> integrates the libav library and my library together >> in an archive file where it is possible to replace >> the libav libraries with a modified version? > IANAL. > > Are your users able to replace the FFmpeg libraries > that you ship with (a different) one that they > compiled themselves? If yes, I don't think it matters > if you call it "static linking" or "dynamic linking" > or if it isn't 100% clear. > Or in other words: It definitely makes much more > sense to try to follow the spirit of the LGPL / any > contract than to try to proof that every word still > fits into current (changed) technology. > > Please do not forget to provide the whole, unchanged > FFmpeg source code (do not just link to ffmpeg.org) > that you used together with some notes on how you > compiled FFmpeg. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From yamusanivinay at gmail.com Tue Dec 17 07:37:29 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Tue, 17 Dec 2013 12:07:29 +0530 Subject: [Libav-user] Serious Issue In-Reply-To: References: Message-ID: On Tue, Dec 17, 2013 at 1:24 AM, Kevin Dixon wrote: > On Fri, Dec 13, 2013 at 12:14 PM, Alex Cohn > wrote: > > On Thu, Dec 12, 2013 at 1:21 PM, Yamusani Vinay > wrote: > >> Hi All, > >> > >> I am using ffmpeg..in my android application..The main problem what > I am > >> facing is if I navigate to another application or if do another > >> activity..the song breaks means i will get some shutters and pops in the > >> song.So Please let me know how to resolve this issue.. > >> > >> I am facing this issue when I am applying filters ln my code..If I do > not > >> apply any filters and play normally it is working fine..Even I checked > my > >> code inside a thread still I am facing problem. > >> > >> So please resolve this issue.. > >> > >> Thanks & Regards, > >> Bitfield. > > > > There is very little that ffmpeg libraries can do to help you here. > > Probably, filters require more CPU than normal playback. You can keep > > the thread priority high, even if the app that hosts it goes to > > background, but that's an entirely Android-specific issue. > > > > BR, > > Alex Cohn > > _______________________________________________ > > Libav-user mailing list > > Libav-user at ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/libav-user > > > Hi Yamusani, > > You should consider putting your audio processing in an Android Service > http://developer.android.com/reference/android/app/Service.html > You can even run the Service as a separate process if that is not good > enough for you, by assigning the > android:process="..." attribute in the AndroidManifest.xml for your > element. > > I suspect that when your activity is backgrounded, the context switch > is very expensive. You might see messages in logcat from Choreographer > process complaining about dropping frames > > Kevin > _______________________________________________ > 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 yamusanivinay at gmail.com Tue Dec 17 07:51:23 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Tue, 17 Dec 2013 12:21:23 +0530 Subject: [Libav-user] Serious Issue In-Reply-To: References: Message-ID: Hi Kevin Dixon, Thanks for your reply, I did the same thing what you mentioned above..Still I am facing problem.If I play normally without applying any filters it is working properly.But If I apply filters and play the song.Then I am facing problem..which was mentioned above. Thanks & Regards, Bitfield. On Tue, Dec 17, 2013 at 12:07 PM, Yamusani Vinay wrote: > > > > On Tue, Dec 17, 2013 at 1:24 AM, Kevin Dixon wrote: > >> On Fri, Dec 13, 2013 at 12:14 PM, Alex Cohn >> wrote: >> > On Thu, Dec 12, 2013 at 1:21 PM, Yamusani Vinay < >> yamusanivinay at gmail.com> wrote: >> >> Hi All, >> >> >> >> I am using ffmpeg..in my android application..The main problem >> what I am >> >> facing is if I navigate to another application or if do another >> >> activity..the song breaks means i will get some shutters and pops in >> the >> >> song.So Please let me know how to resolve this issue.. >> >> >> >> I am facing this issue when I am applying filters ln my code..If I >> do not >> >> apply any filters and play normally it is working fine..Even I checked >> my >> >> code inside a thread still I am facing problem. >> >> >> >> So please resolve this issue.. >> >> >> >> Thanks & Regards, >> >> Bitfield. >> > >> > There is very little that ffmpeg libraries can do to help you here. >> > Probably, filters require more CPU than normal playback. You can keep >> > the thread priority high, even if the app that hosts it goes to >> > background, but that's an entirely Android-specific issue. >> > >> > BR, >> > Alex Cohn >> > _______________________________________________ >> > Libav-user mailing list >> > Libav-user at ffmpeg.org >> > http://ffmpeg.org/mailman/listinfo/libav-user >> >> >> Hi Yamusani, >> >> You should consider putting your audio processing in an Android Service >> http://developer.android.com/reference/android/app/Service.html >> You can even run the Service as a separate process if that is not good >> enough for you, by assigning the >> android:process="..." attribute in the AndroidManifest.xml for your >> element. >> >> I suspect that when your activity is backgrounded, the context switch >> is very expensive. You might see messages in logcat from Choreographer >> process complaining about dropping frames >> >> Kevin >> _______________________________________________ >> 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 vinvinod at gmail.com Thu Dec 19 09:58:29 2013 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Thu, 19 Dec 2013 14:28:29 +0530 Subject: [Libav-user] Settings for vorbis audio Message-ID: Hi, I have written a c++ code for audio transcoding.. From any given format to any output audio format.. I have trouble creating a ".mka" file with vorbis codec. In my code after adding a stream , I am setting the following fields for codec context. (AVCodecContext * enc_ctx) enc_ctx -> codec_id = codec_id; enc_ctx -> codec_type = AVMEDIA_TYPE_AUDIO; enc_ctx -> bit_rate = 128000; enc_ctx -> sample_rate = 22050; enc_ctx -> sample_fmt = AV_SAMPLE_FMT_FLTP; enc_ctx -> channels = 1; enc_ctx -> channel_layout = av_get_default_channel_layout(enc_ctx -> channels); enc_ctx -> global_quality = 6; enc_ctx -> rc_min_rate = 64000; enc_ctx -> rc_max_rate = 128000 * 1.5; However when I call avcodec_open2(), it gives the following error. [libvorbis @ 0x14c7100] encoder setup failed This code is working fine for .wav .aac and .ogg(with FLAC) formats. Can someone tell what more I have to do for vorbis? The full code is at http://stackoverflow.com/questions/20439640/ffmpeg-audio-transcoding-using-libav-libraries. -- Vinod -------------- next part -------------- An HTML attachment was scrubbed... URL: From vinvinod at gmail.com Fri Dec 20 05:54:24 2013 From: vinvinod at gmail.com (=?UTF-8?B?4LK14LK/4LKo4LOL4LKm4LONIFZpbm9kIEggSQ==?=) Date: Fri, 20 Dec 2013 10:24:24 +0530 Subject: [Libav-user] Settings for vorbis audio In-Reply-To: References: Message-ID: I solved the above problem. The values of sample rate and bit rate had to be set properly. On Thu, Dec 19, 2013 at 2:28 PM, ?????? Vinod H I wrote: > Hi, > I have written a c++ code for audio transcoding.. From any given format to > any output audio format.. > I have trouble creating a ".mka" file with vorbis codec. > > In my code after adding a stream , I am setting the following fields for > codec context. (AVCodecContext * enc_ctx) > > enc_ctx -> codec_id = codec_id; > enc_ctx -> codec_type = AVMEDIA_TYPE_AUDIO; > enc_ctx -> bit_rate = 128000; > enc_ctx -> sample_rate = 22050; > enc_ctx -> sample_fmt = AV_SAMPLE_FMT_FLTP; > enc_ctx -> channels = 1; > enc_ctx -> channel_layout = > av_get_default_channel_layout(enc_ctx -> channels); > enc_ctx -> global_quality = 6; > enc_ctx -> rc_min_rate = 64000; > enc_ctx -> rc_max_rate = 128000 * 1.5; > > However when I call avcodec_open2(), it gives the following error. > > [libvorbis @ 0x14c7100] encoder setup failed > > This code is working fine for .wav .aac and .ogg(with FLAC) formats. > Can someone tell what more I have to do for vorbis? > > The full code is at > http://stackoverflow.com/questions/20439640/ffmpeg-audio-transcoding-using-libav-libraries. > > > > -- > Vinod > > -- Vinod H I -------------- next part -------------- An HTML attachment was scrubbed... URL: From leo.fernando34 at gmail.com Thu Dec 19 16:00:37 2013 From: leo.fernando34 at gmail.com (Leo Fernando) Date: Thu, 19 Dec 2013 07:00:37 -0800 (PST) Subject: [Libav-user] Understanding libav branch Message-ID: <1387465237484-4659037.post@n4.nabble.com> Hi, I'm a newbie here. I see libav has two branches, mainly 0.8.x and 9.x branch. Can someone tell me why two branches? Is one of them devlopment branch and other one is release branch? Thanks, Leo -- View this message in context: http://libav-users.943685.n4.nabble.com/Understanding-libav-branch-tp4659037.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Fri Dec 20 10:31:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 20 Dec 2013 09:31:05 +0000 (UTC) Subject: [Libav-user] Understanding libav branch References: <1387465237484-4659037.post@n4.nabble.com> Message-ID: Leo Fernando writes: > I see libav has two branches, mainly 0.8.x and 9.x avconv (which is a less confusing name) contains several hundred known user-reported bugs that are not reproducible with FFmpeg (some of them security- relevant), please understand that we cannot support it here, see http://ffmpeg.org/download.html for supported versions. http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html contains more information. http://en.wikipedia.org/wiki/Software_release_life_cycle contains some general information about releases but note that imo it does not cover open-source software releases well. FFmpeg releases are just snapshots for distributors, end users are strongly encouraged to use current git head. Carl Eugen From battistel at gmail.com Sun Dec 22 12:49:10 2013 From: battistel at gmail.com (Massimo Battistel) Date: Sun, 22 Dec 2013 12:49:10 +0100 Subject: [Libav-user] [Livav-user] Questions about reference counting and av_[interleaved_]write_frame Message-ID: Hello! Some questions: 1a. I would like to know where I can find documentation about ffmpeg reference counting. Is this the starting point or there are other resources? "http://www.ffmpeg.org/doxygen/2.0/group__lavu__buffer.html". 1b. Is this the official url for examples code? "http://www.ffmpeg.org/doxygen/2.0/examples.html" 2. I would like to know if the following code is safe if result==TRUE and r ==1. There are additional questions on the code comments. AVPacket pkt; ... pkt.buf = NULL; // no ref count. Does it matter? // pkt was properly initialized and data filed != null. ... BOOL result = (av_write_frame(oc, &pkt) == 0); if (result) { int r = av_write_frame(oc, NULL); // flush if (r == 1) { av_free_packet(&pkt); // now pkt can be safely reused? <====== } } 3. I would like to know if the following code is safe if result==TRUE. There are additional questions on the code comments. AVPacket pkt; ... // now pkt is ref counted and properly filled. ... BOOL result = (av_interleaved_write_frame(oc, &pkt) == 0); if (result) { // From doc: "...Libavformat takes ownership of this reference..." // so... // I dont need to free packet, muxer will do that at right time. Correct? // so now pkt can be safely reused? <====== } 4. From doc: "...If the packets are already correctly interleaved, the application should call av_write_frame() instead as it is slightly faster...". 4a. If av_interleaved_write_frame is fed with an already interleaved packet list, is this performance difference still notable? 4b. if av_interleaved_write_frame puts the packet in a private list, the function call should take less time compared to av_write_frame, correct? The muxer I'm using is ASF. thanks, MB -------------- next part -------------- An HTML attachment was scrubbed... URL: From ggarra13 at gmail.com Sun Dec 22 21:55:09 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Sun, 22 Dec 2013 17:55:09 -0300 Subject: [Libav-user] PNG in mp3's failing Message-ID: <52B751AD.1020900@gmail.com> Here's the log of some mp3's with embedded PNG files that are failing to display. I can upload the mp3 if someone points me where to ftp it to. ffplay version N-58229-g459c7cb Copyright (c) 2003-2013 the FFmpeg developers built on Nov 17 2013 11:30:41 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-shared libavutil 52. 53.100 / 52. 53.100 libavcodec 55. 43.100 / 55. 43.100 libavformat 55. 21.100 / 55. 21.100 libavdevice 55. 5.100 / 55. 5.100 libavfilter 3. 91.100 / 3. 91.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 17.104 / 0. 17.104 [png @ 0x7f58c00037c0] Missing png signature 0KB sq= 0B f=0/0 [mp3 @ 0x7f58c00008c0] decoding for stream 1 failed [mp3 @ 0x7f58c00008c0] Estimating duration from bitrate, this may be inaccurate [mp3 @ 0x7f58c00008c0] Could not find codec parameters for stream 1 (Video: png): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options Input #0, mp3, from '1-09 Caminar.mp3': Metadata: title : Caminar artist : Pez track : 9/15 TPA : 1/2 album : Para las almas sensibles genre : Rock encoded_by : iTunes 10.4.1.10 TSA : Para las almas sensibles date : 2005 Duration: 00:02:52.05, start: 0.000000, bitrate: 320 kb/s Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s Stream #0:1: Video: png, 90k tbr, 90k tbn, 90k tbc Metadata: title : PNG : ? : comment : Other [png @ 0x7f58c0036420] Missing png signature 16.36 A-V: nan fd= 0 aq= 6KB vq= 0KB sq= 0B f=0/0 From cehoyos at ag.or.at Sun Dec 22 21:57:07 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 22 Dec 2013 20:57:07 +0000 (UTC) Subject: [Libav-user] PNG in mp3's failing References: <52B751AD.1020900@gmail.com> Message-ID: Gonzalo Garramuno writes: > I can upload the mp3 if someone points me where to ftp it to. Either use http://www.datafilehost.com/ or read http://ffmpeg.org/bugreports.html (there is no hard filesize limit). Thank you, Carl Eugen From cehoyos at ag.or.at Sun Dec 22 22:01:23 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 22 Dec 2013 21:01:23 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?=5BLivav-user=5D_Questions_about_reference?= =?utf-8?q?_counting_and_av=5F=5Binterleaved=5F=5Dwrite=5Fframe?= References: Message-ID: Massimo Battistel writes: > 1a. I would like to know where I can find documentation > about ffmpeg reference counting. Is this the starting > point or there are other resources? > "http://www.ffmpeg.org/doxygen/2.0/group__lavu__buffer.html". I am not saying that there is a difference but the better starting point is http://www.ffmpeg.org/doxygen/trunk/group__lavu__buffer.html > 1b. Is this the official url for examples code? > "http://www.ffmpeg.org/doxygen/2.0/examples.html" Again, it should be trunk, but the current version of the examples is in the tree in the doc/examples directory. Carl Eugen From ggarra13 at gmail.com Sun Dec 22 23:45:54 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Sun, 22 Dec 2013 19:45:54 -0300 Subject: [Libav-user] PNG in mp3's failing In-Reply-To: References: <52B751AD.1020900@gmail.com> Message-ID: <52B76BA2.9010609@gmail.com> On 22/12/13 17:57, Carl Eugen Hoyos wrote: > Gonzalo Garramuno writes: > >> I can upload the mp3 if someone points me where to ftp it to. > Either use http://www.datafilehost.com/ or read > http://ffmpeg.org/bugreports.html (there is no > hard filesize limit). I've uploaded into: http://www.datafilehost.com/d/44259097 Thanks for taking a look at it. From donmoir at comcast.net Mon Dec 16 07:58:56 2013 From: donmoir at comcast.net (Don Moir) Date: Mon, 16 Dec 2013 01:58:56 -0500 Subject: [Libav-user] PNG in mp3's failing References: <52B751AD.1020900@gmail.com> Message-ID: <1FD8EE12C95B40B8A5BBFF73ABF9B2D5@MANLAP> ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Sunday, December 22, 2013 3:57 PM Subject: Re: [Libav-user] PNG in mp3's failing > Gonzalo Garramuno writes: > >> I can upload the mp3 if someone points me where to ftp it to. > > Either use http://www.datafilehost.com/ or read > http://ffmpeg.org/bugreports.html (there is no > hard filesize limit). > > Thank you, Carl Eugen Here's an mp3 with png that fails for me in N-58754-ge2bf00c. You don't get a finished frame when you try and decode the attached_pic so something has changed with that since it works with N-50056-gc63f9fb which is a much older version. mp3's with jpeg's work fine in both versions. http://sms.pangolin.com/temp/Hank_Williams-I'm_So_Lonesome_I_Could_Cry.mp3 Can't test in the latest ffmpeg version since it does not work for me failing in avformat_open_input or avformat_find_stream_info for all files and don't have the time right now to figure that out. From cehoyos at ag.or.at Mon Dec 23 00:49:41 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 22 Dec 2013 23:49:41 +0000 (UTC) Subject: [Libav-user] PNG in mp3's failing References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> Message-ID: Gonzalo Garramuno writes: > I've uploaded into: > > http://www.datafilehost.com/d/44259097 Afaict, a byte ("0x00") is missing in the file. (There is no "Description" that is required by the specification.) Does iTunes (and WMP) really show the image? Thank you, Carl Eugen From battistel at gmail.com Mon Dec 23 01:12:16 2013 From: battistel at gmail.com (Massimo Battistel) Date: Mon, 23 Dec 2013 01:12:16 +0100 Subject: [Libav-user] [Livav-user] Questions about reference counting and av_[interleaved_]write_frame In-Reply-To: References: Message-ID: > the examples is in the tree in the doc/examples > directory. > Thanks for answers. Any idea about points 2, 3, 4? thanks, MB -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Dec 23 01:16:49 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Dec 2013 00:16:49 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?=5BLivav-user=5D_Questions_about_reference?= =?utf-8?q?_counting_and_av=5F=5Binterleaved=5F=5Dwrite=5Fframe?= References: Message-ID: Massimo Battistel writes: > Any idea about points 2, 3, 4? No, although I am surprised about "==TRUE" which is used nowhere in FFmpeg afair. Carl Eugen From safiuddinkhan at gmail.com Mon Dec 23 06:45:16 2013 From: safiuddinkhan at gmail.com (Safi ud Din Khan) Date: Mon, 23 Dec 2013 10:45:16 +0500 Subject: [Libav-user] PNG in mp3's failing In-Reply-To: References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> Message-ID: <52B7CDEC.90809@gmail.com> i have a very same problem in my program .... ffmpeg does not parse attached images in mp3 correctly jpg and png specially . .... projects like vlc player uses taglib instead of ffmpeg to extract attached image and other information from mp3 file http://taglib.github.io/ On 12/23/2013 04:49 AM, Carl Eugen Hoyos wrote: > Gonzalo Garramuno writes: > >> I've uploaded into: >> >> http://www.datafilehost.com/d/44259097 > Afaict, a byte ("0x00") is missing in the file. > (There is no "Description" that is required by > the specification.) > Does iTunes (and WMP) really show the image? > > Thank you, Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From yamusanivinay at gmail.com Mon Dec 23 06:59:49 2013 From: yamusanivinay at gmail.com (bitfield) Date: Sun, 22 Dec 2013 21:59:49 -0800 (PST) Subject: [Libav-user] Serious Issue In-Reply-To: References: Message-ID: <1387778388934-4659050.post@n4.nabble.com> Hi All, Please help me in solving this issue.. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Serious-Issue-tp4659013p4659050.html Sent from the libav-users mailing list archive at Nabble.com. From yamusanivinay at gmail.com Mon Dec 23 14:26:04 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Mon, 23 Dec 2013 18:56:04 +0530 Subject: [Libav-user] error while writing to abuffer Message-ID: Hi All, I used some filters and try to decode the audio and applied the filters to decoded frame.But for most of the mp3 songs..it is working perfectly.But for some songs..I am getting error at below mentioned code.. static AVFilterContext *abuffer_ctx = NULL; snprintf(strbuf, sizeof(strbuf), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s:channel_layout=0x%"PRIx64, time_base.num, time_base.den, avctx->sample_rate, av_get_sample_fmt_name(avctx->sample_fmt), avctx->channel_layout); err = avfilter_graph_create_filter(&abuffer_ctx, abuffer, NULL, strbuf,NULL, filter_graph); if (err < 0) { LOGI("error initializing abuffer filter\n"); return err; } else { LOGE("success initializing abuffer filter\n"); } int err = av_buffersrc_write_frame(abuffer_ctx, frame); av_frame_unref(frame); av_frame_free(&frame); if (err < 0) { LOGE("error writing frame to buffersrc\n"); } By using the above code for some mp3 songs I am getting the log message "error writing frame to buffersrc\n".So please help me in resolving this problem. Thanks & Regards, bitfield. -------------- next part -------------- An HTML attachment was scrubbed... URL: From parijat.mohor at gmail.com Mon Dec 23 14:32:55 2013 From: parijat.mohor at gmail.com (Parijat Mukherjee) Date: Mon, 23 Dec 2013 19:02:55 +0530 Subject: [Libav-user] Frame Rate Problem Message-ID: Hello, I am using the command ffmpeg.exe -i -movflags frag_keyframe -vcodec copy -acodec copy to convert a normal MP4 file into fragmented MP4. My input file has a frame rate of 59 but in the fragmented mp4 i am getting the frame rate 64. I have already tried with the options like "-r" and "-framerate" . If I make a normal mp4 then the frame rate is getting fixed but not with the fragmented one. Please help, how can I fix my frame rate for the fragmented mp4 files. Thanks -- Regards, Parijat Mukherjee -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Dec 23 14:49:42 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Dec 2013 13:49:42 +0000 (UTC) Subject: [Libav-user] Frame Rate Problem References: Message-ID: Parijat Mukherjee writes: > I am using the command > > ?ffmpeg.exe -i -movflags frag_keyframe > -vcodec copy -acodec copy ? > > to convert a normal MP4 file into fragmented MP4. Complete, uncut console output missing. > My input file has a frame rate of 59 but in the > fragmented mp4 i am getting the frame rate 64. Do you mean your output file plays too fast? Or are you just unhappy about the console output? Carl Eugen From battistel at gmail.com Mon Dec 23 16:55:52 2013 From: battistel at gmail.com (Massimo Battistel) Date: Mon, 23 Dec 2013 16:55:52 +0100 Subject: [Libav-user] Help about custom I/O context Message-ID: Hello, I have to read an ASF stream from a named pipe (on windows). The pipe is already opened and I cannot seek. I've followed these links to begin (I think there is no official doc about the argument): http://www.codeproject.com/Tips/489450/Creating-Custom-FFmpeg-IO-Context http://cdry.wordpress.com/2009/09/09/using-custom-io-callbacks-with-ffmpeg/ I've found some diffs with official doc: 1. If my buf size is (1000 + FF_INPUT_BUFFER_PADDING_SIZE), When calling "avio_alloc_context" the 2nd params buffer_size must be 1000 or (1000 + FF_INPUT_BUFFER_PADDING_SIZE)? 2. Does it make the difference specify AVFormatContecxt->flags = AVFMT_FLAG_CUSTOM_IO? 3. How to allocate the buffer? av_malloc(1000) or new BYTE[1000]? 4. The articles say that it is mandatory to use AVProbeData and av_probe_input_format to avoid application crashes, but I have no probs with normal flow using avformat_open_input and avformat_find_stream_info. Is this safe? 5. a. does avformat_open_input reads header only? b. is avformat_find_stream_info the method that uses analyzeduration and probesize values? Do you have some resource about this subject to provide? thanks a lot, MB -------------- next part -------------- An HTML attachment was scrubbed... URL: From george at nsup.org Mon Dec 23 17:08:03 2013 From: george at nsup.org (Nicolas George) Date: Mon, 23 Dec 2013 17:08:03 +0100 Subject: [Libav-user] error while writing to abuffer In-Reply-To: References: Message-ID: <20131223160803.GA22476@phare.normalesup.org> Le tridi 3 niv?se, an CCXXII, Yamusani Vinay a ?crit?: > By using the above code for some mp3 songs I am getting the log message > "error writing frame to buffersrc\n".So please help me in resolving this > problem. I suggest you start by converting the error code to a string and printing it, to know the kind of error. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: From ggarra13 at gmail.com Mon Dec 23 17:08:03 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Mon, 23 Dec 2013 13:08:03 -0300 Subject: [Libav-user] PNG in mp3's failing In-Reply-To: References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> Message-ID: <52B85FE3.3030107@gmail.com> On 22/12/13 20:49, Carl Eugen Hoyos wrote: > Does iTunes (and WMP) really show the image? > > Thank you, Carl Eugen I cannot speak for iTunes, but vlc shows it properly. From cehoyos at ag.or.at Mon Dec 23 19:25:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Dec 2013 18:25:06 +0000 (UTC) Subject: [Libav-user] PNG in mp3's failing References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> <52B85FE3.3030107@gmail.com> Message-ID: Gonzalo Garramuno writes: > On 22/12/13 20:49, Carl Eugen Hoyos wrote: > > Does iTunes (and WMP) really show the image? > > > I cannot speak for iTunes, but vlc shows it properly. Sorry, I had already sent a patch that fixes the issue but forgot to say here that I was able to reproduce it. Carl Eugen From parijat.mohor at gmail.com Mon Dec 23 19:28:43 2013 From: parijat.mohor at gmail.com (Parijat Mukherjee) Date: Mon, 23 Dec 2013 23:58:43 +0530 Subject: [Libav-user] Frame Rate Problem In-Reply-To: References: Message-ID: I need the same frame rate of the input file. But my input file has 50 fps frame raate......nd after applying that command line I mentioned above.... the output file shows that it has 59 fps. I need the output mp4 in 50 fps. On Mon, Dec 23, 2013 at 7:19 PM, Carl Eugen Hoyos wrote: > Parijat Mukherjee writes: > > > I am using the command > > > > ffmpeg.exe -i -movflags frag_keyframe > > -vcodec copy -acodec copy > > > > to convert a normal MP4 file into fragmented MP4. > > Complete, uncut console output missing. > > > My input file has a frame rate of 59 but in the > > fragmented mp4 i am getting the frame rate 64. > > Do you mean your output file plays too fast? Or > are you just unhappy about the console output? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Regards, Parijat Mukherjee -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Dec 24 06:53:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 24 Dec 2013 05:53:00 +0000 (UTC) Subject: [Libav-user] PNG in mp3's failing References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> Message-ID: Gonzalo Garramuno writes: > On 22/12/13 17:57, Carl Eugen Hoyos wrote: > > Gonzalo Garramuno ...> writes: > > > >> I can upload the mp3 if someone points me where to ftp it to. > I've uploaded into: > > http://www.datafilehost.com/d/44259097 Should be fixed, thank you for the sample! Merry Christmas, Carl Eugen From ggarra13 at gmail.com Wed Dec 25 22:14:34 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Wed, 25 Dec 2013 18:14:34 -0300 Subject: [Libav-user] PNG in mp3's failing In-Reply-To: References: <52B751AD.1020900@gmail.com> <52B76BA2.9010609@gmail.com> Message-ID: <52BB4ABA.7060401@gmail.com> On 24/12/13 02:53, Carl Eugen Hoyos wrote: > Should be fixed, thank you for the sample! > > Merry Christmas, Carl Eugen > I can verify the problem is solved. Thanks for the rapid response. Merry Christmas to you and your family. From marco.giovannini at traderlink.it Wed Dec 25 22:14:48 2013 From: marco.giovannini at traderlink.it (marco.giovannini at traderlink.it) Date: 25 Dec 2013 22:14:48 +0100 Subject: [Libav-user] =?utf-8?q?PNG_in_mp3=27s_failing?= Message-ID: <20131225211448.7757.qmail@srv01.traderlink.it> Sono fuori ufficio dal 23/12/2013 al 06/01/2014 Cordiali Saluti Marco Giovannini From ofer.fly at gmail.com Thu Dec 26 14:49:02 2013 From: ofer.fly at gmail.com (=?UTF-8?B?16LXldek16gg15HXqA==?=) Date: Thu, 26 Dec 2013 15:49:02 +0200 Subject: [Libav-user] Calling avcodec_decode_video2 fails to get picture in multithreaded application Message-ID: Hi all, I have a multithreaded C# application on windows 7 that displays multiple video streams from a server. The way it works is that each stream is connected to the server to get the frames, and a dedicated thread (one per stream) is decoding the frame using ffmpeg and then rendering. There is a wrapper class that calls ffmpeg that was written in managed C++/CLI (vs 2010). The frame memory is allocated in unmanaged code using Marshal.AllocHGlobal(). The problem is that when having multiple threads (above 8) calling avcodec_decode_video2 returns zero in gotPicture return parameter. As a result, there's no frame to display. I enabled debug logging and noticed that this happens only in the last 4 threads that were added. The error log says: "no picture ooo" (Out Of Order debug log in h264.c. I verified that the frames are coming from the server at the right order by checking the timestamp on each one. I tried to add a lock around the call to avcodec_decode_video2 but that didn't change anything. Is this a threading issue with avcodec_decode_video2 or h264? any idea what am I doing wrong or how can this be fixed? Running on Windows 7 64 bit. Using zeranoe ffmpeg build from last week. Mainly using H264 decoding but I also saw this error when using MPEG4. Many thank! Ofer Bar -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.giovannini at traderlink.it Thu Dec 26 14:49:13 2013 From: marco.giovannini at traderlink.it (marco.giovannini at traderlink.it) Date: 26 Dec 2013 14:49:13 +0100 Subject: [Libav-user] =?utf-8?q?Calling_avcodec=5Fdecode=5Fvideo2_fails_to?= =?utf-8?q?_get_picture_in=09multithreaded_application?= Message-ID: <20131226134913.13507.qmail@srv01.traderlink.it> Sono fuori ufficio dal 23/12/2013 al 06/01/2014 Cordiali Saluti Marco Giovannini From yamusanivinay at gmail.com Fri Dec 27 15:11:16 2013 From: yamusanivinay at gmail.com (Yamusani Vinay) Date: Fri, 27 Dec 2013 19:41:16 +0530 Subject: [Libav-user] cpu load Message-ID: Hi All, I am using ffmpeg in my android to play audio songs..But the problem is that my app is consuming high cpu load almost 70%.So is there any way to reduce cpu load of my application? My questions: 1.If i use sdl in my android app cpu load will be reduced or not? 2.If I compile ffmpeg by enabling neon then cpu load will be reduced or not? Thanks & Regards, Vinay Yamusani. -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.giovannini at traderlink.it Fri Dec 27 15:11:28 2013 From: marco.giovannini at traderlink.it (marco.giovannini at traderlink.it) Date: 27 Dec 2013 15:11:28 +0100 Subject: [Libav-user] =?utf-8?q?cpu_load?= Message-ID: <20131227141128.2018.qmail@srv01.traderlink.it> Sono fuori ufficio dal 23/12/2013 al 06/01/2014 Cordiali Saluti Marco Giovannini From rogerdpack2 at gmail.com Fri Dec 27 18:28:02 2013 From: rogerdpack2 at gmail.com (Roger Pack) Date: Fri, 27 Dec 2013 10:28:02 -0700 Subject: [Libav-user] Get the list of Capture device In-Reply-To: References: Message-ID: On 11/30/13, Jaafar hamza wrote: > Sorry for my bad English, > I try to better explain my problem. > I am trying to stream my web cam and audio from my computer to another. I > succeeded to do that with ffmpeg command line but I need to do that with a > Swing-based application. > So my first question is: It is possible with libav to obtain a list of > devices like when I execute this ffmpeg command line > > " ffmpeg -list_devices true -f dshow -i dummy" > > Thanks for you great job and for your help > Not today, though you can programmatically enumerate them yourself: https://trac.ffmpeg.org/wiki/DirectShow#Howtoprogrammaticallyenumeratedevices > > > 2013/11/22 Jaafar hamza > >> Hello, >> Could you please, tell me how can I obtain a list of devices like when >> I execut this ffmpeg command line >> >> " ffmpeg -list_devices true -f dshow -i dummy" >> >> Thanks for you great job and for your help >> > From yamusanivinay at gmail.com Mon Dec 30 13:18:02 2013 From: yamusanivinay at gmail.com (bitfield) Date: Mon, 30 Dec 2013 04:18:02 -0800 (PST) Subject: [Libav-user] cpu load In-Reply-To: <20131227141128.2018.qmail@srv01.traderlink.it> References: <20131227141128.2018.qmail@srv01.traderlink.it> Message-ID: <1388405882198-4659067.post@n4.nabble.com> Please solve my problem..the cpu load is almost 70%... -- View this message in context: http://libav-users.943685.n4.nabble.com/Re-cpu-load-tp4659065p4659067.html Sent from the libav-users mailing list archive at Nabble.com. From marco.giovannini at traderlink.it Mon Dec 30 13:40:28 2013 From: marco.giovannini at traderlink.it (marco.giovannini at traderlink.it) Date: 30 Dec 2013 13:40:28 +0100 Subject: [Libav-user] =?utf-8?q?cpu_load?= Message-ID: <20131230124028.7912.qmail@srv01.traderlink.it> Sono fuori ufficio dal 23/12/2013 al 06/01/2014 Cordiali Saluti Marco Giovannini From donmoir at comcast.net Mon Dec 16 08:08:15 2013 From: donmoir at comcast.net (Don Moir) Date: Mon, 16 Dec 2013 02:08:15 -0500 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? Message-ID: Would like to interrupt avcodec_decode_video2 at times like when starting a new seek. Decoding takes the most time of anything I do. Since app is timeline oriented, trying to keep seek time down to minimum and if avcodec_decode_video2 has been called, seems there is no way out until its finished and this decoding time can delay a new seek attempt. -------------- next part -------------- An HTML attachment was scrubbed... URL: From marco.giovannini at traderlink.it Tue Dec 31 08:05:33 2013 From: marco.giovannini at traderlink.it (marco.giovannini at traderlink.it) Date: 31 Dec 2013 08:05:33 +0100 Subject: [Libav-user] =?utf-8?q?any_way_to_interrupt_avcodec=5Fdecode=5Fvi?= =?utf-8?q?deo2_=3F?= Message-ID: <20131231070533.25229.qmail@srv01.traderlink.it> Sono fuori ufficio dal 23/12/2013 al 06/01/2014 Cordiali Saluti Marco Giovannini From h.leppkes at gmail.com Tue Dec 31 08:09:47 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Tue, 31 Dec 2013 08:09:47 +0100 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? In-Reply-To: References: Message-ID: On Mon, Dec 16, 2013 at 8:08 AM, Don Moir wrote: > Would like to interrupt avcodec_decode_video2 at times like when starting a > new seek. Decoding takes the most time of anything I do. Since app is > timeline oriented, trying to keep seek time down to minimum and if > avcodec_decode_video2 has been called, seems there is no way out until its > finished and this decoding time can delay a new seek attempt. > No, you cannot interrupt it. You'll have to wait until the current frame finishes decoding. From donmoir at comcast.net Tue Dec 31 08:57:02 2013 From: donmoir at comcast.net (Don Moir) Date: Tue, 31 Dec 2013 07:57:02 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: Message-ID: ----- Original Message ----- From: "Hendrik Leppkes" To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." Sent: Tuesday, December 31, 2013 2:09 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? > On Mon, Dec 16, 2013 at 8:08 AM, Don Moir wrote: >> Would like to interrupt avcodec_decode_video2 at times like when starting a >> new seek. Decoding takes the most time of anything I do. Since app is >> timeline oriented, trying to keep seek time down to minimum and if >> avcodec_decode_video2 has been called, seems there is no way out until its >> finished and this decoding time can delay a new seek attempt. >> > > No, you cannot interrupt it. > You'll have to wait until the current frame finishes decoding. Could be a callback added to AVCodecContext I suppose and I realize it would take awhile before fully implemented, but could be useful. Not sure if anyone else cares enough though. The decoding can be heavy on slower machines. From cehoyos at ag.or.at Tue Dec 31 10:08:28 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 31 Dec 2013 09:08:28 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?any_way_to_interrupt_avcodec=5Fdecode=5Fvi?= =?utf-8?q?deo2_=3F?= References: Message-ID: Don Moir writes: > Since app is timeline oriented,?trying to keep seek time > down to minimum?and if?avcodec_decode_video2 has been > called, seems there is no way out until its finished > and this decoding time can delay a new seek attempt. Are you looking for CODEC_FLAG2_SHOW_ALL? Carl Eugen From donmoir at comcast.net Tue Dec 31 10:45:42 2013 From: donmoir at comcast.net (Don Moir) Date: Tue, 31 Dec 2013 09:45:42 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: Message-ID: <26EAA74A8984475C8A5864227C177558@MANLAP> ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Tuesday, December 31, 2013 4:08 AM Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? > Don Moir writes: > >> Since app is timeline oriented, trying to keep seek time >> down to minimum and if avcodec_decode_video2 has been >> called, seems there is no way out until its finished >> and this decoding time can delay a new seek attempt. > > Are you looking for CODEC_FLAG2_SHOW_ALL? > > Carl Eugen No. I can easily check between calls to avcodec_decode_video2 but once its called you are stuck until it returns. Would be nice to be able to interrupt it for quicker seeking and to end 'the' video more quickly. Doesn't matter too much for a simple player app, but I have things on timelines and also video coming and going quicky. Things are time corrected to a timeline but the more I can reduce impact from things like this the better off we are. A simple seek to zero is quick, but if I have to wait on avcodec_decode_video2 to return, then its slower and can be quite slow. I don't mean finish as in the flag (gotframe) to avcodec_decode_video2, but just waiting on it to return period. From ofer.fly at gmail.com Tue Dec 31 11:24:50 2013 From: ofer.fly at gmail.com (=?UTF-8?B?16LXldek16gg15HXqA==?=) Date: Tue, 31 Dec 2013 12:24:50 +0200 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? In-Reply-To: <26EAA74A8984475C8A5864227C177558@MANLAP> References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: What do you mean by "waiting"? If you're calling this api on a different thread, why can't you terminate the thread? If you're calling it from your main thread, there's nothing your app can do until the function returns, unless they implement some callbacks in the middle of the execution. Best of luck! On Mon, Dec 16, 2013 at 8:48 AM, Don Moir wrote: > > ----- Original Message ----- From: "Carl Eugen Hoyos" > To: > Sent: Tuesday, December 31, 2013 4:08 AM > > Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? > > > Don Moir writes: >> >> Since app is timeline oriented, trying to keep seek time >>> down to minimum and if avcodec_decode_video2 has been >>> called, seems there is no way out until its finished >>> and this decoding time can delay a new seek attempt. >>> >> >> Are you looking for CODEC_FLAG2_SHOW_ALL? >> >> Carl Eugen >> > > No. I can easily check between calls to avcodec_decode_video2 but once its > called you are stuck until it returns. Would be nice to be able to > interrupt it for quicker seeking and to end 'the' video more quickly. > Doesn't matter too much for a simple player app, but I have things on > timelines and also video coming and going quicky. Things are time corrected > to a timeline but the more I can reduce impact from things like this the > better off we are. > > A simple seek to zero is quick, but if I have to wait on > avcodec_decode_video2 to return, then its slower and can be quite slow. I > don't mean finish as in the flag (gotframe) to avcodec_decode_video2, but > just waiting on it to return period. > > > _______________________________________________ > 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 donmoir at comcast.net Tue Dec 31 12:14:15 2013 From: donmoir at comcast.net (Don Moir) Date: Tue, 31 Dec 2013 11:14:15 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: <26EAA74A8984475C8A5864227C177558@MANLAP> Message-ID: <4906ECBB1CB34CFC8481673CD4FF51AB@MANLAP> From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 5:24 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? >What do you mean by "waiting"? >If you're calling this api on a different thread, why can't you terminate the thread? >If you're calling it from your main thread, there's nothing your app can do until the function returns, unless they implement some callbacks in the middle of the execution. >Best of luck! I allow for proper cleanup and no telling what state ffmpeg would be in if I just up and terminated the thread. It's in the mist of decoding and waiting for return allows me to free packet its decoding etc. Another thread waits on it normally waiting to seek or exit. Best thing would be interrupt callback. ---- Original Message ----- From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 5:24 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? What do you mean by "waiting"? If you're calling this api on a different thread, why can't you terminate the thread? If you're calling it from your main thread, there's nothing your app can do until the function returns, unless they implement some callbacks in the middle of the execution. Best of luck! On Mon, Dec 16, 2013 at 8:48 AM, Don Moir wrote: ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Tuesday, December 31, 2013 4:08 AM Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? Don Moir writes: Since app is timeline oriented, trying to keep seek time down to minimum and if avcodec_decode_video2 has been called, seems there is no way out until its finished and this decoding time can delay a new seek attempt. Are you looking for CODEC_FLAG2_SHOW_ALL? Carl Eugen No. I can easily check between calls to avcodec_decode_video2 but once its called you are stuck until it returns. Would be nice to be able to interrupt it for quicker seeking and to end 'the' video more quickly. Doesn't matter too much for a simple player app, but I have things on timelines and also video coming and going quicky. Things are time corrected to a timeline but the more I can reduce impact from things like this the better off we are. A simple seek to zero is quick, but if I have to wait on avcodec_decode_video2 to return, then its slower and can be quite slow. I don't mean finish as in the flag (gotframe) to avcodec_decode_video2, but just waiting on it to return period. _______________________________________________ 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 ofer.fly at gmail.com Tue Dec 31 12:32:39 2013 From: ofer.fly at gmail.com (=?UTF-8?B?16LXldek16gg15HXqA==?=) Date: Tue, 31 Dec 2013 13:32:39 +0200 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? In-Reply-To: <4906ECBB1CB34CFC8481673CD4FF51AB@MANLAP> References: <26EAA74A8984475C8A5864227C177558@MANLAP> <4906ECBB1CB34CFC8481673CD4FF51AB@MANLAP> Message-ID: I think it's also possible to multi-thread decoding by changing some parameters codec context structure like thread_count and thread_type. You do need a multi-threaded ffmpeg build for that I believe. Maybe in this way you can reduce the decoding time, assuming you have few cores. On Mon, Dec 16, 2013 at 8:17 AM, Don Moir wrote: > *From:* ???? ?? > *To:* This list is about using libavcodec, libavformat, > libavutil,libavdevice and libavfilter. > *Sent:* Tuesday, December 31, 2013 5:24 AM > *Subject:* Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? > > >What do you mean by "waiting"? > >If you're calling this api on a different thread, why can't you terminate > the thread? > >If you're calling it from your main thread, there's nothing your app can > do until the function returns, unless they implement some callbacks in the > middle of the execution. > > >Best of luck! > > I allow for proper cleanup and no telling what state ffmpeg would be in if > I just up and terminated the thread. It's in the mist of decoding and > waiting for return allows me to free packet its decoding etc. > > Another thread waits on it normally waiting to seek or exit. > > Best thing would be interrupt callback. > > ---- Original Message ----- > > *From:* ???? ?? > *To:* This list is about using libavcodec, libavformat, > libavutil,libavdevice and libavfilter. > *Sent:* Tuesday, December 31, 2013 5:24 AM > *Subject:* Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? > > What do you mean by "waiting"? > If you're calling this api on a different thread, why can't you terminate > the thread? > If you're calling it from your main thread, there's nothing your app can > do until the function returns, unless they implement some callbacks in the > middle of the execution. > > Best of luck! > > > On Mon, Dec 16, 2013 at 8:48 AM, Don Moir wrote: > >> >> ----- Original Message ----- From: "Carl Eugen Hoyos" >> To: >> Sent: Tuesday, December 31, 2013 4:08 AM >> >> Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? >> >> >> Don Moir writes: >>> >>> Since app is timeline oriented, trying to keep seek time >>>> down to minimum and if avcodec_decode_video2 has been >>>> called, seems there is no way out until its finished >>>> and this decoding time can delay a new seek attempt. >>>> >>> >>> Are you looking for CODEC_FLAG2_SHOW_ALL? >>> >>> Carl Eugen >>> >> >> No. I can easily check between calls to avcodec_decode_video2 but once >> its called you are stuck until it returns. Would be nice to be able to >> interrupt it for quicker seeking and to end 'the' video more quickly. >> Doesn't matter too much for a simple player app, but I have things on >> timelines and also video coming and going quicky. Things are time corrected >> to a timeline but the more I can reduce impact from things like this the >> better off we are. >> >> A simple seek to zero is quick, but if I have to wait on >> avcodec_decode_video2 to return, then its slower and can be quite slow. I >> don't mean finish as in the flag (gotframe) to avcodec_decode_video2, but >> just waiting on it to return period. >> >> >> _______________________________________________ >> 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 donmoir at comcast.net Tue Dec 31 13:24:57 2013 From: donmoir at comcast.net (Don Moir) Date: Tue, 31 Dec 2013 12:24:57 -0000 Subject: [Libav-user] any way to interrupt avcodec_decode_video2 ? References: <26EAA74A8984475C8A5864227C177558@MANLAP><4906ECBB1CB34CFC8481673CD4FF51AB@MANLAP> Message-ID: ----- Original Message ----- From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 6:32 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? >I think it's also possible to multi-thread decoding by changing some parameters codec context structure like thread_count and thread_type. >You do need a multi-threaded ffmpeg build for that I believe. >Maybe in this way you can reduce the decoding time, assuming you have few cores. Possibly ffmpeg multi-thread decoding would help some, but I am leary about that. More things to go wrong and more for me to figue out what went wrong :) Also I may have numerous threads open since there may be more than 10 av files open and playing at same time so try to be careful about being too thread heavy. Conceptually it's a pretty easy thing to implement an interrupt callback for AVCodecContext. It may take awhile though for it to filter thru everywhere, hitting the problem areas first and ignored by others while waiting. Mostly its not too bad but depends on machine and video of course. I don;t think most will have much interest but timeline apps and editing apps could benefit the most. You also have to ask why an intense process like decoding is not interruptible. ----- Original Message ----- From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 6:32 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? I think it's also possible to multi-thread decoding by changing some parameters codec context structure like thread_count and thread_type. You do need a multi-threaded ffmpeg build for that I believe. Maybe in this way you can reduce the decoding time, assuming you have few cores. On Mon, Dec 16, 2013 at 8:17 AM, Don Moir wrote: From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 5:24 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? >What do you mean by "waiting"? >If you're calling this api on a different thread, why can't you terminate the thread? >If you're calling it from your main thread, there's nothing your app can do until the function returns, unless they implement some callbacks in the middle of the execution. >Best of luck! I allow for proper cleanup and no telling what state ffmpeg would be in if I just up and terminated the thread. It's in the mist of decoding and waiting for return allows me to free packet its decoding etc. Another thread waits on it normally waiting to seek or exit. Best thing would be interrupt callback. ---- Original Message ----- From: ???? ?? To: This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter. Sent: Tuesday, December 31, 2013 5:24 AM Subject: Re: [Libav-user] any way to interrupt avcodec_decode_video2 ? What do you mean by "waiting"? If you're calling this api on a different thread, why can't you terminate the thread? If you're calling it from your main thread, there's nothing your app can do until the function returns, unless they implement some callbacks in the middle of the execution. Best of luck! On Mon, Dec 16, 2013 at 8:48 AM, Don Moir wrote: ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Tuesday, December 31, 2013 4:08 AM Subject: Re: [Libav-user]any way to interrupt avcodec_decode_video2 ? Don Moir writes: Since app is timeline oriented, trying to keep seek time down to minimum and if avcodec_decode_video2 has been called, seems there is no way out until its finished and this decoding time can delay a new seek attempt. Are you looking for CODEC_FLAG2_SHOW_ALL? Carl Eugen No. I can easily check between calls to avcodec_decode_video2 but once its called you are stuck until it returns. Would be nice to be able to interrupt it for quicker seeking and to end 'the' video more quickly. Doesn't matter too much for a simple player app, but I have things on timelines and also video coming and going quicky. Things are time corrected to a timeline but the more I can reduce impact from things like this the better off we are. A simple seek to zero is quick, but if I have to wait on avcodec_decode_video2 to return, then its slower and can be quite slow. I don't mean finish as in the flag (gotframe) to avcodec_decode_video2, but just waiting on it to return period. _______________________________________________ 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 grisme at yandex.ru Tue Dec 31 16:40:16 2013 From: grisme at yandex.ru (=?koi8-r?B?5dfHxc7JyiDnwdLJxtXMzMnO?=) Date: Tue, 31 Dec 2013 21:40:16 +0600 Subject: [Libav-user] RTSP recording Message-ID: <130231388504416@web11g.yandex.ru> An HTML attachment was scrubbed... URL: From grisme at yandex.ru Tue Dec 31 16:55:51 2013 From: grisme at yandex.ru (=?UTF-8?B?0JXQstCz0LXQvdC40Lkg0JPQsNGA0LjRhNGD0LvQu9C40L0=?=) Date: Tue, 31 Dec 2013 21:55:51 +0600 Subject: [Libav-user] RTSP record (normally) Message-ID: <52C2E907.9060703@yandex.ru> Hi, all. I am newbe in this mail-list. I want to record RTSP-stream into files via libavformat / libavcodec programmaticaly, without trans-coding. Here is the code (how i trying to record stream, without error checking): ff_FormatContext = avformat_alloc_context(); ff_Dict = NULL; av_dict_set(&ff_Dict, "rtsp_transport", "tcp", 0); avformat_open_input(&ff_FormatContext, vs_stream_url_c, NULL, &ff_Dict); avformat_find_stream_info(ff_FormatContext, NULL); vs_index = -1; for (vs_iterator = 0; vs_iterator < ff_FormatContext->nb_streams; vs_iterator++) { if (ff_FormatContext->streams[vs_iterator]->codec->coder_type == AVMEDIA_TYPE_VIDEO) { vs_index = vs_iterator; break; } } if (vs_index == -1){ printf("[ THREAD ] Error : Video streams not founded.\n"); return -1; } ff_CodecContext = ff_FormatContext->streams[vs_index]->codec; ff_Codec = avcodec_find_decoder(ff_CodecContext->codec_id); avcodec_open2(ff_CodecContext, ff_Codec, NULL) < 0) ff_Frame = avcodec_alloc_frame(); numBytes = avpicture_get_size(ff_CodecContext->pix_fmt, ff_CodecContext->width, ff_CodecContext->height); buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); avpicture_fill((AVPicture *)ff_Frame, buffer, ff_CodecContext->pix_fmt, ff_CodecContext->width, ff_CodecContext->height); av_init_packet(&ff_Packet); av_read_play(ff_FormatContext); secondmeter1 = time(0); /* Creating output format */ ff_OutputFormat = av_guess_format("mp4", NULL, NULL); ff_OutputFormatContext = avformat_alloc_context(); ff_OutputFormatContext->oformat = ff_OutputFormat; ff_OutputStream = avformat_new_stream(ff_OutputFormatContext, NULL); avcodec_copy_context(ff_OutputStream->codec, ff_CodecContext); ff_OutputStream->codec->flags = CODEC_FLAG_GLOBAL_HEADER; ff_OutputStream->codec->time_base.den = ff_CodecContext->time_base.den; ff_OutputStream->codec->time_base.num = ff_CodecContext->time_base.num; outputFileName = new char[0]; sprintf(outputFileName, "%svideo_%015d.mp4", vs_stream_savepath_c, (int)secondmeter1); frameCounter = 0; avio_open2(&ff_OutputFormatContext->pb, (const char*)outputFileName, AVIO_FLAG_WRITE,NULL,NULL); int ix = 0; while (1 == 1) { av_read_frame(ff_FormatContext, &ff_Packet); if(ff_Packet.stream_index == vs_index){ printf(" DATA : PTS = %d DTS = %d DURATION = %d\n", ff_Packet.pts, ff_Packet.dts, ff_Packet.duration); // I CAN NOT UNDERSTAND, HOW I'D FILL THIS STRUCTS BEFORE FRAME WRITING ff_Packet.stream_index = ff_OutputStream->id; ff_OutputStream->pts.val = ff_Packet.pts; ff_OutputStream->duration = ff_Packet.duration; ff_OutputStream->r_frame_rate = ff_FormatContext->streams[vs_index]->r_frame_rate; if (frameCounter == 0) avformat_write_header(ff_OutputFormatContext, NULL); av_write_frame(ff_OutputFormatContext, &ff_Packet); frameCounter++; if (frameCounter == 512) { frameCounter = 0; av_write_trailer(ff_OutputFormatContext); avio_close(ff_OutputFormatContext->pb); secondmeter1 = time(0); sprintf(outputFileName, "%svideo_%015d.mp4", vs_stream_savepath_c, (int)secondmeter1); avio_open2(&ff_OutputFormatContext->pb, (const char*)outputFileName, AVIO_FLAG_WRITE,NULL,NULL); } } av_free_packet(&ff_Packet); av_init_packet(&ff_Packet); #ifdef __MINGW32__ Sleep(50); #endif // _WIN32 } Code writes video by segments (every 512 frame - new segment with timestamp in filename) Into output file i see wrong duration / FPS information. Video playing so fast. Please help. :(