From jettoblack at gmail.com Fri Jun 1 01:37:13 2012 From: jettoblack at gmail.com (jettoblack) Date: Thu, 31 May 2012 16:37:13 -0700 (PDT) Subject: [Libav-user] Example for recompressing a video? Message-ID: <1338507433079-4655098.post@n4.nabble.com> Hello, I'd like to use libavformat to recompress a video file, similar to ffmpeg standalone but much simpler (fixed codec parameters, etc.). I've figured out how to remux (without re-encoding), but I'm not sure on recompressing. I used the output-example.c as a starting point, but it generates fake video/audio data in temporal order. In my case I am demuxing a IPB encoded video so the frames are decoded out of order. What is the proper way to re-encode these in order? If I simply pass each picture into the encoder in the order that they come out of the decoder, I get errors like "non-strictly-monotonic PTS" from the encoder. Here's my loop, I assume I'm overlooking some major points. while (1) { av_init_packet(&pkt); r = av_read_frame(in, &pkt); if (r) { if (r == AVERROR_EOF) printf("EOF\n"); else printf("read error %x\n", r); break; } printf("stream %d, pts %"PRId64", dts %"PRId64"\n", pkt.stream_index, pkt.pts, pkt.dts); if (pkt.stream_index == in_vstream->index) { picture = avcodec_alloc_frame(); assert(picture); avcodec_decode_video2(in_vcodec, picture, &got_picture, &pkt); if (got_picture) { printf("got picture: pts %"PRId64"\n", pkt.pts); // convert picture to dest format AVFrame *newpicture = avcodec_alloc_frame(); avpicture_fill((AVPicture*)newpicture, picbuf, out_vcodec->pix_fmt, out_vcodec->width, out_vcodec->height); sws_scale(img_convert_ctx, picture->data, picture->linesize, 0, in_vcodec->height, newpicture->data, newpicture->linesize); // write picture int got_packet_ptr = 0; AVPacket newpkt; av_init_packet(&newpkt); r = avcodec_encode_video2(out_vcodec, &newpkt, newpicture, &got_packet_ptr); assert(!r); if (got_packet_ptr) { printf("got_packet_ptr\n"); newpkt.stream_index = out_vstream->index; newpkt.pts = av_rescale_q(out_vcodec->coded_frame->pts, out_vcodec->time_base, out_vstream->time_base); printf("write newpkt: stream %d, pts %"PRId64", dts %"PRId64"\n", newpkt.stream_index, newpkt.pts, newpkt.dts); r = av_interleaved_write_frame(out, &newpkt); if (r && (r != AVERROR(EINVAL))) { printf("write error %x\n", r); } assert(!r); } av_free_packet(&newpkt); av_free(newpicture); video_frames++; } av_free(picture); } else if (pkt.stream_index == in_astream->index) { // get audio // compress audio // write audio // write frame r = av_interleaved_write_frame(out, &pkt); if (r && (r != AVERROR(EINVAL))) { printf("write error %x\n", r); } } av_free_packet(&pkt); } This loop chugs along with a bunch of "non-strictly-monotonic PTS" warnings until it gets to the first time the encoder returns got_packet_ptr = true, then it segfaults on av_interleaved_write_frame(out, &newpkt); I'm quite sure I'm doing something wrong, any ideas? :) Are there any other better examples out there (other than ffmpeg.c -- too complex) for me to start with? Thanks! -- View this message in context: http://libav-users.943685.n4.nabble.com/Example-for-recompressing-a-video-tp4655098.html Sent from the libav-users mailing list archive at Nabble.com. From christian.bruemmer at gmx.de Fri Jun 1 11:57:38 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Fri, 01 Jun 2012 11:57:38 +0200 Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <1338507433079-4655098.post@n4.nabble.com> References: <1338507433079-4655098.post@n4.nabble.com> Message-ID: <4FC89212.6020700@gmx.de> Am 01.06.2012 01:37, schrieb jettoblack: > Hello, > I'd like to use libavformat to recompress a video file, similar to ffmpeg > standalone but much simpler (fixed codec parameters, etc.). I've figured > out how to remux (without re-encoding), but I'm not sure on recompressing. > > I used the output-example.c as a starting point, but it generates fake > video/audio data in temporal order. In my case I am demuxing a IPB encoded > video so the frames are decoded out of order. What is the proper way to > re-encode these in order? If I simply pass each picture into the encoder in > the order that they come out of the decoder, I get errors like > "non-strictly-monotonic PTS" from the encoder. > > Here's my loop, I assume I'm overlooking some major points. > > while (1) { > av_init_packet(&pkt); > r = av_read_frame(in,&pkt); > if (r) { > if (r == AVERROR_EOF) > printf("EOF\n"); > else > printf("read error %x\n", r); > break; > } > printf("stream %d, pts %"PRId64", dts %"PRId64"\n", > pkt.stream_index, pkt.pts, pkt.dts); > > if (pkt.stream_index == in_vstream->index) { > picture = avcodec_alloc_frame(); > assert(picture); > avcodec_decode_video2(in_vcodec, picture,&got_picture,&pkt); > if (got_picture) { > printf("got picture: pts %"PRId64"\n", pkt.pts); > > // convert picture to dest format > AVFrame *newpicture = avcodec_alloc_frame(); > avpicture_fill((AVPicture*)newpicture, picbuf, > out_vcodec->pix_fmt, out_vcodec->width, out_vcodec->height); > sws_scale(img_convert_ctx, picture->data, picture->linesize, > 0, in_vcodec->height, newpicture->data, newpicture->linesize); > > // write picture > int got_packet_ptr = 0; > AVPacket newpkt; > av_init_packet(&newpkt); > r = avcodec_encode_video2(out_vcodec,&newpkt, newpicture, > &got_packet_ptr); > assert(!r); > if (got_packet_ptr) { > printf("got_packet_ptr\n"); > newpkt.stream_index = out_vstream->index; > newpkt.pts = av_rescale_q(out_vcodec->coded_frame->pts, > out_vcodec->time_base, out_vstream->time_base); > printf("write newpkt: stream %d, pts %"PRId64", dts > %"PRId64"\n", newpkt.stream_index, newpkt.pts, newpkt.dts); > r = av_interleaved_write_frame(out,&newpkt); > if (r&& (r != AVERROR(EINVAL))) { > printf("write error %x\n", r); > } > assert(!r); > } > av_free_packet(&newpkt); > av_free(newpicture); > video_frames++; > > } > av_free(picture); > } > else if (pkt.stream_index == in_astream->index) { > // get audio > // compress audio > // write audio > > // write frame > r = av_interleaved_write_frame(out,&pkt); > if (r&& (r != AVERROR(EINVAL))) { > printf("write error %x\n", r); > } > } > > av_free_packet(&pkt); > > } > > This loop chugs along with a bunch of "non-strictly-monotonic PTS" warnings > until it gets to the first time the encoder returns got_packet_ptr = true, > then it segfaults on av_interleaved_write_frame(out,&newpkt); > > I'm quite sure I'm doing something wrong, any ideas? :) Are there any other > better examples out there (other than ffmpeg.c -- too complex) for me to > start with? > > Thanks! > > > > -- > View this message in context: http://libav-users.943685.n4.nabble.com/Example-for-recompressing-a-video-tp4655098.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 > Don't nothing about reordering but you can get rid of the "non-strictly-monotonic PTS" warnings. You have to set the right pts value (and dts if you want to encode audio too) for you AVFrame (newpicture). This is a codec dependent value in case of h264 its some thing like that: mPicture->pts = (float) mFrameCount * (1000.0/(float)(mParameters.mFrameRate)) * 90; So you have to look whats a right pts for your destination video. From nicolas.george at normalesup.org Fri Jun 1 16:06:52 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Fri, 1 Jun 2012 16:06:52 +0200 Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <1338507433079-4655098.post@n4.nabble.com> References: <1338507433079-4655098.post@n4.nabble.com> Message-ID: <20120601140652.GB3720@phare.normalesup.org> Le tridi 13 prairial, an CCXX, jettoblack a ?crit?: > I used the output-example.c as a starting point, but it generates fake > video/audio data in temporal order. In my case I am demuxing a IPB encoded > video so the frames are decoded out of order. The frames are decoded out of order internally, but you do not need to know that: avcodec_decode_video42() returns them in presentation order. And, on the other direction, avcodec_encode_video42() accepts the frames in presentation order and returns the packets in muxing order. Regards, -- Nicolas George From nicolas.george at normalesup.org Fri Jun 1 16:05:37 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Fri, 1 Jun 2012 16:05:37 +0200 Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <1338507433079-4655098.post@n4.nabble.com> References: <1338507433079-4655098.post@n4.nabble.com> Message-ID: <20120601140537.GA3720@phare.normalesup.org> Le tridi 13 prairial, an CCXX, jettoblack a ?crit?: > I used the output-example.c as a starting point, but it generates fake > video/audio data in temporal order. In my case I am demuxing a IPB encoded > video so the frames are decoded out of order. The frames are decoded out of order internally, but you do not need to know that: avcodec_decode_video42() returns them in presentation order. And, on the other direction, avcodec_encode_video42() accepts the frames in presentation order and returns the packets in muxing order. Regards, -- Nicolas George From constantins at neyasystems.com Fri Jun 1 18:50:50 2012 From: constantins at neyasystems.com (Constantin Savtchenko) Date: Fri, 1 Jun 2012 12:50:50 -0400 Subject: [Libav-user] Decoding H264 Frames From RTSP Stream Message-ID: <000601cd4016$b4583430$1d089c90$@neyasystems.com> Hey All, I am very new to H264 and ffmpeg, so please excuse my lack of experience. I am implementing a quick client to connect to and RTSP stream and decode h264 video. I am managing the RTSP connection using Live555, and using ffmpeg to decode the h264 frames. My client successfully deals with h263 using ffmpeg. With h264, I had to add a few modifications to get some type of decoding. For instance, I had to add 0x00000001 to the beginning of each frame returned by Live555. However, I am still getting a variety of warnings and errors from the h264 decoder: - "illegal short term buffer state detected." - "mmco unref short failure" - "concealing ## AC, ## MV, ## errors" I'm having a hard time determining where/what I need to be looking at to deal with these errors or warnings. Preliminary google searches on the error messages and the mailing list (using google) have turned up no direction. Could someone direct me to some documentation/source code that would shed light on the causes of these errors so I may work through them? Thank you. Constantin Savtchenko -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurdy_ch-forum at yahoo.fr Fri Jun 1 20:58:43 2012 From: kurdy_ch-forum at yahoo.fr (kurdy) Date: Fri, 1 Jun 2012 11:58:43 -0700 (PDT) Subject: [Libav-user] ALAC codec I am not sure it's really lossless Message-ID: <1338577123114-4655103.post@n4.nabble.com> Hi, I did some conversions from flac to m4a using alac codec the output file was so small I did following test: >From a flac file I did avconv -i f.flac -acodec alac f.m4a then back to flac avconv -i f.m4a -acodec flac f.flac after using metaflac tools I checked parameters like md5 and some other values and there are different. I did the same using aiff as output format and everything is OK. Is alac codec really lossless ? or Is my tests which are not significant ? Thanks for advice -- View this message in context: http://libav-users.943685.n4.nabble.com/ALAC-codec-I-am-not-sure-it-s-really-lossless-tp4655103.html Sent from the libav-users mailing list archive at Nabble.com. From klaussfreire at gmail.com Sat Jun 2 06:05:05 2012 From: klaussfreire at gmail.com (Claudio Freire) Date: Sat, 2 Jun 2012 01:05:05 -0300 Subject: [Libav-user] ALAC codec I am not sure it's really lossless In-Reply-To: <1338577123114-4655103.post@n4.nabble.com> References: <1338577123114-4655103.post@n4.nabble.com> Message-ID: On Fri, Jun 1, 2012 at 3:58 PM, kurdy wrote: > From a flac file I did avconv -i f.flac -acodec alac f.m4a > then back to flac ?avconv -i f.m4a -acodec flac f.flac Better try some other reference format (pcm ideally), as flac may have multiple representations of the same waveforms. From arash.cordi at gmail.com Sat Jun 2 06:23:48 2012 From: arash.cordi at gmail.com (Arash Cordi) Date: Sat, 2 Jun 2012 08:53:48 +0430 Subject: [Libav-user] Decoding H264 Frames From RTSP Stream In-Reply-To: <000601cd4016$b4583430$1d089c90$@neyasystems.com> References: <000601cd4016$b4583430$1d089c90$@neyasystems.com> Message-ID: you know you can use ffmpeg to decode rtsp frames: url_fopen(&ofc->pb, "rtsp_url", URL_WRONLY); On Fri, Jun 1, 2012 at 9:20 PM, Constantin Savtchenko < constantins at neyasystems.com> wrote: > Hey All,**** > > I am very new to H264 and ffmpeg, so please excuse my lack of experience. > **** > > ** ** > > I am implementing a quick client to connect to and RTSP stream and > decode h264 video. I am managing the RTSP connection using Live555, and > using ffmpeg to decode the h264 frames.**** > > ** ** > > My client successfully deals with h263 using ffmpeg. With h264, I had > to add a few modifications to get some type of decoding. For instance, I > had to add 0x00000001 to the beginning of each frame returned by Live555. > However, I am still getting a variety of warnings and errors from the h264 > decoder:**** > > - ?illegal short term buffer state detected.?**** > > - ?mmco unref short failure?**** > > - ?concealing ## AC, ## MV, ## errors?**** > > ** ** > > I?m having a hard time determining where/what I need to be looking at to > deal with these errors or warnings. Preliminary google searches on the > error messages and the mailing list (using google) have turned up no > direction. Could someone direct me to some documentation/source code that > would shed light on the causes of these errors so I may work through them? > Thank you.**** > > ** ** > > Constantin Savtchenko**** > > ** ** > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- ArasH -------------- next part -------------- An HTML attachment was scrubbed... URL: From kurdy_ch-forum at yahoo.fr Sat Jun 2 10:34:55 2012 From: kurdy_ch-forum at yahoo.fr (kurdy_ch-forum at yahoo.fr) Date: Sat, 2 Jun 2012 09:34:55 +0100 (BST) Subject: [Libav-user] Re : ALAC codec I am not sure it's really lossless In-Reply-To: References: <1338577123114-4655103.post@n4.nabble.com> Message-ID: <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> Hi,? As flac is lossless the number of frame and md5 code of the track should be the same. But I did the test you propose, I extract from the flac the wav and I launch: avconv -i file.wav -acodec alac file.m4a and surprise ! I got an Apple lossless audio What I was suspecting is true? the conversion from flac to m4a using alac codec create an acc 128 !!! Conclusion the command below create an acc even using codec alac I think this a bug.? ? avconv -i file.flac -acodec alac file.m4a? Many people using avconv or ffmpeg to create Apple lossless from flac got acc 128 My version is avconv version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav developers ? ________________________________ De?: Claudio Freire ??: "This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." Envoy? le : Samedi 2 juin 2012 6h05 Objet?: Re: [Libav-user] ALAC codec I am not sure it's really lossless On Fri, Jun 1, 2012 at 3:58 PM, kurdy wrote: > From a flac file I did avconv -i f.flac -acodec alac f.m4a > then back to flac ?avconv -i f.m4a -acodec flac f.flac Better try some other reference format (pcm ideally), as flac may have multiple representations of the same waveforms. _______________________________________________ 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 kurdy_ch-forum at yahoo.fr Sat Jun 2 10:15:59 2012 From: kurdy_ch-forum at yahoo.fr (kurdy) Date: Sat, 2 Jun 2012 01:15:59 -0700 (PDT) Subject: [Libav-user] ALAC codec I am not sure it's really lossless In-Reply-To: References: <1338577123114-4655103.post@n4.nabble.com> Message-ID: <1338624959494-4655106.post@n4.nabble.com> Hi, As flac is lossless the number of frame and md5 code of the track should be the same. But I did the test you propose I extract from the flac the wav and I launch: avconv -i file.wav -acodec alac file.m4a and surprised I got an Apple lossless audio Conclusion with command avconv -i file.flac -acodec alac file.m4a you get an acc a lossy compressed file which is not what I was expecting. For me this a bug and many people use avconv or ffmpeg to create Apple lossless from flac but have acc 128 !!!! -- View this message in context: http://libav-users.943685.n4.nabble.com/ALAC-codec-I-am-not-sure-it-s-really-lossless-tp4655103p4655106.html Sent from the libav-users mailing list archive at Nabble.com. From kurdy_ch-forum at yahoo.fr Sat Jun 2 14:42:06 2012 From: kurdy_ch-forum at yahoo.fr (kurdy_ch-forum at yahoo.fr) Date: Sat, 2 Jun 2012 13:42:06 +0100 (BST) Subject: [Libav-user] Libav is able to dump metadata ... But how ? Message-ID: <1338640926.54109.YahooMailNeo@web28902.mail.ir2.yahoo.com> Hi, I would dump and load to another file metadata as describe in documentation http://libav.org/avconv.html#toc-Metadata But I could not find in documentation how to dump to a file and the load it to another audio file. Have you a sample how to dump to a file and another how to load to file Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From klaussfreire at gmail.com Sat Jun 2 20:19:12 2012 From: klaussfreire at gmail.com (Claudio Freire) Date: Sat, 2 Jun 2012 15:19:12 -0300 Subject: [Libav-user] Re : ALAC codec I am not sure it's really lossless In-Reply-To: <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> References: <1338577123114-4655103.post@n4.nabble.com> <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> Message-ID: Glad you managed to solve it, but: On Sat, Jun 2, 2012 at 5:34 AM, kurdy_ch-forum at yahoo.fr < kurdy_ch-forum at yahoo.fr> wrote: > As flac is lossless the number of frame and md5 code of the track should > be the same. > That's false. MD5 processes bytes, not samples, and as gzip can represent the same text in multiple way, with different MD5 each time, the same happens with other lossless codec. Lossless != stable. PCM is both lossless *and* stable, so that's why you ought to compare PCM only. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sat Jun 2 20:40:07 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 2 Jun 2012 18:40:07 +0000 (UTC) Subject: [Libav-user] Re : ALAC codec I am not sure it's really lossless References: <1338577123114-4655103.post@n4.nabble.com> <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> Message-ID: kurdy_ch-forum at ... writes: > version 0.8.1-4:0.8.1-0ubuntu1 This is an intentionally broken version of FFmpeg with several hundred regressions, some of them security relevant, we therefore cannot support it. Please see http://ffmpeg.org/download.html for supported versions. Carl Eugen From lulebo at gmail.com Mon Jun 4 09:51:52 2012 From: lulebo at gmail.com (Carl Lindqvist) Date: Mon, 4 Jun 2012 09:51:52 +0200 Subject: [Libav-user] x264 pts values when muxing with libavformat Message-ID: Hello I am trying to encode video with x264 and mux using something similar to the example muxing.c. To get to the settings of x264 easier, I am not using libavcodec to encode, but x264 directly. Libavcodec is used for audio and muxing with libavformat. The problem I am having is setting the correct pts values. When I play the files the frames are not even shown in the correct order. I am not really sure how to set the pts correctly. I can set the pts before frames go in to x264 for encoding, and I have tried using just a frame counter. I have tried to set the avpacket pts to the pic_out pts value from x264, but I think it's in the wrong form. I need to convert this number somehow. Does someone have a link to a good explanation of pts times and dts times of h264? And how to set them correctly in libavformat? Regards Carl -------------- next part -------------- An HTML attachment was scrubbed... URL: From onlineweinies at bluewin.ch Mon Jun 4 17:04:13 2012 From: onlineweinies at bluewin.ch (Beni Weine) Date: Mon, 4 Jun 2012 15:04:13 +0000 (GMT+00:00) Subject: [Libav-user] WG: mov demuxer: avformat_seek_file with AVSEEK_FLAG_BYTE Message-ID: <22197560.106561338822253066.JavaMail.webmail@bluewin.ch> Hi all, We need to improve the seeking capabilities (performance) in our video player. The video player concurrently manages 5 different video files (MP4), and plays them in a time synchronized manner. Each video file has a time index file (proprietary) which includes among other things a time stamp and the corresponding byte position of the H. 264 data (I frame). Pure time-based seeking is not an option due to performance reasons. The same player can handle MPEG-2 file. They come with a video time index file as well. We have amazing results with bytes-wise seeking (calling avformat_seek_file with AVSEEK_FLAG_BYTE). It seems that the mpegtsraw demuxer (libavformat/mpegts.c) is doing that pretty good. Different story with the mov demuxer: To me it looks that the current implementation of libavformat/mov.c does not support byte- wise seeking. Having a look into the mov.c confirms my impression. It there a possibility that this feature will be added to the mov demuxer any time soon? Thanks and best regards, Beni From kurdy_ch-forum at yahoo.fr Mon Jun 4 17:38:54 2012 From: kurdy_ch-forum at yahoo.fr (kurdy_ch-forum at yahoo.fr) Date: Mon, 4 Jun 2012 16:38:54 +0100 (BST) Subject: [Libav-user] Re : Re : ALAC codec I am not sure it's really lossless In-Reply-To: References: <1338577123114-4655103.post@n4.nabble.com> <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> Message-ID: <1338824334.61417.YahooMailNeo@web28905.mail.ir2.yahoo.com> Hello, Using the last version from http://ffmpeg.org/download.html? it works fine. The version now is: > ffmpeg version 0.10.2-4:0.10.2-0ubuntu0jon1 Thanks @Claudio I was talking about stream MD5 not a file MD5 calculated afterward. Have a look to flac documentation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From leandrosansilva at gmail.com Mon Jun 4 17:45:55 2012 From: leandrosansilva at gmail.com (Leandro Santiago) Date: Mon, 4 Jun 2012 12:45:55 -0300 Subject: [Libav-user] Bug in drawtext (FT_LOAD_*)? Message-ID: Hello to all. I'm using the drawtext filter in a project and I couldn't use the ft_load_flags option. I'm using ffmpeg 0.11, but I also tested in 0.9.2 and from master branch. The results are the same. What I have to to is write the text using the FT_LOAD_MONOCHROME (defned in freetype.h), which print the text with opaque colors (there's no "translucid" pixels in the border of a glyph), but if i use, in the drawtext, the option "ft_load_flags=monochrome" the text is not rendered. The same for other flags. If I edit the filr vf_drawtext and change the line 202 (in 0.11) from: {"monochrome","set monochrome",0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_MONOCHROME},INT_MIN, INT_MAX, 0, "ft_load_flags" }, to: {"monochrome","set monochrome",0, AV_OPT_TYPE_CONST, {.dbl=FT_LOAD_RENDER|FT_LOAD_MONOCHROME},INT_MIN, INT_MAX, 0, "ft_load_flags" }, (I only added the FT_LOAD_RENDER flag) The option "ft_load_flags=monochrome" has the effect I expect and the text is correctly rendered. Reading the libavfilter documentation and the drawtext source code I couldn't find a way to use more than one parameter to ft_load_flags option. I think something like ft_load_flags=monochrome|render|etc should be useful. An easy test of the filter can be done with the parameter -vf 'drawtext=text=Text:fontsize=30:fontfile=/path/to/Font.ttf:ft_load_flags=monochrome' in ffmpeg of ffplay. This bug happens with all the ft_load_flags options with exception of "render", the only one which use the FT_LOAD_RENDER freetype flag. Am I using the filter in a wrong way or this bug really exists? -- ----- Sent from my Atari From klaussfreire at gmail.com Mon Jun 4 18:02:54 2012 From: klaussfreire at gmail.com (Claudio Freire) Date: Mon, 4 Jun 2012 13:02:54 -0300 Subject: [Libav-user] Re : Re : ALAC codec I am not sure it's really lossless In-Reply-To: <1338824334.61417.YahooMailNeo@web28905.mail.ir2.yahoo.com> References: <1338577123114-4655103.post@n4.nabble.com> <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> <1338824334.61417.YahooMailNeo@web28905.mail.ir2.yahoo.com> Message-ID: On Mon, Jun 4, 2012 at 12:38 PM, kurdy_ch-forum at yahoo.fr wrote: > @Claudio I was talking about stream MD5 not a file MD5 calculated afterward. > Have a look to flac documentation. Sweet, I didn't know flac had such a header. Nice. From jennyhoo668 at gmail.com Mon Jun 4 11:05:15 2012 From: jennyhoo668 at gmail.com (jennyhoo) Date: Mon, 4 Jun 2012 17:05:15 +0800 Subject: [Libav-user] Trying to compile ffmpeg for iOS Message-ID: I use build ffmpeg for iOS 5.1 successfully. bug when I try to link my application with the libraries this above script generates, I get the following: "ld: warning: ignoring file /Users/XXXXX/ffmpeg/ffmpeg/armv7/libavcodec.a, file was built for archive which is not the architecture being linked (armv7)" Why it's not creating ARM7 libraries? -------------- next part -------------- An HTML attachment was scrubbed... URL: From willyreinhardt at yahoo.fr Mon Jun 4 17:32:14 2012 From: willyreinhardt at yahoo.fr (Reinhardt Willy) Date: Mon, 4 Jun 2012 16:32:14 +0100 (BST) Subject: [Libav-user] Re : Re : ALAC codec I am not sure it's really lossless SOLVED In-Reply-To: References: <1338577123114-4655103.post@n4.nabble.com> <1338626095.56167.YahooMailNeo@web28901.mail.ir2.yahoo.com> Message-ID: <1338823934.39327.YahooMailNeo@web28904.mail.ir2.yahoo.com> Hello, Using the last version from http://ffmpeg.org/download.html? it wotks fine. The version is: > ffmpeg version 0.10.2-4:0.10.2-0ubuntu0jon1 Thanks @Claudio I was talking about stream MD5 have a look to flac documentation. -------------- next part -------------- An HTML attachment was scrubbed... URL: From yntnfu at 163.com Mon Jun 4 11:30:17 2012 From: yntnfu at 163.com (yntnfu) Date: Mon, 4 Jun 2012 02:30:17 -0700 (PDT) Subject: [Libav-user] How to compile FFmpeg for the IOS 5.1? Message-ID: <1338802217804-4655114.post@n4.nabble.com> Follow the thread I compile ffmpeg successfully: http://ffmpeg.org/pipermail/libav-user/2012-March/001621.html http://ffmpeg.org/pipermail/libav-user/2012-March/001621.html But when I try to link it with my program , it happens like this: "ld: warning: ignoring file /Users/XXXX/ffmpeg/ffmpeg/armv7/libavcodec.a, file was built for archive which is not the architecture being linked (armv7)" It seems that no ARM7 libraries created. How to fix this? -- View this message in context: http://libav-users.943685.n4.nabble.com/How-to-compile-FFmpeg-for-the-IOS-5-1-tp4655114.html Sent from the libav-users mailing list archive at Nabble.com. From yntnfu at 163.com Mon Jun 4 11:15:08 2012 From: yntnfu at 163.com (yntnfu) Date: Mon, 4 Jun 2012 02:15:08 -0700 (PDT) Subject: [Libav-user] Trying to compile ffmpeg for iOS In-Reply-To: References: <201203271323.00702.gkinsey@ad-holdings.co.uk> Message-ID: <1338801308001-4655113.post@n4.nabble.com> Hi, How do you fix the problem? I get the same problem as yours. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Trying-to-compile-ffmpeg-for-iOS-tp4500195p4655113.html Sent from the libav-users mailing list archive at Nabble.com. From wagner.patriota at gmail.com Mon Jun 4 20:46:57 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Mon, 4 Jun 2012 15:46:57 -0300 Subject: [Libav-user] Trying to compile ffmpeg for iOS In-Reply-To: References: Message-ID: try compile with this script: rm -r ./compiled echo Configure for armv7 build ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \ --target-os=darwin \ --arch=arm \ --cpu=cortex-a8 \ --extra-cflags='-arch armv7' \ --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \ --prefix=compiled/armv7 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install echo Configure for armv6 ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \ --target-os=darwin \ --arch=arm \ --cpu=arm1176jzf-s \ --extra-cflags='-arch armv6' \ --extra-ldflags='-arch armv6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \ --prefix=compiled/armv6 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install echo Configure for i386 ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk \ --target-os=darwin \ --arch=i386 \ --cpu=i386 \ --extra-cflags='-arch i386' \ --extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk' \ --prefix=compiled/i386 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install # make fat (universal) libs mkdir -p ./compiled/fat/lib lipo -output ./compiled/fat/lib/libavcodec.a -create \ -arch armv6 ./compiled/armv6/lib/libavcodec.a \ -arch armv7 ./compiled/armv7/lib/libavcodec.a \ -arch i386 ./compiled/i386/lib/libavcodec.a lipo -output ./compiled/fat/lib/libavdevice.a -create \ -arch armv6 ./compiled/armv6/lib/libavdevice.a \ -arch armv7 ./compiled/armv7/lib/libavdevice.a \ -arch i386 ./compiled/i386/lib/libavdevice.a lipo -output ./compiled/fat/lib/libavformat.a -create \ -arch armv6 ./compiled/armv6/lib/libavformat.a \ -arch armv7 ./compiled/armv7/lib/libavformat.a \ -arch i386 ./compiled/i386/lib/libavformat.a lipo -output ./compiled/fat/lib/libavutil.a -create \ -arch armv6 ./compiled/armv6/lib/libavutil.a \ -arch armv7 ./compiled/armv7/lib/libavutil.a \ -arch i386 ./compiled/i386/lib/libavutil.a lipo -output ./compiled/fat/lib/libswresample.a -create \ -arch armv6 ./compiled/armv6/lib/libswresample.a \ -arch armv7 ./compiled/armv7/lib/libswresample.a \ -arch i386 ./compiled/i386/lib/libswresample.a lipo -output ./compiled/fat/lib/libpostproc.a -create \ -arch armv6 ./compiled/armv6/lib/libpostproc.a \ -arch armv7 ./compiled/armv7/lib/libpostproc.a \ -arch i386 ./compiled/i386/lib/libpostproc.a lipo -output ./compiled/fat/lib/libswscale.a -create \ -arch armv6 ./compiled/armv6/lib/libswscale.a \ -arch armv7 ./compiled/armv7/lib/libswscale.a \ -arch i386 ./compiled/i386/lib/libswscale.a lipo -output ./compiled/fat/lib/libavfilter.a -create \ -arch armv6 ./compiled/armv6/lib/libavfilter.a \ -arch armv7 ./compiled/armv7/lib/libavfilter.a \ -arch i386 ./compiled/i386/lib/libavfilter.a On Mon, Jun 4, 2012 at 6:05 AM, jennyhoo wrote: > > I use build ffmpeg for iOS 5.1 successfully. > > > bug when I try to link my application with the libraries this above > script generates, I get the following: > > "ld: warning: ignoring file > /Users/XXXXX/ffmpeg/ffmpeg/armv7/libavcodec.a, file was built for > archive which is not the architecture being linked (armv7)" > > Why it's not creating ARM7 libraries? > > > > _______________________________________________ > 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 wagner.patriota at gmail.com Mon Jun 4 20:48:11 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Mon, 4 Jun 2012 15:48:11 -0300 Subject: [Libav-user] How to compile FFmpeg for the IOS 5.1? In-Reply-To: <1338802217804-4655114.post@n4.nabble.com> References: <1338802217804-4655114.post@n4.nabble.com> Message-ID: rm -r ./compiled echo Configure for armv7 build ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \ --target-os=darwin \ --arch=arm \ --cpu=cortex-a8 \ --extra-cflags='-arch armv7' \ --extra-ldflags='-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \ --prefix=compiled/armv7 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install echo Configure for armv6 ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk \ --target-os=darwin \ --arch=arm \ --cpu=arm1176jzf-s \ --extra-cflags='-arch armv6' \ --extra-ldflags='-arch armv6 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk' \ --prefix=compiled/armv6 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install echo Configure for i386 ./configure \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc \ --as='/usr/local/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc' \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk \ --target-os=darwin \ --arch=i386 \ --cpu=i386 \ --extra-cflags='-arch i386' \ --extra-ldflags='-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk' \ --prefix=compiled/i386 \ --enable-cross-compile \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug make clean make && make install # make fat (universal) libs mkdir -p ./compiled/fat/lib lipo -output ./compiled/fat/lib/libavcodec.a -create \ -arch armv6 ./compiled/armv6/lib/libavcodec.a \ -arch armv7 ./compiled/armv7/lib/libavcodec.a \ -arch i386 ./compiled/i386/lib/libavcodec.a lipo -output ./compiled/fat/lib/libavdevice.a -create \ -arch armv6 ./compiled/armv6/lib/libavdevice.a \ -arch armv7 ./compiled/armv7/lib/libavdevice.a \ -arch i386 ./compiled/i386/lib/libavdevice.a lipo -output ./compiled/fat/lib/libavformat.a -create \ -arch armv6 ./compiled/armv6/lib/libavformat.a \ -arch armv7 ./compiled/armv7/lib/libavformat.a \ -arch i386 ./compiled/i386/lib/libavformat.a lipo -output ./compiled/fat/lib/libavutil.a -create \ -arch armv6 ./compiled/armv6/lib/libavutil.a \ -arch armv7 ./compiled/armv7/lib/libavutil.a \ -arch i386 ./compiled/i386/lib/libavutil.a lipo -output ./compiled/fat/lib/libswresample.a -create \ -arch armv6 ./compiled/armv6/lib/libswresample.a \ -arch armv7 ./compiled/armv7/lib/libswresample.a \ -arch i386 ./compiled/i386/lib/libswresample.a lipo -output ./compiled/fat/lib/libpostproc.a -create \ -arch armv6 ./compiled/armv6/lib/libpostproc.a \ -arch armv7 ./compiled/armv7/lib/libpostproc.a \ -arch i386 ./compiled/i386/lib/libpostproc.a lipo -output ./compiled/fat/lib/libswscale.a -create \ -arch armv6 ./compiled/armv6/lib/libswscale.a \ -arch armv7 ./compiled/armv7/lib/libswscale.a \ -arch i386 ./compiled/i386/lib/libswscale.a lipo -output ./compiled/fat/lib/libavfilter.a -create \ -arch armv6 ./compiled/armv6/lib/libavfilter.a \ -arch armv7 ./compiled/armv7/lib/libavfilter.a \ -arch i386 ./compiled/i386/lib/libavfilter.a On Mon, Jun 4, 2012 at 6:30 AM, yntnfu wrote: > Follow the thread I compile ffmpeg successfully: > http://ffmpeg.org/pipermail/libav-user/2012-March/001621.html > http://ffmpeg.org/pipermail/libav-user/2012-March/001621.html > > But when I try to link it with my program , it happens like this: > "ld: warning: ignoring file > /Users/XXXX/ffmpeg/ffmpeg/armv7/libavcodec.a, file was built for > archive which is not the architecture being linked (armv7)" > > It seems that no ARM7 libraries created. > > How to fix this? > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/How-to-compile-FFmpeg-for-the-IOS-5-1-tp4655114.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 brado at bighillsoftware.com Tue Jun 5 00:36:31 2012 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 4 Jun 2012 15:36:31 -0700 Subject: [Libav-user] ffmpeg to publish to streaming server (Wowza) Message-ID: <77125812-5704-450C-9925-9389280BAD15@bighillsoftware.com> Hello, My use case: I need to programmatically (read: not from a console command line) capture video from a Mac's builtin video camera and publish that video to Wowza streaming server (clients talk to Wowza). I would like to use ffmpeg to transport the captured video from the camera to the Wowza server. A few notes on this: - For reasons that are non-negotiable (I cannot do anything about them), this video has to be published to Wowza for streaming. - Wowza supports the encoders based on the following: RTSP/RTP, RTMP, MPEG-TS. I am looking to use MPEG-TS for this. I have been scouring the Internet looking for any kind of code example which would demonstrate how to do this, or something near to this. I'm not having much luck. If anyone has a sample code chunk or can point me in the right direction, that would be great. Thanks in advance! Your help is appreciated. Brad Brad O'Hearne Founder / Lead Developer Big Hill Software LLC http://www.bighillsoftware.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jettoblack at gmail.com Tue Jun 5 03:00:06 2012 From: jettoblack at gmail.com (jettoblack) Date: Mon, 4 Jun 2012 18:00:06 -0700 (PDT) Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <20120601140652.GB3720@phare.normalesup.org> References: <1338507433079-4655098.post@n4.nabble.com> <20120601140652.GB3720@phare.normalesup.org> Message-ID: <1338858006138-4655124.post@n4.nabble.com> Hi Christian and Nicolas, Thanks for the input. I managed to get video encoding working and everything looks good there. The solution was to use the picture.best_effort_timestamp as the pts of encoded frame instead of the pkt.pts (since I have now learned that a pkt could contain 0 or more pictures, not necessarily one picture per packet). However I'm still having trouble with the audio, specifically resampling and encoding. If I simply pass the source audio through, it works ok. The call to avresample_convert() seems to work ok (returns a valid length). The first call to avcodec_encode_audio2() will succeed, but all subsequent calls after the first will return -22 (Illegal argument error). I'm not sure what argument is illegal especially since the first call succeeds. Does anyone have any ideas where I went wrong on the audio encoding part? I put the whole source code below. I'm looking forward to any suggestions. :) Thanks everyone! #include #include #include "libavformat/avformat.h" #include "libavcodec/avcodec.h" #include "libswscale/swscale.h" #include "libavresample/avresample.h" #include "libavutil/opt.h" int main (int argc, const char * argv[]) { const char *infile = argv[1]; const char *outfile = argv[2]; int r; int video_index = -1, audio_index = -1; // stream index AVPacket pkt; AVFrame *srcpic = NULL, *srcaudio = NULL; AVFormatContext *in = NULL, *out = NULL; AVCodecContext *in_vcodec, *in_acodec, *out_vcodec, *out_acodec; AVStream *in_vstream, *in_astream, *out_vstream, *out_astream; AVAudioResampleContext *avr; AVCodec *h264, *aac; int got_picture, got_audio; int video_frames = 0, audio_samples = 0; char errbuf[128]; struct SwsContext *img_convert_ctx; double framerate, samplerate; int got_packet_ptr = 0; int audio_bufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE; uint8_t *video_outbuf; int video_outbuf_size = 2000000; // TODO: is there a defined max size for encoded video buffer? uint8_t *picbuf; int picbuf_size; int64_t firstpts = -1; // init LAVF av_register_all(); avformat_network_init(); av_log_set_level(AV_LOG_VERBOSE); // Open input file printf("Open input file: %s\n", infile); r = avformat_open_input(&in, infile, NULL, NULL); if (r) { printf("err %x\n", r); return r; } r = avformat_find_stream_info(in, NULL); if (r) { printf("err %x\n", r); return r; } // iterate over input streams for (int i = 0; i < in->nb_streams; i++) { AVStream *inputStream = in->streams[i]; if (inputStream->codec->codec_type == AVMEDIA_TYPE_VIDEO) { inputStream->discard = AVDISCARD_NONE; video_index = i; in_vstream = inputStream; in_vcodec = inputStream->codec; if (!inputStream->codec->codec) { avcodec_open2(inputStream->codec, avcodec_find_decoder(inputStream->codec->codec_id), NULL); } printf("Input video %s rate %d/%d width %d height %d\n", in_vcodec->codec->name, inputStream->r_frame_rate.num, inputStream->r_frame_rate.den, in_vcodec->width, in_vcodec->height); } else if (inputStream->codec->codec_type == AVMEDIA_TYPE_AUDIO) { inputStream->discard = AVDISCARD_NONE; audio_index = i; in_astream = inputStream; in_acodec = inputStream->codec; if (!inputStream->codec->codec) { avcodec_open2(inputStream->codec, avcodec_find_decoder(inputStream->codec->codec_id), NULL); } printf("Input audio %s rate %d channels %d sample_format %d\n", in_acodec->codec->name, in_acodec->sample_rate, in_acodec->channels, in_acodec->sample_fmt); } else { inputStream->discard = AVDISCARD_ALL; } } assert(in_vcodec && in_acodec); // Open output file for writing out = avformat_alloc_context(); assert(out); out->oformat = av_guess_format(NULL, outfile, NULL); // Guess output container format based on file extension assert(out->oformat); // Output parameters // Video codec h264 = avcodec_find_encoder(CODEC_ID_H264); assert(h264); out_vcodec = avcodec_alloc_context3(h264); assert(out_vcodec); avcodec_get_context_defaults3(out_vcodec, h264); out_vcodec->bit_rate = 500000; out_vcodec->width = 640; out_vcodec->height = 360; out_vcodec->time_base.num = in_vstream->r_frame_rate.den; // time_base is 1/framerate out_vcodec->time_base.den = in_vstream->r_frame_rate.num; out_vcodec->gop_size = (int)round(av_q2d(in_vstream->r_frame_rate) / 2); // GOP size is framerate/2 out_vcodec->max_b_frames = 0; out_vcodec->coder_type = FF_CODER_TYPE_VLC; out_vcodec->pix_fmt = PIX_FMT_YUV420P; out_vcodec->profile = FF_PROFILE_H264_BASELINE; // TODO: set other codec parameters r = avcodec_open2(out_vcodec, h264, NULL); assert(!r); // Video stream out_vstream = avformat_new_stream(out, out_vcodec->codec); assert(out_vstream); out_vstream->codec = out_vcodec; out_vstream->r_frame_rate = in_vstream->r_frame_rate; framerate = av_q2d(out_vstream->r_frame_rate); // Audio codec aac = avcodec_find_encoder(CODEC_ID_MP2); assert(aac); out_acodec = avcodec_alloc_context3(aac); avcodec_get_context_defaults3(out_acodec, aac); assert(out_acodec); out_acodec->codec_id = aac->id; out_acodec->codec_type = AVMEDIA_TYPE_AUDIO; out_acodec->bit_rate = 128000; out_acodec->channels = 2; out_acodec->sample_rate = 48000; samplerate = out_acodec->sample_rate; out_acodec->sample_fmt = AV_SAMPLE_FMT_S16; out_acodec->channel_layout = av_get_channel_layout("stereo"); out_acodec->time_base = in_acodec->time_base; // TODO: set other codec parameters r = avcodec_open2(out_acodec, aac, NULL); assert(!r); // Audio stream out_astream = avformat_new_stream(out, out_acodec->codec); assert(out_astream); out_astream->codec = out_acodec; // Begin writing output file printf("Open output file: %s\nOutput container: %s\n", outfile, out->oformat->long_name); r = avio_open2(&out->pb, outfile, AVIO_FLAG_WRITE, NULL, NULL); if (r) { printf("err %x\n", r); return r; } printf("write out header\n"); r = avformat_write_header(out, NULL); if (r) { printf("err %x\n", r); return r; } // show output streams for (int i = 0; i < out->nb_streams; i++) { AVStream *outputStream = out->streams[i]; if (outputStream->codec && outputStream->codec->codec) { printf("Output stream %d: %s %d/%d ", i, outputStream->codec->codec->name, outputStream->time_base.num, outputStream->time_base.den); if (outputStream->codec->codec_type == AVMEDIA_TYPE_VIDEO) printf("width %d height %d bitrate %d\n", outputStream->codec->width, outputStream->codec->height, outputStream->codec->bit_rate); if (outputStream->codec->codec_type == AVMEDIA_TYPE_AUDIO) printf("channels %d sample_rate %d bitrate %d\n", outputStream->codec->channels, outputStream->codec->sample_rate, outputStream->codec->bit_rate); } else printf("Output stream %d: %d/%d\n", i, outputStream->time_base.num, outputStream->time_base.den); } // buffer for encoded video data video_outbuf = (uint8_t*)av_malloc(video_outbuf_size); assert(video_outbuf); img_convert_ctx = sws_getContext(in_vcodec->width, in_vcodec->height, in_vcodec->pix_fmt, out_vcodec->width, out_vcodec->height, out_vcodec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL); assert(img_convert_ctx); // buffer for picture data picbuf_size = avpicture_get_size(out_vcodec->pix_fmt, out_vcodec->width, out_vcodec->height); picbuf = (uint8_t*)av_malloc(picbuf_size); assert(picbuf); // setup resample context avr = avresample_alloc_context(); av_opt_set_int(avr, "in_channel_layout", in_acodec ->channel_layout, 0); av_opt_set_int(avr, "out_channel_layout", out_acodec->channel_layout, 0); av_opt_set_int(avr, "in_sample_fmt", in_acodec ->sample_fmt, 0); av_opt_set_int(avr, "out_sample_fmt", out_acodec->sample_fmt, 0); av_opt_set_int(avr, "in_sample_rate", in_acodec ->sample_rate, 0); av_opt_set_int(avr, "out_sample_rate", out_acodec->sample_rate, 0); av_opt_set_int(avr, "in_channels", in_acodec ->channels, 0); av_opt_set_int(avr, "out_channels", out_acodec->channels, 0); r = avresample_open(avr); assert(!r); printf("begin input loop\n"); while (1) { av_init_packet(&pkt); r = av_read_frame(in, &pkt); if (r) { if (r == AVERROR_EOF) printf("EOF\n"); else printf("read error %x\n", r); break; } printf("src pkt stream %d, pts %"PRId64", dts %"PRId64"\n", pkt.stream_index, pkt.pts, pkt.dts); if (firstpts == -1 && pkt.pts != AV_NOPTS_VALUE) firstpts = pkt.pts; if (pkt.stream_index == in_vstream->index) { srcpic = avcodec_alloc_frame(); assert(srcpic); avcodec_get_frame_defaults(srcpic); got_picture = 0; r = avcodec_decode_video2(in_vcodec, srcpic, &got_picture, &pkt); if (r < 0) { av_strerror(r, errbuf, 128); printf("video decode error %d %s\n", r, errbuf); break; } else if (got_picture) { AVPacket newpkt; AVFrame *destpic; av_init_packet(&newpkt); destpic = avcodec_alloc_frame(); got_packet_ptr = 0; printf("got picture: best_effort_timestamp %"PRId64"\n", srcpic->best_effort_timestamp); // convert picture to dest format avpicture_fill((AVPicture*)destpic, picbuf, out_vcodec->pix_fmt, out_vcodec->width, out_vcodec->height); sws_scale(img_convert_ctx, (const uint8_t* const*)srcpic->data, srcpic->linesize, 0, in_vcodec->height, destpic->data, destpic->linesize); // set destpic PTS if (srcpic->best_effort_timestamp != AV_NOPTS_VALUE) destpic->pts = av_rescale_q(srcpic->best_effort_timestamp, in_vstream->time_base, out_vstream->time_base); else destpic->pts = (int)((double)video_frames * (90000.0/framerate)); // TODO: not always 90k // encode picture r = avcodec_encode_video2(out_vcodec, &newpkt, destpic, &got_packet_ptr); if (r < 0) { av_strerror(r, errbuf, 128); printf("video encode error %d %s\n", r, errbuf); } else if (got_packet_ptr) { // write packet newpkt.stream_index = out_vstream->index; printf("write video pkt: stream %d, pts %"PRId64", dts %"PRId64"\n", newpkt.stream_index, newpkt.pts, newpkt.dts); r = av_interleaved_write_frame(out, &newpkt); if (r && (r != AVERROR(EINVAL))) { printf("video write error %x\n", r); } assert(!r); } av_free_packet(&newpkt); av_free(destpic); video_frames++; } av_free(srcpic); } else if (pkt.stream_index == in_astream->index) { // decode audio srcaudio = avcodec_alloc_frame(); avcodec_get_frame_defaults(srcaudio); got_audio = 0; r = avcodec_decode_audio4(in_acodec, srcaudio, &got_audio, &pkt); if (r < 0) { av_strerror(r, errbuf, 128); printf("audio decode error %d %s\n", r, errbuf); break; } else if (got_audio) { // convert audio AVPacket newpkt; AVFrame *destaudio; // frame for resampled audio int nb_samples; av_init_packet(&newpkt); destaudio = avcodec_alloc_frame(); avcodec_get_frame_defaults(destaudio); destaudio->extended_data = av_malloc(sizeof(uint8_t*)); destaudio->extended_data[0] = av_malloc(audio_bufsize); got_packet_ptr = 0; printf("srcaudio linesize[0]=%d nb_samples=%d\n", srcaudio->linesize[0], srcaudio->nb_samples); // resample to dest format nb_samples = avresample_convert(avr, (void**)destaudio->extended_data, destaudio->linesize[0], audio_bufsize, (void**)srcaudio->extended_data, srcaudio->linesize[0], srcaudio->nb_samples); if (nb_samples < 0) { av_strerror(nb_samples, errbuf, 128); printf("avr error %d %s\n", nb_samples, errbuf); } printf("avr ret len %d\n", nb_samples); if (srcaudio->best_effort_timestamp != AV_NOPTS_VALUE) destaudio->pts = av_rescale_q(srcaudio->best_effort_timestamp, in_astream->time_base, out_astream->time_base); else destaudio->pts = firstpts + (int)((double)audio_samples * (90000.0/samplerate)); printf("destaudio pts %"PRId64"\n", destaudio->pts); // why does this return -22 after the first successfull call? r = avcodec_encode_audio2(out_acodec, &newpkt, destaudio, &got_packet_ptr); if (r < 0) { av_strerror(r, errbuf, 128); printf("audio encode error %d %s\n", r, errbuf); } else if (got_packet_ptr) { // write frame newpkt.stream_index = out_astream->index; newpkt.flags |= AV_PKT_FLAG_KEY; printf("write audio pkt: stream %d, pts %"PRId64", dts %"PRId64"\n", newpkt.stream_index, newpkt.pts, newpkt.dts); r = av_interleaved_write_frame(out, &newpkt); if (r && (r != AVERROR(EINVAL))) { printf("audio write error %x\n", r); } } av_free(destaudio->extended_data[0]); av_free(destaudio->extended_data); av_free(destaudio); av_free_packet(&newpkt); audio_samples += nb_samples; } av_free(srcaudio); } av_free_packet(&pkt); } // Flush any remaining encoded data // encode picture av_free_packet(&pkt); printf("Flush video packets\n"); while (1) { av_init_packet(&pkt); got_packet_ptr = 0; r = avcodec_encode_video2(out_vcodec, &pkt, NULL, &got_packet_ptr); if (r < 0) { av_strerror(r, errbuf, 128); printf("video encode error %d %s\n", r, errbuf); break; } else if (got_packet_ptr) { // write packet pkt.stream_index = out_vstream->index; printf("write video pkt: stream %d, pts %"PRId64", dts %"PRId64"\n", pkt.stream_index, pkt.pts, pkt.dts); r = av_interleaved_write_frame(out, &pkt); if (r && (r != AVERROR(EINVAL))) { printf("video write error %x\n", r); } assert(!r); } else if (r == 0) { break; } av_free_packet(&pkt); } av_free_packet(&pkt); // flush audio printf("Flush audio packets\n"); while (1) { av_init_packet(&pkt); got_packet_ptr = 0; r = avcodec_encode_audio2(out_acodec, &pkt, NULL, &got_packet_ptr); if (r < 0) { av_strerror(r, errbuf, 128); printf("audio encode error %d %s\n", r, errbuf); break; } else if (got_packet_ptr) { // write packet pkt.stream_index = out_astream->index; printf("write audio pkt: stream %d, pts %"PRId64", dts %"PRId64"\n", pkt.stream_index, pkt.pts, pkt.dts); r = av_interleaved_write_frame(out, &pkt); if (r && (r != AVERROR(EINVAL))) { printf("audio write error %x\n", r); } assert(!r); } else if (r == 0) { break; } av_free_packet(&pkt); } av_free_packet(&pkt); av_free(picbuf); av_free(video_outbuf); avcodec_close(in_vcodec); avcodec_close(in_acodec); avcodec_close(out_vcodec); avcodec_close(out_acodec); // TODO: anything else to free/close? r = av_write_trailer(out); if (r) { printf("error closing output %x\n", r); } avformat_close_input(&in); printf("Wrote output file: %s\n", outfile); return 0; } -- View this message in context: http://libav-users.943685.n4.nabble.com/Example-for-recompressing-a-video-tp4655098p4655124.html Sent from the libav-users mailing list archive at Nabble.com. From yntnfu at 163.com Tue Jun 5 03:06:30 2012 From: yntnfu at 163.com (yntnfu) Date: Mon, 4 Jun 2012 18:06:30 -0700 (PDT) Subject: [Libav-user] How to compile FFmpeg for the IOS 5.1? In-Reply-To: References: <1338802217804-4655114.post@n4.nabble.com> Message-ID: <1338858390291-4655125.post@n4.nabble.com> Thanks ,Wagner Patriota. Do you mean that I must make a fat lib which can link successfully by armv7? -- View this message in context: http://libav-users.943685.n4.nabble.com/How-to-compile-FFmpeg-for-the-IOS-5-1-tp4655114p4655125.html Sent from the libav-users mailing list archive at Nabble.com. From susiriss at gmail.com Tue Jun 5 04:16:08 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Tue, 05 Jun 2012 07:46:08 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details Message-ID: <4FCD6BE8.7030104@gmail.com> Hi All, I am using libswscale to do some YUV - RGB conversion back and forth. There are 2 steps performed on an image. 1. RGB - YUV conversion 2. YUV - RGB conversion Issue is that in the image output from step 2, the right edge of the image is missing, means the pixels are black. The rest of the image seems ok compared to original image. This black edge is roughly 5-10 pixels wide and varies depending on the size of the image. This issue happens for images with certain dimensions. For some images this issue does not appear. So I guess this is due to libswscale issue or the way i'm using it is wrong. Also I get a libswscale warning on this conversion. [swscaler @ 0x1768020] Warning: data is not aligned! This can lead to a speedloss If I analyze the Y values along the right edge, I can see that they have valid values, so I deduce this is an issue arising from step 2 (YUV to RGB). My code (truncated for clarity) looks like follows for each step. Step 1. RGB- YUV conversion.---------------------------- // Create YUV buffer m_bufferSize = avpicture_get_size(PIX_FMT_YUV420P, width, height); avPictureInfo_ = avcodec_alloc_frame(); m_buffer = (uint8_t *)av_malloc(m_bufferSize); avpicture_fill((AVPicture*)avPictureInfo_, m_buffer, PIX_FMT_YUV420P, width, height); // Then fill it with RGB data struct SwsContext *img_convert_ctx = sws_getContext(m_width, m_height, PIX_FMT_RGB24, m_width, m_height, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL); if (img_convert_ctx == NULL) { return NULL; } uint8_t * srcData[4] = {m_buffer, 0, 0, 0}; int srcLineSize[4] = {m_width * 3 * sizeof(uint8_t), 0, 0, 0}; sws_scale(img_convert_ctx, srcData, srcLineSize, 0, m_height, yuvImage->avPictureInfo_->data, yuvImage->avPictureInfo_->linesize); free(img_convert_ctx); Step 2: YUV - RGB conversion -------------------------------------------------- m_bufferSize = avpicture_get_size(PIX_FMT_RGB24, width, height); m_buffer = (uint8_t *)av_malloc(m_bufferSize); struct SwsContext *img_convert_ctx = sws_getContext(m_width, m_height, PIX_FMT_YUV420P, m_width, m_height, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); if (img_convert_ctx == NULL) { return NULL; } AVFrame * rgbPictInfo = avcodec_alloc_frame(); avpicture_fill((AVPicture*)rgbPictInfo, rgbImage->m_buffer, PIX_FMT_RGB24, m_width, m_height); sws_scale(img_convert_ctx, avPictureInfo_->data, avPictureInfo_->linesize, 0, m_height, rgbPictInfo->data, rgbPictInfo->linesize); ----------------------------------------------- I am using libav functions to allocate memory etc, so they should take care of alignment. So why does libswscale complain about not aligned data? Why are pixels missing along in the right edge of the image? I'm also attaching two images from step 1 and 2. Please help! -Sampath -------------- next part -------------- A non-text attachment was scrubbed... Name: ref.ppm Type: image/x-portable-pixmap Size: 4333 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ref-yuv.ppm Type: image/x-portable-pixmap Size: 4333 bytes Desc: not available URL: From wagner.patriota at gmail.com Tue Jun 5 05:55:40 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Tue, 5 Jun 2012 00:55:40 -0300 Subject: [Libav-user] How to compile FFmpeg for the IOS 5.1? In-Reply-To: <1338858390291-4655125.post@n4.nabble.com> References: <1338802217804-4655114.post@n4.nabble.com> <1338858390291-4655125.post@n4.nabble.com> Message-ID: yes, sure... or you can remove the --arch parameters from the lipo and leave only the architetures you need. On Mon, Jun 4, 2012 at 10:06 PM, yntnfu wrote: > Thanks ,Wagner Patriota. Do you mean that I must make a fat lib which can > link successfully by armv7? > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/How-to-compile-FFmpeg-for-the-IOS-5-1-tp4655114p4655125.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 krishnaks at iwavesystems.com Tue Jun 5 06:40:49 2012 From: krishnaks at iwavesystems.com (krishnaks at iwavesystems.com) Date: Tue, 5 Jun 2012 10:10:49 +0530 Subject: [Libav-user] Libavcodec h264 decoder warnings Message-ID: <65a0fc543ad075866d300ac4ebff20a6.squirrel@124.124.219.233> Hi, I am using libavcodec for h264 decoding. It is working fine.But when i am running my application for long run i will ge following debug prints on my console & will added propagation delay. My application is receiving the h264 frames from live camera(RTSP/rtp live streaming using live555). [h264 @ 0x1319c00] Increasing reorder buffer to 1 [h264 @ 0x1319c00] concealing 66 DC, 66 AC, 66 MV errors [h264 @ 0x1319c00] concealing 67 DC, 67 AC, 67 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 9 11 [h264 @ 0x1319c00] error while decoding MB 9 11 [h264 @ 0x1319c00] concealing 895 DC, 895 AC, 895 MV errors [h264 @ 0x1319c00] negative number of zero coeffs at 30 12 [h264 @ 0x1319c00] error while decoding MB 30 12 [h264 @ 0x1319c00] concealing 829 DC, 829 AC, 829 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 27 9 [h264 @ 0x1319c00] error while decoding MB 27 9 [h264 @ 0x1319c00] concealing 967 DC, 967 AC, 967 MV errors [h264 @ 0x1319c00] concealing 103 DC, 103 AC, 103 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 33 12 [h264 @ 0x1319c00] error while decoding MB 33 12 [h264 @ 0x1319c00] concealing 826 DC, 826 AC, 826 MV errors [h264 @ 0x1319c00] left block unavailable for requested intra mode at 0 13 [h264 @ 0x1319c00] error while decoding MB 0 13 [h264 @ 0x1319c00] concealing 814 DC, 814 AC, 814 MV errors [h264 @ 0x1319c00] concealing 150 DC, 150 AC, 150 MV errors Not in order [h264 @ 0x1319c00] concealing 110 DC, 110 AC, 110 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 18 19 [h264 @ 0x1319c00] error while decoding MB 18 19 [h264 @ 0x1319c00] concealing 526 DC, 526 AC, 526 MV errors [h264 @ 0x1319c00] corrupted macroblock 33 29 (total_coeff=-1) [h264 @ 0x1319c00] error while decoding MB 33 29 [h264 @ 0x1319c00] concealing 61 DC, 61 AC, 61 MV errors [h264 @ 0x1319c00] mb_type 48 in I slice too large at 8 13 [h264 @ 0x1319c00] error while decoding MB 8 13 [h264 @ 0x1319c00] concealing 806 DC, 806 AC, 806 MV errors [h264 @ 0x1319c00] concealing 62 DC, 62 AC, 62 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 44 12 [h264 @ 0x1319c00] error while decoding MB 44 12 [h264 @ 0x1319c00] concealing 815 DC, 815 AC, 815 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 14 24 [h264 @ 0x1319c00] error while decoding MB 14 24 [h264 @ 0x1319c00] concealing 305 DC, 305 AC, 305 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 9 13 [h264 @ 0x1319c00] error while decoding MB 9 13 [h264 @ 0x1319c00] concealing 805 DC, 805 AC, 805 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 0 13 [h264 @ 0x1319c00] error while decoding MB 0 13 [h264 @ 0x1319c00] concealing 814 DC, 814 AC, 814 MV errors [h264 @ 0x1319c00] concealing 81 DC, 81 AC, 81 MV errors [h264 @ 0x1319c00] negative number of zero coeffs at 16 13 [h264 @ 0x1319c00] error while decoding MB 16 13 [h264 @ 0x1319c00] concealing 798 DC, 798 AC, 798 MV errors [h264 @ 0x1319c00] concealing 121 DC, 121 AC, 121 MV errors [h264 @ 0x1319c00] mb_type 99 in I slice too large at 19 11 [h264 @ 0x1319c00] error while decoding MB 19 11 [h264 @ 0x1319c00] concealing 885 DC, 885 AC, 885 MV errors [h264 @ 0x1319c00] concealing 148 DC, 148 AC, 148 MV errors [h264 @ 0x1319c00] left block unavailable for requested intra mode at 0 19 [h264 @ 0x1319c00] error while decoding MB 0 19 [h264 @ 0x1319c00] concealing 544 DC, 544 AC, 544 MV errors [h264 @ 0x1319c00] Increasing reorder buffer to 16 [h264 @ 0x1319c00] concealing 59 DC, 59 AC, 59 MV errors [h264 @ 0x1319c00] negative number of zero coeffs at 28 18 [h264 @ 0x1319c00] error while decoding MB 28 18 [h264 @ 0x1319c00] concealing 561 DC, 561 AC, 561 MV errors [h264 @ 0x1319c00] concealing 137 DC, 137 AC, 137 MV errors [h264 @ 0x1319c00] concealing 57 DC, 57 AC, 57 MV errors [h264 @ 0x1319c00] concealing 626 DC, 626 AC, 626 MV errors [h264 @ 0x1319c00] concealing 61 DC, 61 AC, 61 MV errors [h264 @ 0x1319c00] mb_type 180 in I slice too large at 44 8 [h264 @ 0x1319c00] error while decoding MB 44 8 [h264 @ 0x1319c00] concealing 995 DC, 995 AC, 995 MV errors [h264 @ 0x1319c00] concealing 106 DC, 106 AC, 106 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 38 24 [h264 @ 0x1319c00] error while decoding MB 38 24 [h264 @ 0x1319c00] concealing 281 DC, 281 AC, 281 MV errors [h264 @ 0x1319c00] corrupted macroblock 36 29 (total_coeff=-1) [h264 @ 0x1319c00] error while decoding MB 36 29 [h264 @ 0x1319c00] concealing 58 DC, 58 AC, 58 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 12 9 [h264 @ 0x1319c00] error while decoding MB 12 9 [h264 @ 0x1319c00] concealing 982 DC, 982 AC, 982 MV errors [h264 @ 0x1319c00] negative number of zero coeffs at 21 12 [h264 @ 0x1319c00] error while decoding MB 21 12 [h264 @ 0x1319c00] concealing 838 DC, 838 AC, 838 MV errors [h264 @ 0x1319c00] concealing 56 DC, 56 AC, 56 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 41 7 [h264 @ 0x1319c00] error while decoding MB 41 7 [h264 @ 0x1319c00] concealing 1043 DC, 1043 AC, 1043 MV errors [h264 @ 0x1319c00] Invalid level prefix [h264 @ 0x1319c00] error while decoding MB 38 29 [h264 @ 0x1319c00] concealing 56 DC, 56 AC, 56 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 33 14 [h264 @ 0x1319c00] error while decoding MB 33 14 [h264 @ 0x1319c00] concealing 736 DC, 736 AC, 736 MV errors [h264 @ 0x1319c00] concealing 95 DC, 95 AC, 95 MV errors [h264 @ 0x1319c00] cbp too large (2119) at 20 7 [h264 @ 0x1319c00] error while decoding MB 20 7 [h264 @ 0x1319c00] concealing 1064 DC, 1064 AC, 1064 MV errors [h264 @ 0x1319c00] concealing 52 DC, 52 AC, 52 MV errors [h264 @ 0x1319c00] corrupted macroblock 18 7 (total_coeff=-1) [h264 @ 0x1319c00] error while decoding MB 18 7 [h264 @ 0x1319c00] concealing 1066 DC, 1066 AC, 1066 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 16 8 [h264 @ 0x1319c00] error while decoding MB 16 8 [h264 @ 0x1319c00] concealing 1023 DC, 1023 AC, 1023 MV errors [h264 @ 0x1319c00] concealing 101 DC, 101 AC, 101 MV errors [h264 @ 0x1319c00] negative number of zero coeffs at 4 26 [h264 @ 0x1319c00] error while decoding MB 4 26 [h264 @ 0x1319c00] concealing 225 DC, 225 AC, 225 MV errors [h264 @ 0x1319c00] concealing 55 DC, 55 AC, 55 MV errors [h264 @ 0x1319c00] mb_type 63 in I slice too large at 30 8 [h264 @ 0x1319c00] error while decoding MB 30 8 [h264 @ 0x1319c00] concealing 1009 DC, 1009 AC, 1009 MV errors [h264 @ 0x1319c00] concealing 55 DC, 55 AC, 55 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 6 8 [h264 @ 0x1319c00] error while decoding MB 6 8 [h264 @ 0x1319c00] concealing 1033 DC, 1033 AC, 1033 MV errors [h264 @ 0x1319c00] concealing 66 DC, 66 AC, 66 MV errors [h264 @ 0x1319c00] out of range intra chroma pred mode at 9 8 [h264 @ 0x1319c00] error while decoding MB 9 8 [h264 @ 0x1319c00] concealing 1030 DC, 1030 AC, 1030 MV errors Thanks in advance KP From cehoyos at ag.or.at Tue Jun 5 08:58:23 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Jun 2012 06:58:23 +0000 (UTC) Subject: [Libav-user] Coversion from YUV to RGB loss of image details References: <4FCD6BE8.7030104@gmail.com> Message-ID: Sampath Subasinghe writes: > 1. RGB - YUV conversion > 2. YUV - RGB conversion > > Issue is that in the image output from step 2, the right > edge of the image is missing, means the pixels are black. Is this also reproducible if you use ffmpeg (the application)? If yes, please provide a command line and complete, uncut console output. Carl Eugen From krishnaks at iwavesystems.com Tue Jun 5 09:32:26 2012 From: krishnaks at iwavesystems.com (krishnaks at iwavesystems.com) Date: Tue, 5 Jun 2012 13:02:26 +0530 Subject: [Libav-user] Reoder Buffer Configuration Message-ID: Hi, I am getting Following warning during h264 decoding using libavcodec: Increasing reorder buffer to 1 Increasing reorder buffer to 16 Can I avoid this warning? Size of the frame reordering buffer in the decoder is set by libavdodec itself. What is the reason for this warning? Thanks in advance KP From alexcohn at netvision.net.il Tue Jun 5 10:20:46 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 5 Jun 2012 11:20:46 +0300 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: <4FCD6BE8.7030104@gmail.com> References: <4FCD6BE8.7030104@gmail.com> Message-ID: On Tue, Jun 5, 2012 at 5:16 AM, Sampath Subasinghe wrote: > Hi All, > I am using libswscale to do some YUV - RGB conversion back and > forth. There are 2 steps performed on an image. > > 1. RGB - YUV conversion > 2. YUV - RGB conversion > > Issue is that in the image output from step 2, the right edge of the image > is missing, means the pixels are black. The rest of the image seems ok > compared to original image. This black edge is roughly 5-10 pixels wide and > varies depending on the size of the image. This issue happens for images > with certain dimensions. For some images this issue does not appear. So I > guess this is due to libswscale issue or the way i'm using it is wrong. > Also I get a libswscale warning on this conversion. > > [swscaler @ 0x1768020] Warning: data is not aligned! This can lead to a > speedloss > > If I analyze the Y values along the right edge, I can see that they have > valid values, so I deduce this is an issue arising from step 2 (YUV to > RGB). My code (truncated for clarity) looks like follows for each step. > > Step 1. RGB- YUV conversion.-------------------**--------- > > // Create YUV buffer > m_bufferSize = avpicture_get_size(PIX_FMT_**YUV420P, width, height); > avPictureInfo_ = avcodec_alloc_frame(); > m_buffer = (uint8_t *)av_malloc(m_bufferSize); > > avpicture_fill((AVPicture*)**avPictureInfo_, m_buffer, PIX_FMT_YUV420P, > width, height); > > // Then fill it with RGB data > struct SwsContext *img_convert_ctx = sws_getContext(m_width, m_height, > PIX_FMT_RGB24, > m_width, m_height, > PIX_FMT_YUV420P, SWS_BICUBIC, > NULL, NULL, NULL); > > if (img_convert_ctx == NULL) { > return NULL; > } > > uint8_t * srcData[4] = {m_buffer, 0, 0, 0}; > int srcLineSize[4] = {m_width * 3 * sizeof(uint8_t), 0, 0, 0}; > sws_scale(img_convert_ctx, srcData, srcLineSize, 0, > m_height, yuvImage->avPictureInfo_->**data, > yuvImage->avPictureInfo_->**linesize); > > free(img_convert_ctx); > > Step 2: YUV - RGB conversion ------------------------------** > -------------------- > > m_bufferSize = avpicture_get_size(PIX_FMT_**RGB24, width, height); > m_buffer = (uint8_t *)av_malloc(m_bufferSize); > > struct SwsContext *img_convert_ctx = sws_getContext(m_width, m_height, > PIX_FMT_YUV420P, > m_width, m_height, > PIX_FMT_RGB24, SWS_BICUBIC, > NULL, NULL, NULL); > > if (img_convert_ctx == NULL) { > return NULL; > } > > > AVFrame * rgbPictInfo = avcodec_alloc_frame(); > avpicture_fill((AVPicture*)**rgbPictInfo, rgbImage->m_buffer, > PIX_FMT_RGB24, > m_width, m_height); > sws_scale(img_convert_ctx, avPictureInfo_->data, > avPictureInfo_->linesize, 0, > m_height, rgbPictInfo->data, rgbPictInfo->linesize); > > ------------------------------**----------------- > > I am using libav functions to allocate memory etc, so they should take > care of alignment. So why does libswscale complain about not aligned data? > Why are pixels missing along in the right edge of the image? I'm also > attaching two images from step 1 and 2. > > Please help! > -Sampath Your example is 45 pixel wide. It is a natural limitation of YUV_420P images that the dimensions should divide 2, or even 4. You also have SWS_BICUBIC that requires more alignment on the edges. Sincerely, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexcohn at netvision.net.il Tue Jun 5 10:25:17 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 5 Jun 2012 11:25:17 +0300 Subject: [Libav-user] Reoder Buffer Configuration In-Reply-To: References: Message-ID: On Tue, Jun 5, 2012 at 10:32 AM, wrote: > Hi, > > I am getting Following warning during h264 decoding using libavcodec: > > Increasing reorder buffer to 1 > Increasing reorder buffer to 16 > > Can I avoid this warning? > Size of the frame reordering buffer in the decoder is set by libavdodec > itself. > What is the reason for this warning? > > Thanks in advance > KP > On the faceo f it, your input stream contains B-frames, but the headers do not declare that, so ffmpeg adapts its decoder on the fly. You should not worry about this, unless the result is not satisfactory. Sincerely, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefasab at gmail.com Tue Jun 5 10:48:39 2012 From: stefasab at gmail.com (Stefano Sabatini) Date: Tue, 5 Jun 2012 10:48:39 +0200 Subject: [Libav-user] Bug in drawtext (FT_LOAD_*)? In-Reply-To: References: Message-ID: <20120605084839.GA2429@arborea> On date Monday 2012-06-04 12:45:55 -0300, Leandro Santiago encoded: > Hello to all. I'm using the drawtext filter in a project and I > couldn't use the ft_load_flags option. I'm using ffmpeg 0.11, but I > also tested in 0.9.2 and from master branch. The results are the same. > > What I have to to is write the text using the FT_LOAD_MONOCHROME > (defned in freetype.h), which print the text with opaque colors > (there's no "translucid" pixels in the border of a glyph), but if i > use, in the drawtext, the option "ft_load_flags=monochrome" the text > is not rendered. The same for other flags. > > If I edit the filr vf_drawtext and change the line 202 (in 0.11) from: > > {"monochrome","set monochrome",0, AV_OPT_TYPE_CONST, > {.dbl=FT_LOAD_MONOCHROME},INT_MIN, INT_MAX, 0, "ft_load_flags" }, > > to: > > {"monochrome","set monochrome",0, AV_OPT_TYPE_CONST, > {.dbl=FT_LOAD_RENDER|FT_LOAD_MONOCHROME},INT_MIN, INT_MAX, 0, > "ft_load_flags" }, > > (I only added the FT_LOAD_RENDER flag) > > The option "ft_load_flags=monochrome" has the effect I expect and the > text is correctly rendered. ft_load_flags=+monochrome will add the flag to the default value. > > Reading the libavfilter documentation and the drawtext source code I > couldn't find a way to use more than one parameter to ft_load_flags > option. I think something like ft_load_flags=monochrome|render|etc > should be useful. This is ft_load_flags=monochrome+render+... Note that this is a standard feature of the ffmpeg parser, I don't know if this is documented somewhere, you're welcome to create an issue on trac if not or to add an example to the drawtext documentation. > An easy test of the filter can be done with the parameter -vf > 'drawtext=text=Text:fontsize=30:fontfile=/path/to/Font.ttf:ft_load_flags=monochrome' > in ffmpeg of ffplay. This bug happens with all the ft_load_flags > options with exception of "render", the only one which use the > FT_LOAD_RENDER freetype flag. > > Am I using the filter in a wrong way or this bug really exists? From nicolas.george at normalesup.org Tue Jun 5 10:50:59 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Tue, 5 Jun 2012 10:50:59 +0200 Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <1338858006138-4655124.post@n4.nabble.com> References: <1338507433079-4655098.post@n4.nabble.com> <20120601140652.GB3720@phare.normalesup.org> <1338858006138-4655124.post@n4.nabble.com> Message-ID: <20120605085059.GC7585@phare.normalesup.org> Le septidi 17 prairial, an CCXX, jettoblack a ?crit?: > Thanks for the input. I managed to get video encoding working and > everything looks good there. The solution was to use the > picture.best_effort_timestamp as the pts of encoded frame instead of the This is the right choice. Also, please note that: * Code outside libavcodec should access this field using: * av_frame_get_best_effort_timestamp(frame) > pkt.pts (since I have now learned that a pkt could contain 0 or more > pictures, not necessarily one picture per packet). It should not, as libavutil splits the format-level packets into frame (provided it has a parser). But the frame you get from avcodec_decode_video42() is not necessarily the one encoded by the packet you just gave it, so the PTS do not match. > However I'm still having trouble with the audio, specifically resampling and > encoding. If I simply pass the source audio through, it works ok. The call > to avresample_convert() seems to work ok (returns a valid length). The > first call to avcodec_encode_audio2() will succeed, but all subsequent calls > after the first will return -22 (Illegal argument error). I'm not sure what > argument is illegal especially since the first call succeeds. > > Does anyone have any ideas where I went wrong on the audio encoding part? I > put the whole source code below. I'm looking forward to any suggestions. :) You should start by trimming your code to the bare minimum exhibiting the bad behaviour. Your current code is quite long, and seems to have accumulated some dead code (I see video_outbuf allocated but never used). Reviewing it in this state would be tiring and not very productive effort. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From susiriss at gmail.com Tue Jun 5 11:01:58 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Tue, 5 Jun 2012 14:31:58 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> Message-ID: > Your example is 45 pixel wide. > > It is a natural limitation of YUV_420P images that the dimensions should > divide 2, or even 4. You also have SWS_BICUBIC that requires more alignment > on the edges. > Thanks Alex. I was under the impression that these will get handled by the libswscale itself. I also did not know the fact about the special requirements for SWS_BICUBIC. As Carl, mentioned I will try to reproduce this with ffmpeg itself and close this. Thanks Alex and Carl. -- ~Sampath~ -------------- next part -------------- An HTML attachment was scrubbed... URL: From nitinkumgoyal at gmail.com Tue Jun 5 12:04:46 2012 From: nitinkumgoyal at gmail.com (NITIN GOYAL) Date: Tue, 5 Jun 2012 15:34:46 +0530 Subject: [Libav-user] Detecting black/dark frames in FFMPEG Message-ID: Hi Is there any way i can modify or use the ffmpeg library to detect the black/dark/green frames from the content? Theoretically, we can do it by calculating the luminance of each frame and finding with higher values but i am thinking if that can be done through ffmpeg? Any sort of advice on this?? Regards Nitin -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 5 12:19:33 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Jun 2012 10:19:33 +0000 (UTC) Subject: [Libav-user] Detecting black/dark frames in FFMPEG References: Message-ID: NITIN GOYAL writes: > Is there any way i can modify or use the ffmpeg library > to detect the black/dark/green frames from the content? Did you test the blackdetect and blackframe filters? Carl Eugen From cehoyos at ag.or.at Tue Jun 5 12:54:19 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Jun 2012 10:54:19 +0000 (UTC) Subject: [Libav-user] Reoder Buffer Configuration References: Message-ID: writes: > I am getting Following warning during h264 decoding using libavcodec: > > Increasing reorder buffer to 1 > Increasing reorder buffer to 16 > > Can I avoid this warning? The message is less verbose now. Thank you for the report, Carl Eugen From krishnaks at iwavesystems.com Tue Jun 5 13:08:44 2012 From: krishnaks at iwavesystems.com (krishnaks at iwavesystems.com) Date: Tue, 5 Jun 2012 16:38:44 +0530 Subject: [Libav-user] Reoder Buffer Configuration In-Reply-To: References: Message-ID: Thanks for your reply > writes: > >> I am getting Following warning during h264 decoding using libavcodec: >> >> Increasing reorder buffer to 1 >> Increasing reorder buffer to 16 >> >> Can I avoid this warning? > > The message is less verbose now. > > Thank you for the report, Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From leandrosansilva at gmail.com Tue Jun 5 13:31:42 2012 From: leandrosansilva at gmail.com (Leandro Santiago) Date: Tue, 5 Jun 2012 08:31:42 -0300 Subject: [Libav-user] Bug in drawtext (FT_LOAD_*)? In-Reply-To: <20120605084839.GA2429@arborea> References: <20120605084839.GA2429@arborea> Message-ID: I had read the parser but I couldn't find the flags option. Now you said I can see it in libavutil/opt.c:195. Thx a lot :-) I will report the documentation issue. 2012/6/5 Stefano Sabatini : > if this is documented somewhere, you're welcome to create an > issue on trac if not or to add an example to the drawtext > documentation -- ----- Sent from my Atari From Mohamed.Salim at desay-svautomotive.com Tue Jun 5 08:31:02 2012 From: Mohamed.Salim at desay-svautomotive.com (Salim, Mohamed) Date: Tue, 5 Jun 2012 14:31:02 +0800 Subject: [Libav-user] ADIF format support for AAc Message-ID: <827AE1EA8B615945A64881D6D9437B0C573847@hzhe007a.v01.net> Hi All, I am using ffmpeg version 0.10.11 via GStreamer in my development (ARM based). I found that AAC streams with ADIF header can not be played. Can somebody confirm to me that there is no support of ADIF in ffmpeg, If there is, please let me which version shall I use? Thanks and Kindest Regards, Salim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 5 19:59:09 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 5 Jun 2012 17:59:09 +0000 (UTC) Subject: [Libav-user] ADIF format support for AAc References: <827AE1EA8B615945A64881D6D9437B0C573847@hzhe007a.v01.net> Message-ID: Salim, Mohamed writes: > I found that AAC streams with ADIF header can not be played. Could you provide a sample? Carl Eugen From jettoblack at gmail.com Wed Jun 6 02:48:29 2012 From: jettoblack at gmail.com (jettoblack) Date: Tue, 5 Jun 2012 17:48:29 -0700 (PDT) Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <20120605085059.GC7585@phare.normalesup.org> References: <1338507433079-4655098.post@n4.nabble.com> <20120601140652.GB3720@phare.normalesup.org> <1338858006138-4655124.post@n4.nabble.com> <20120605085059.GC7585@phare.normalesup.org> Message-ID: <1338943709877-4655143.post@n4.nabble.com> Hi Nicolas, Very helpful, thank you. I trimmed this code down to just the essentials of the audio section since video isn't a problem. What I see is that: - The call to avresample_convert() seems to always succeed, so I think decode and resample are working ok - The first call to avcodec_encode_audio2() succeeds and returns a packet (got_packet_ptr true), which is successfully written to the output - Subsequent calls to avcodec_encode_audio2() return -22 (Illegal argument) and got_packet_ptr false Here is some sample output from the code below: begin input loop src pkt stream 1, pts 125098, dts 125098 got_audio linesize[0]=2304 nb_samples=1152 avr_convert() ret len 1152 destaudio pts 125098 avcodec_encode_audio2() success write audio pkt: stream 0, pts 124617, dts 124617 src pkt stream 1, pts 127258, dts 127258 got_audio linesize[0]=2304 nb_samples=1152 avr_convert() ret len 1152 destaudio pts 127258 avcodec_encode_audio2() error -22 Invalid argument Any ideas? Thanks again! Code: #include #include #include "libavformat/avformat.h" #include "libavcodec/avcodec.h" #include "libavresample/avresample.h" #include "libavutil/opt.h" int main (int argc, const char * argv[]) { const char *infile = argv[1]; const char *outfile = argv[2]; int r; AVPacket pkt; AVFrame *srcaudio = NULL; AVFormatContext *in = NULL, *out = NULL; AVCodecContext *in_acodec, *out_acodec; AVStream *in_astream, *out_astream; AVAudioResampleContext *avr; AVCodec *acodec; int got_audio; char errbuf[128]; int got_packet_ptr = 0; int audio_bufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE; int64_t audio_samples = 0; int64_t first_pts = -1; // init LAVF av_register_all(); avformat_network_init(); //av_log_set_level(AV_LOG_VERBOSE); // Open input file printf("Open input file: %s\n", infile); r = avformat_open_input(&in, infile, NULL, NULL); if (r) { printf("open err %x\n", r); return r; } r = avformat_find_stream_info(in, NULL); if (r < 0) { printf("find_stream_info err %x\n", r); return r; } // iterate over input streams for (int i = 0; i < in->nb_streams; i++) { AVStream *inputStream = in->streams[i]; if (inputStream->codec->codec_type == AVMEDIA_TYPE_AUDIO) { inputStream->discard = AVDISCARD_NONE; in_astream = inputStream; in_acodec = inputStream->codec; if (!inputStream->codec->codec) { avcodec_open2(inputStream->codec, avcodec_find_decoder(inputStream->codec->codec_id), NULL); } printf("Input audio %s rate %d channels %d sample_format %d\n", in_acodec->codec->name, in_acodec->sample_rate, in_acodec->channels, in_acodec->sample_fmt); } else { inputStream->discard = AVDISCARD_ALL; } } assert(in_acodec); // Open output file for writing out = avformat_alloc_context(); assert(out); out->oformat = av_guess_format(NULL, outfile, NULL); // Guess output container format based on file extension assert(out->oformat); // Output parameters // Audio codec acodec = avcodec_find_encoder(CODEC_ID_MP2); assert(acodec); out_acodec = avcodec_alloc_context3(acodec); avcodec_get_context_defaults3(out_acodec, acodec); assert(out_acodec); out_acodec->channels = 2; out_acodec->sample_rate = 48000; out_acodec->sample_fmt = AV_SAMPLE_FMT_S16; out_acodec->channel_layout = av_get_channel_layout("stereo"); out_acodec->time_base = in_acodec->time_base; // TODO: set other codec parameters r = avcodec_open2(out_acodec, acodec, NULL); assert(!r); // Audio stream out_astream = avformat_new_stream(out, out_acodec->codec); assert(out_astream); out_astream->codec = out_acodec; // setup audio resample context avr = avresample_alloc_context(); av_opt_set_int(avr, "in_channel_layout", in_acodec ->channel_layout, 0); av_opt_set_int(avr, "out_channel_layout", out_acodec->channel_layout, 0); av_opt_set_int(avr, "in_sample_fmt", in_acodec ->sample_fmt, 0); av_opt_set_int(avr, "out_sample_fmt", out_acodec->sample_fmt, 0); av_opt_set_int(avr, "in_sample_rate", in_acodec ->sample_rate, 0); av_opt_set_int(avr, "out_sample_rate", out_acodec->sample_rate, 0); av_opt_set_int(avr, "in_channels", in_acodec ->channels, 0); av_opt_set_int(avr, "out_channels", out_acodec->channels, 0); r = avresample_open(avr); assert(!r); // print audio params printf("Output audio %s rate %d channels %d sample_format %d\n", out_acodec->codec->name, out_acodec->sample_rate, out_acodec->channels, out_acodec->sample_fmt); // Begin writing output file printf("Open output file: %s\nOutput container: %s\n", outfile, out->oformat->long_name); r = avio_open2(&out->pb, outfile, AVIO_FLAG_WRITE, NULL, NULL); if (r) { printf("err %x\n", r); return r; } printf("write out header\n"); r = avformat_write_header(out, NULL); if (r) { printf("err %x\n", r); return r; } printf("begin input loop\n"); while (1) { av_init_packet(&pkt); r = av_read_frame(in, &pkt); if (r) { if (r == AVERROR_EOF) printf("EOF\n"); else printf("read error %x\n", r); break; } printf("src pkt stream %d, pts %"PRId64", dts %"PRId64"\n", pkt.stream_index, pkt.pts, pkt.dts); if (first_pts == -1 && pkt.pts != AV_NOPTS_VALUE) first_pts = pkt.pts; if (pkt.stream_index == in_astream->index) { // decode audio srcaudio = avcodec_alloc_frame(); avcodec_get_frame_defaults(srcaudio); got_audio = 0; r = avcodec_decode_audio4(in_acodec, srcaudio, &got_audio, &pkt); if (r < 0) { av_strerror(r, errbuf, 128); printf("audio decode error %d %s\n", r, errbuf); break; } else if (got_audio) { // convert audio AVPacket newpkt; AVFrame *destaudio; // frame for resampled audio int64_t timestamp = av_frame_get_best_effort_timestamp(srcaudio); int nb_samples; av_init_packet(&newpkt); destaudio = avcodec_alloc_frame(); avcodec_get_frame_defaults(destaudio); destaudio->extended_data = av_malloc(sizeof(uint8_t*)); destaudio->extended_data[0] = av_malloc(audio_bufsize); got_packet_ptr = 0; printf("got_audio linesize[0]=%d nb_samples=%d\n", srcaudio->linesize[0], srcaudio->nb_samples); // resample to dest format nb_samples = avresample_convert(avr, (void**)destaudio->extended_data, destaudio->linesize[0], audio_bufsize, (void**)srcaudio->extended_data, srcaudio->linesize[0], srcaudio->nb_samples); if (nb_samples < 0) { av_strerror(nb_samples, errbuf, 128); printf("avr_convert() error %d %s\n", nb_samples, errbuf); break; } printf("avr_convert() ret len %d\n", nb_samples); if (timestamp != AV_NOPTS_VALUE) destaudio->pts = av_rescale_q(timestamp, in_astream->time_base, out_astream->time_base); else destaudio->pts = first_pts + (int)((double)audio_samples * (90000.0/out_acodec->sample_rate)); printf("destaudio pts %"PRId64"\n", destaudio->pts); // why does this return -22 after the first successfull call? r = avcodec_encode_audio2(out_acodec, &newpkt, destaudio, &got_packet_ptr); if (r < 0) { av_strerror(r, errbuf, 128); printf("avcodec_encode_audio2() error %d %s\n", r, errbuf); //break; } else if (got_packet_ptr) { // write frame printf("avcodec_encode_audio2() success\n"); newpkt.stream_index = out_astream->index; newpkt.flags |= AV_PKT_FLAG_KEY; printf("write audio pkt: stream %d, pts %"PRId64", dts %"PRId64"\n", newpkt.stream_index, newpkt.pts, newpkt.dts); r = av_interleaved_write_frame(out, &newpkt); if (r) { printf("audio write error %x\n", r); break; } } av_free(destaudio->extended_data[0]); av_free(destaudio->extended_data); av_free(destaudio); av_free_packet(&newpkt); audio_samples += nb_samples; } av_free(srcaudio); } av_free_packet(&pkt); } avcodec_close(in_acodec); avcodec_close(out_acodec); // TODO: anything else to free/close? r = av_write_trailer(out); if (r) { printf("error closing output %x\n", r); } avformat_close_input(&in); printf("Wrote output file: %s\n", outfile); return 0; } -- View this message in context: http://libav-users.943685.n4.nabble.com/Example-for-recompressing-a-video-tp4655098p4655143.html Sent from the libav-users mailing list archive at Nabble.com. From susiriss at gmail.com Wed Jun 6 04:22:36 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Wed, 06 Jun 2012 07:52:36 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> Message-ID: <4FCEBEEC.7020109@gmail.com> On 06/05/2012 12:28 PM, Carl Eugen Hoyos wrote: > Sampath Subasinghe writes: > >> 1. RGB - YUV conversion >> 2. YUV - RGB conversion >> >> Issue is that in the image output from step 2, the right >> edge of the image is missing, means the pixels are black. > Is this also reproducible if you use ffmpeg (the application)? > If yes, please provide a command line and complete, uncut > console output. Hi Carl, I was wondering whether this is what you meant. I have the original image as a ppm image. then I do, ffmpeg - i ref.ppm ref.yuv which outputs following at the command line ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers built on Apr 27 2012 07:58:14 with gcc 4.4.5 configuration: --enable-shared --enable-gpl --enable-nonfree --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic WARNING: library configuration mismatch avutil configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic avfilter configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic swresample configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic libavutil 51. 35.100 / 51. 47.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100 / 53. 32.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 72.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 11.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, image2, from 'ref.ppm': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0:0: Video: ppm, rgb24, 45x32, 25 tbr, 25 tbn, 25 tbc [buffer @ 0x1d457a0] w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: Output #0, rawvideo, to 'ref.yuv': Metadata: encoder : Lavf53.32.100 Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 45x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (ppm -> rawvideo) Press [q] to stop, [?] for help frame= 1 fps= 0 q=0.0 Lsize= 4kB time=00:00:00.04 bitrate= 864.0kbits/s video:4kB audio:0kB global headers:0kB muxing overhead 0.000000% ----------------------------------- Which of course has warnings in it. Then I do ffmpeg -i ref.yuv ref.ppm which outputs following. ----------------------------------------- ffmpeg -i ref.yuv ref.ppm ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers built on Apr 27 2012 07:58:14 with gcc 4.4.5 configuration: --enable-shared --enable-gpl --enable-nonfree --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic WARNING: library configuration mismatch avutil configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic avfilter configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic swresample configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic libavutil 51. 35.100 / 51. 47.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100 / 53. 32.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 72.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 11.100 libpostproc 52. 0.100 / 52. 0.100 [IMGUTILS @ 0x7fff69baf6a0] Picture size 0x0 is invalid [IMGUTILS @ 0x7fff69baf580] Picture size 0x0 is invalid [rawvideo @ 0x1e8e3a0] decoding for stream 0 failed [rawvideo @ 0x1e8e3a0] Could not find codec parameters (Video: rawvideo, yuv420p) [rawvideo @ 0x1e8e3a0] Estimating duration from bitrate, this may be inaccurate ref.yuv: could not find codec parameters ----------------------------------------------------- I know, my command has errors, but I don't have an idea as to how I should test the scenario you mentioned. Could you please give me a sample command line? thanks. -Sampath From alexcohn at netvision.net.il Wed Jun 6 08:08:22 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 6 Jun 2012 09:08:22 +0300 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: <4FCEBEEC.7020109@gmail.com> References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: On Wed, Jun 6, 2012 at 5:22 AM, Sampath Subasinghe wrote: > On 06/05/2012 12:28 PM, Carl Eugen Hoyos wrote: > >> Sampath Subasinghe writes: >> >> 1. RGB - YUV conversion >>> 2. YUV - RGB conversion >>> >>> Issue is that in the image output from step 2, the right >>> edge of the image is missing, means the pixels are black. >>> >> Is this also reproducible if you use ffmpeg (the application)? >> If yes, please provide a command line and complete, uncut >> console output. >> > Hi Carl, > I was wondering whether this is what you meant. I have the original > image as a ppm image. > then I do, > ffmpeg - i ref.ppm ref.yuv > which outputs following at the command line > > ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers > built on Apr 27 2012 07:58:14 with gcc 4.4.5 > configuration: --enable-shared --enable-gpl --enable-nonfree > --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame > --enable-libx264 --enable-pic > WARNING: library configuration mismatch > avutil configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > avfilter configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > swresample configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > libavutil 51. 35.100 / 51. 47.100 > libavcodec 53. 61.100 / 53. 61.100 > libavformat 53. 32.100 / 53. 32.100 > libavdevice 53. 4.100 / 53. 4.100 > libavfilter 2. 61.100 / 2. 72.100 > libswscale 2. 1.100 / 2. 1.100 > libswresample 0. 6.100 / 0. 11.100 > libpostproc 52. 0.100 / 52. 0.100 > Input #0, image2, from 'ref.ppm': > Duration: 00:00:00.04, start: 0.000000, bitrate: N/A > Stream #0:0: Video: ppm, rgb24, 45x32, 25 tbr, 25 tbn, 25 tbc > [buffer @ 0x1d457a0] w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: > Output #0, rawvideo, to 'ref.yuv': > Metadata: > encoder : Lavf53.32.100 > Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 45x32, > q=2-31, 200 kb/s, 90k tbn, 25 tbc > Stream mapping: > Stream #0:0 -> #0:0 (ppm -> rawvideo) > Press [q] to stop, [?] for help > frame= 1 fps= 0 q=0.0 Lsize= 4kB time=00:00:00.04 bitrate= > 864.0kbits/s > video:4kB audio:0kB global headers:0kB muxing overhead 0.000000% > ------------------------------**----- > > Which of course has warnings in it. > > Then I do > ffmpeg -i ref.yuv ref.ppm > which outputs following. > ------------------------------**----------- > ffmpeg -i ref.yuv ref.ppm > ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers > built on Apr 27 2012 07:58:14 with gcc 4.4.5 > configuration: --enable-shared --enable-gpl --enable-nonfree > --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame > --enable-libx264 --enable-pic > WARNING: library configuration mismatch > avutil configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > avfilter configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > swresample configuration: --enable-gpl --enable-nonfree --enable-shared > --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac > --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic > libavutil 51. 35.100 / 51. 47.100 > libavcodec 53. 61.100 / 53. 61.100 > libavformat 53. 32.100 / 53. 32.100 > libavdevice 53. 4.100 / 53. 4.100 > libavfilter 2. 61.100 / 2. 72.100 > libswscale 2. 1.100 / 2. 1.100 > libswresample 0. 6.100 / 0. 11.100 > libpostproc 52. 0.100 / 52. 0.100 > [IMGUTILS @ 0x7fff69baf6a0] Picture size 0x0 is invalid > [IMGUTILS @ 0x7fff69baf580] Picture size 0x0 is invalid > [rawvideo @ 0x1e8e3a0] decoding for stream 0 failed > [rawvideo @ 0x1e8e3a0] Could not find codec parameters (Video: rawvideo, > yuv420p) > [rawvideo @ 0x1e8e3a0] Estimating duration from bitrate, this may be > inaccurate > ref.yuv: could not find codec parameters > ------------------------------**----------------------- > I know, my command has errors, but I don't have an idea as to how I should > test the scenario you mentioned. Could you please give me a sample command > line? > > thanks. > -Sampath > To read yuv raw image, you must supply the picture size and pixel format on the command line, e.g. ffmpeg -s 45x32 -pix_fmt yuv420p -i ref.yuv ref.ppm Regards, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Jun 6 08:12:30 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Jun 2012 06:12:30 +0000 (UTC) Subject: [Libav-user] Coversion from YUV to RGB loss of image details References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: Sampath Subasinghe writes: > I was wondering whether this is what you meant. This is broken (because odd width is not supported by yuv rawvideo): ffmpeg -i ref.ppm ref.yuv ffmpeg -s 45x32 -i ref.yuv ref2.ppm The following does work and produces the same black edge: $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg $ ffmpeg -i out.ljpg ref2.ppm Carl Eugen From alexcohn at netvision.net.il Wed Jun 6 08:32:05 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 6 Jun 2012 09:32:05 +0300 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: On Wed, Jun 6, 2012 at 9:12 AM, Carl Eugen Hoyos wrote: > Sampath Subasinghe writes: > > > I was wondering whether this is what you meant. > > This is broken (because odd width is not supported by > yuv rawvideo): > ffmpeg -i ref.ppm ref.yuv > ffmpeg -s 45x32 -i ref.yuv ref2.ppm > > The following does work and produces the same black edge: > $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg > $ ffmpeg -i out.ljpg ref2.ppm > > Carl Eugen > I am not using the latest build, but for me the round-trip worked without artifacts, see attached images and console output: *ffmpeg -i C:\Users\acohen\Downloads\ref.ppm -pix_fmt yuv420p t.yuv **ffmpeg version N-35295-gb55dd10, Copyright (c) 2000-2011 the FFmpeg developers built on Nov 30 2011 00:58:17 with gcc 4.6.2 configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libope ncore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable- libxvid --enable-zlib* * libavutil 51. 29. 1 / 51. 29. 1 libavcodec 53. 39. 1 / 53. 39. 1 libavformat 53. 22. 0 / 53. 22. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 50. 0 / 2. 50. 0 libswscale 2. 1. 0 / 2. 1. 0 libpostproc 51. 2. 0 / 51. 2. 0 *Input #0, image2, from 'C:\Users\acohen\Downloads\ref.ppm': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0:0: Video: ppm, rgb24, 45x32, 25 tbr, 25 tbn, 25 tbc w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [buffersink @ 00000000003369B0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out' [scale @ 0000000000337C60] w:45 h:32 fmt:rgb24 -> w:45 h:32 fmt:yuv420p flags:0x4 Output #0, rawvideo, to 't.yuv': Metadata: encoder : Lavf53.22.0 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 45x32, q=2-31, 20 0 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (ppm -> rawvideo) Press [q] to stop, [?] for help frame= 1 fps= 0 q=0.0 Lsize= 2kB time=00:00:00.04 bitrate= 435.2kbits/s video:2kB audio:0kB global headers:0kB muxing overhead 0.000000% *ffmpeg -pix_fmt yuv420p -s 45x32 -i t.yuv t.ppm* [rawvideo @ 000000000038D660] Estimating duration from bitrate, this may be inaccurate Input #0, rawvideo, from 't.yuv': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 45x32, 25 tbr, 25 tbn, 25 tbc Incompatible pixel format 'yuv420p' for codec 'ppm', auto-selecting format 'rgb24' [buffer @ 000000000038D5E0] w:45 h:32 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param: [buffersink @ 000000000038F490] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out' [scale @ 000000000038F6F0] w:45 h:32 fmt:yuv420p -> w:45 h:32 fmt:rgb24 flags:0x4 Output #0, image2, to 't.ppm': Metadata: encoder : Lavf53.22.0 Stream #0:0: Video: ppm, rgb24, 45x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo -> ppm) Press [q] to stop, [?] for help frame= 1 fps= 0 q=0.0 Lsize= 0kB time=00:00:00.04 bitrate= 0.0kbits/s video:4kB audio:0kB global headers:0kB muxing overhead -100.000000% -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: t.ppm Type: image/x-portable-pixmap Size: 4333 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: t.yuv Type: application/octet-stream Size: 2176 bytes Desc: not available URL: From x.morion.x at gmail.com Wed Jun 6 08:57:29 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Wed, 6 Jun 2012 17:57:29 +1100 Subject: [Libav-user] http streaming latency depends on frame rate Message-ID: Good day to all. I'm using libav in my application to encode live video to h264, mux it in Live Smooth Streaming format and send to IIS Live Smooth Streaming publishing point (via http). I need to achieve quite low latency (<3 seconds) of live video. When the video is recorded on regular frame rate (20-30 fps), everything is good and latency is even lower. But when I try lower fps values, the latency grows. For 5 fps the latency is 5-6 seconds, for 2 fps it is 11 seconds and for 1 fps - 21 second. I've measured time of the encoding of each frame, it is approximately 1.5 seconds and didn't changed with fps. Also disabled all buffering at the video player side to exclude it. So the problem seems to be somewhere at http transfer process (that is performed by libav too). First I thought that some kind of buffer is used in libav for http transfer, and on the lower frame rate it is filled slower, and that's the reason of increased latency. But changing video resolution and bitrate doesn't affect on latency, though obviously should change encoded frame size and so change the buffer filling rate. Now I'm completely out of ideas what is reason of that latency and how to remove it. Does anyone have any suggestions? Thanks in advance, Aleksey From krishnaks at iwavesystems.com Wed Jun 6 21:54:53 2012 From: krishnaks at iwavesystems.com (Krishna) Date: Wed, 6 Jun 2012 12:54:53 -0700 Subject: [Libav-user] Reoder Buffer Configuration References: Message-ID: <009201cd441e$3d8534a0$2a02a8c0@iwdtp219> Hi Carl, What is my observation is after i got following debug print "Increasing reorder buffer to 16" Propation delay is more in my video streaming application. Regards, KP ----- Original Message ----- From: To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." Sent: Tuesday, June 05, 2012 4:08 AM Subject: Re: [Libav-user] Reoder Buffer Configuration > > Thanks for your reply > >> writes: >> >>> I am getting Following warning during h264 decoding using libavcodec: >>> >>> Increasing reorder buffer to 1 >>> Increasing reorder buffer to 16 >>> >>> Can I avoid this warning? >> >> The message is less verbose now. >> >> Thank you for the report, Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From ffmpeg at gmail.com Wed Jun 6 09:39:53 2012 From: ffmpeg at gmail.com (Geek.Song) Date: Wed, 6 Jun 2012 15:39:53 +0800 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: References: Message-ID: do you tune rc_lookahead to zero? On Wed, Jun 6, 2012 at 2:57 PM, Aleksey Shubin wrote: > Good day to all. > > I'm using libav in my application to encode live video to h264, mux it > in Live Smooth Streaming format and send to IIS Live Smooth Streaming > publishing point (via http). > > I need to achieve quite low latency (<3 seconds) of live video. When > the video is recorded on regular frame rate (20-30 fps), everything is > good and latency is even lower. But when I try lower fps values, the > latency grows. For 5 fps the latency is 5-6 seconds, for 2 fps it is > 11 seconds and for 1 fps - 21 second. > > I've measured time of the encoding of each frame, it is approximately > 1.5 seconds and didn't changed with fps. Also disabled all buffering > at the video player side to exclude it. So the problem seems to be > somewhere at http transfer process (that is performed by libav too). > > First I thought that some kind of buffer is used in libav for http > transfer, and on the lower frame rate it is filled slower, and that's > the reason of increased latency. But changing video resolution and > bitrate doesn't affect on latency, though obviously should change > encoded frame size and so change the buffer filling rate. > > Now I'm completely out of ideas what is reason of that latency and how > to remove it. Does anyone have any suggestions? > -- ----------------------------------------------------------------------------------------- My key fingerprint: d1:03:f5:32:26:ff:d7:3c:e4:42:e3:51:ec:92:78:b2 From cehoyos at ag.or.at Wed Jun 6 09:50:12 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Jun 2012 07:50:12 +0000 (UTC) Subject: [Libav-user] Reoder Buffer Configuration References: <009201cd441e$3d8534a0$2a02a8c0@iwdtp219> Message-ID: Krishna writes: > What is my observation is after i got following debug print > "Increasing reorder buffer to 16" > Propation delay is more in my video streaming application. Definitely! (Although I don't know much about the reorder buffer.) Please do not top-post here, Carl Eugen From krishnaks at iwavesystems.com Wed Jun 6 22:29:12 2012 From: krishnaks at iwavesystems.com (Krishna) Date: Wed, 6 Jun 2012 13:29:12 -0700 Subject: [Libav-user] Reoder Buffer Configuration References: <009201cd441e$3d8534a0$2a02a8c0@iwdtp219> Message-ID: <000401cd4423$090a8180$2a02a8c0@iwdtp219> That means Delay will be there?? which is not at all acceptable. Any way is there to avoid this? One more thing is transmitter (Camera) sending only i-frames. not B-frames. Then how this print is comming? Regards, KP ----- Original Message ----- From: "Carl Eugen Hoyos" To: Sent: Wednesday, June 06, 2012 12:50 AM Subject: Re: [Libav-user] Reoder Buffer Configuration > Krishna writes: > >> What is my observation is after i got following debug print >> "Increasing reorder buffer to 16" >> Propation delay is more in my video streaming application. > > Definitely! > (Although I don't know much about the reorder buffer.) > > Please do not top-post here, Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From susiriss at gmail.com Wed Jun 6 10:18:43 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Wed, 6 Jun 2012 13:48:43 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: > > The following does work and produces the same black edge: > $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg > $ ffmpeg -i out.ljpg ref2.ppm > > Carl Eugen I'm also seeing the black edge with above commands. (Except, I had to precede the second command with -pix_fmt yuv420p to avoid seg faulting ffmpeg). I further found out that, the width should be a multiple of 8, not of 2 or 4, for my code to work correctly(output without the edge). I will test this out with ffmpeg, too. Thanks for your support again. -- ~Sampath~ From cehoyos at ag.or.at Wed Jun 6 12:49:37 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Jun 2012 10:49:37 +0000 (UTC) Subject: [Libav-user] Coversion from YUV to RGB loss of image details References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: Sampath Subasinghe writes: > > $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg > > $ ffmpeg -i out.ljpg ref2.ppm > I'm also seeing the black edge with above commands. > (Except, I had to precede the second command with > -pix_fmt yuv420p to avoid seg faulting ffmpeg). This sounds like an important issue that I cannot reproduce here, please provide more information. Carl Eugen From cehoyos at ag.or.at Wed Jun 6 13:03:43 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Jun 2012 11:03:43 +0000 (UTC) Subject: [Libav-user] Coversion from YUV to RGB loss of image details References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: Alex Cohn writes: > > This is broken (because odd width is not supported by > > yuv rawvideo): > > ffmpeg -i ref.ppm ref.yuv > > ffmpeg -s 45x32 -i ref.yuv ref2.ppm > I am not using the latest build, but for me the > round-trip worked without artifacts I forgot to add -pix_fmt yuv420p to the first command, thank you for testing! Carl Eugen From susiriss at gmail.com Wed Jun 6 13:10:30 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Wed, 6 Jun 2012 16:40:30 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: > > > I am not using the latest build, but for me the round-trip worked without > artifacts, see attached images and console output: > Hi Alex, Does this mean you don't get this edge issue. If so, please let me know how to fix this in my code? thanks. -- ~Sampath~ From alexcohn at netvision.net.il Wed Jun 6 15:25:09 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 6 Jun 2012 16:25:09 +0300 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: On Wed, Jun 6, 2012 at 2:10 PM, Sampath Subasinghe wrote: > > > > > > I am not using the latest build, but for me the round-trip worked without > > artifacts, see attached images and console output: > > > > Hi Alex, Does this mean you don't get this edge issue. If so, please > let me know how to fix this in my code? > thanks. > -- > ~Sampath~ > You can judge yourself: look at the files attached. I don't know what makes it different. Maybe my version of ffmpeg is older and better. But I most likely, your source code working with bicubic interpolation, has this limitation. Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: t.ppm Type: image/x-portable-pixmap Size: 4333 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: t.yuv Type: application/octet-stream Size: 2176 bytes Desc: not available URL: From alexcohn at netvision.net.il Wed Jun 6 15:39:18 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 6 Jun 2012 16:39:18 +0300 Subject: [Libav-user] Reoder Buffer Configuration In-Reply-To: <000401cd4423$090a8180$2a02a8c0@iwdtp219> References: <009201cd441e$3d8534a0$2a02a8c0@iwdtp219> <000401cd4423$090a8180$2a02a8c0@iwdtp219> Message-ID: On Wed, Jun 6, 2012 at 11:29 PM, Krishna wrote: > That means Delay will be there?? which is not at all acceptable. Any way > is there to avoid this? > One more thing is transmitter (Camera) sending only i-frames. not > B-frames. Then how this print is comming? > You could run ffmpeg with "-debug pict" or maybe more debug options. > Regards, > KP > BR, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Wed Jun 6 17:15:34 2012 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 6 Jun 2012 08:15:34 -0700 Subject: [Libav-user] ffmpeg to publish to streaming server (Wowza) In-Reply-To: <77125812-5704-450C-9925-9389280BAD15@bighillsoftware.com> References: <77125812-5704-450C-9925-9389280BAD15@bighillsoftware.com> Message-ID: <6A4676A2-6F8D-4E46-BC9F-74B7DDBF2C15@bighillsoftware.com> Any ideas on publishing / sending MPEG-TS over RTP using ffmpeg? a) Can this be done? b) Any ideas on where to start? Thanks, Brad Brad O'Hearne Founder / Lead Developer Big Hill Software LLC http://www.bighillsoftware.com On Jun 4, 2012, at 3:36 PM, Brad O'Hearne wrote: > Hello, > > My use case: I need to programmatically (read: not from a console command line) capture video from a Mac's builtin video camera and publish that video to Wowza streaming server (clients talk to Wowza). I would like to use ffmpeg to transport the captured video from the camera to the Wowza server. A few notes on this: > > - For reasons that are non-negotiable (I cannot do anything about them), this video has to be published to Wowza for streaming. > > - Wowza supports the encoders based on the following: RTSP/RTP, RTMP, MPEG-TS. I am looking to use MPEG-TS for this. > > I have been scouring the Internet looking for any kind of code example which would demonstrate how to do this, or something near to this. I'm not having much luck. If anyone has a sample code chunk or can point me in the right direction, that would be great. > > Thanks in advance! Your help is appreciated. > > Brad > > Brad O'Hearne > Founder / Lead Developer > Big Hill Software LLC > http://www.bighillsoftware.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 nitinkumgoyal at gmail.com Wed Jun 6 17:32:33 2012 From: nitinkumgoyal at gmail.com (NITIN GOYAL) Date: Wed, 6 Jun 2012 21:02:33 +0530 Subject: [Libav-user] ffmpeg to publish to streaming server (Wowza) In-Reply-To: <6A4676A2-6F8D-4E46-BC9F-74B7DDBF2C15@bighillsoftware.com> References: <77125812-5704-450C-9925-9389280BAD15@bighillsoftware.com> <6A4676A2-6F8D-4E46-BC9F-74B7DDBF2C15@bighillsoftware.com> Message-ID: i think theoretically its possible but it might be bit complex.. the following link might help you: http://libav-users.943685.n4.nabble.com/Output-mpeg-ts-to-rtp-td2234066.html Regards Nitin On Wed, Jun 6, 2012 at 8:45 PM, Brad O'Hearne wrote: > Any ideas on publishing / sending MPEG-TS over RTP using ffmpeg? > > a) Can this be done? > > b) Any ideas on where to start? > > Thanks, > > Brad > > Brad O'Hearne > Founder / Lead Developer > Big Hill Software LLC > http://www.bighillsoftware.com > > On Jun 4, 2012, at 3:36 PM, Brad O'Hearne wrote: > > Hello, > > My use case: I need to programmatically (read: not from a console command > line) capture video from a Mac's builtin video camera and publish that > video to Wowza streaming server (clients talk to Wowza). I would like to > use ffmpeg to transport the captured video from the camera to the Wowza > server. A few notes on this: > > - For reasons that are non-negotiable (I cannot do anything about them), > this video has to be published to Wowza for streaming. > > - Wowza supports the encoders based on the following: RTSP/RTP, RTMP, > MPEG-TS. I am looking to use MPEG-TS for this. > > I have been scouring the Internet looking for any kind of code example > which would demonstrate how to do this, or something near to this. I'm not > having much luck. If anyone has a sample code chunk or can point me in the > right direction, that would be great. > > Thanks in advance! Your help is appreciated. > > Brad > > Brad O'Hearne > Founder / Lead Developer > Big Hill Software LLC > http://www.bighillsoftware.com > > _______________________________________________ > 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 susiriss at gmail.com Wed Jun 6 17:57:01 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Wed, 06 Jun 2012 21:27:01 +0530 Subject: [Libav-user] Coversion from YUV to RGB loss of image details In-Reply-To: References: <4FCD6BE8.7030104@gmail.com> <4FCEBEEC.7020109@gmail.com> Message-ID: <4FCF7DCD.7050600@gmail.com> > $ ffmpeg -i out.ppm -pix_fmt yuv420p -strict experimental out.ljpg > $ ffmpeg -i out.ljpg ref2.ppm >> I'm also seeing the black edge with above commands. > >> (Except, I had to precede the second command with >> -pix_fmt yuv420p to avoid seg faulting ffmpeg). > This sounds like an important issue that I cannot reproduce here, > please provide more information. > > Carl Eugen > > Hi Carl, This is the output I get if I issue that second command without -pix_fmt yuv420p $ ffmpeg -i out.ljpg ref2.ppm ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers built on Apr 27 2012 07:58:14 with gcc 4.4.5 configuration: --enable-shared --enable-gpl --enable-nonfree --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic WARNING: library configuration mismatch avutil configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic avfilter configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic swresample configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic libavutil 51. 35.100 / 51. 47.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100 / 53. 32.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 72.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 11.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, image2, from 'out.ljpg': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0:0: Video: mjpeg, yuv420p, 45x32, 25 tbr, 25 tbn, 25 tbc Incompatible pixel format 'yuv420p' for codec 'ppm', auto-selecting format 'rgb24' [buffer @ 0x1160b20] w:45 h:32 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param: [buffersink @ 0x1154ca0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out' [scale @ 0x11555a0] w:45 h:32 fmt:yuv420p sar:0/1 -> w:45 h:32 fmt:rgb24 sar:0/1 flags:0x4 Output #0, image2, to 'ref2.ppm': Metadata: encoder : Lavf53.32.100 Stream #0:0: Video: ppm, rgb24, 45x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (mjpeg -> ppm) Press [q] to stop, [?] for help Segmentation fault ------------------------------- Note the "Incompatible pixel format....". Please let me know if you want any other details. Also I tried, Alex's two commands, again ffmpeg crashes. *$ ffmpeg -i ref.ppm -pix_fmt yuv420p t.yuv* Truncated output: ffmpeg -i ref.ppm -pix_fmt yuv420p t.yuv ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers built on Apr 27 2012 07:58:14 with gcc 4.4.5 configuration: --enable-shared --enable-gpl --enable-nonfree --enable-x11grab --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic WARNING: library configuration mismatch avutil configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic avfilter configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic swresample configuration: --enable-gpl --enable-nonfree --enable-shared --disable-ffserver --enable-x11grab --enable-libaacplus --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-pic libavutil 51. 35.100 / 51. 47.100 libavcodec 53. 61.100 / 53. 61.100 libavformat 53. 32.100 / 53. 32.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 61.100 / 2. 72.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 6.100 / 0. 11.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, image2, from 'ref.ppm': Duration: 00:00:00.04, start: 0.000000, bitrate: N/A Stream #0:0: Video: ppm, rgb24, 45x32, 25 tbr, 25 tbn, 25 tbc [buffer @ 0x253a0a0] w:45 h:32 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param: [buffersink @ 0x25418a0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out' [scale @ 0x25421a0] w:45 h:32 fmt:rgb24 sar:0/1 -> w:45 h:32 fmt:yuv420p sar:0/1 flags:0x4 Output #0, rawvideo, to 't.yuv': Metadata: encoder : Lavf53.32.100 Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 45x32, q=2-31, 200 kb/s, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (ppm -> rawvideo) Press [q] to stop, [?] for help *** glibc detected *** ffmpeg: corrupted double-linked list: 0x000000000256b760 *** ======= Backtrace: ========= ... thanks -Sampath -------------- next part -------------- An HTML attachment was scrubbed... URL: From nnkhanh at tma.com.vn Wed Jun 6 14:33:02 2012 From: nnkhanh at tma.com.vn (Khanh Nguyen Nam) Date: Wed, 06 Jun 2012 19:33:02 +0700 Subject: [Libav-user] Ask about license for using ffmpeg library in binary Message-ID: <4FCF4DFE.2060303@tma.com.vn> Dear all, I am developing an application which uses ffmpeg library as below: * Add ffmpeg binary to application source code * Call ffmpeg command line via C# code. I want to sell my application. Do I have to pay for using ffmpeg? And if I have to pay, who will I have to contact? Sorry if this email disturb you. Thanks for your help. Khanh TMA Mobile Solutions, http://mobi-development.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Jun 6 20:27:33 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 6 Jun 2012 18:27:33 +0000 (UTC) Subject: [Libav-user] Ask about license for using ffmpeg library in binary References: <4FCF4DFE.2060303@tma.com.vn> Message-ID: Khanh Nguyen Nam writes: > I am developing an application which uses ffmpeg library as below: > > Add ffmpeg binary to application source code > Call ffmpeg command line via C# code. If you want to distribute a software binary that is FFmpeg (or a derivative work of FFmpeg) and you are not using any GPL'd parts of FFmpeg, then you have to comply with the LGPL (or a compatible software license like for example the GPL). If you want to distribute a software binary that is FFmpeg (or a derivative work of FFmpeg) and you are using GPL'd parts of FFmpeg, then you have to comply with the GPL (is is not sufficient to comply with the LGPL in that case). Please read http://ffmpeg.org/legal.html and do not forget to read either the GPL or the LGPL depending on which parts of FFmpeg you plan to use. Please understand that while you are very welcome to support the FFmpeg development (even financially), there is no way you could "pay" for FFmpeg (at least in the sense I understand your question). And please understand that you have to comply with the GPL (or the LGPL, see above) no matter if you sell your software or give it away for free. Carl Eugen From x.morion.x at gmail.com Thu Jun 7 01:53:36 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Thu, 7 Jun 2012 10:53:36 +1100 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: References: Message-ID: 2012/6/6 Geek.Song : > do you tune rc_lookahead to zero? Do you mean x264's rc_lookahead? Tried it, but latency was the same. Anyway that seems not to be encoder problem (as frame encoding time doesn't change a lot when changing frame rate). From krishnaks at iwavesystems.com Thu Jun 7 20:03:13 2012 From: krishnaks at iwavesystems.com (Krishna) Date: Thu, 7 Jun 2012 11:03:13 -0700 Subject: [Libav-user] Clarification on Libavcodec Message-ID: <002301cd44d7$ce3a0a20$2a02a8c0@iwdtp219> Hi, I need small clarification on Libavcodec library behaviour I am developing IOS live video streaming application fow which Live555 I am using to receive H264 frames from Server(Camera). I am using Libavcodec to decode H264 frames to YUV & libwscale to YUV to RGB conversion. Our goal is to achieve the frame rate of 30FPS. My doubt is If H264 frame arrival rate(from network) is faster than decoding rate, Whether frames get queued? If YES, how to avoid that? Regards, KP -------------- next part -------------- An HTML attachment was scrubbed... URL: From pasquale.puzio at gmail.com Thu Jun 7 11:33:24 2012 From: pasquale.puzio at gmail.com (PasqualePuzio) Date: Thu, 7 Jun 2012 02:33:24 -0700 (PDT) Subject: [Libav-user] MPEG-TS UDP Multicast streaming In-Reply-To: References: <20111014075916.38180@gmx.net> Message-ID: <1339061604344-4655166.post@n4.nabble.com> Hi psychesnet, the sample of code you mentioned, would be very useful also for me. Could you please send me the code? Thanks. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-MPEG-TS-UDP-Multicast-streaming-tp3904072p4655166.html Sent from the libav-users mailing list archive at Nabble.com. From nicolas.george at normalesup.org Thu Jun 7 23:08:37 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Thu, 7 Jun 2012 23:08:37 +0200 Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <1338943709877-4655143.post@n4.nabble.com> References: <1338507433079-4655098.post@n4.nabble.com> <20120601140652.GB3720@phare.normalesup.org> <1338858006138-4655124.post@n4.nabble.com> <20120605085059.GC7585@phare.normalesup.org> <1338943709877-4655143.post@n4.nabble.com> Message-ID: <20120607210837.GF14722@phare.normalesup.org> L'octidi 18 prairial, an CCXX, jettoblack a ?crit?: > I trimmed this code down to just the essentials of the audio section since > video isn't a problem. I am sorry, but I do not think I will have time to read 300+ lines of code to find what may be wrong. I hope you find the source of your problem. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From jettoblack at gmail.com Thu Jun 7 23:43:57 2012 From: jettoblack at gmail.com (jettoblack) Date: Thu, 7 Jun 2012 14:43:57 -0700 (PDT) Subject: [Libav-user] Example for recompressing a video? In-Reply-To: <20120607210837.GF14722@phare.normalesup.org> References: <1338507433079-4655098.post@n4.nabble.com> <20120601140652.GB3720@phare.normalesup.org> <1338858006138-4655124.post@n4.nabble.com> <20120605085059.GC7585@phare.normalesup.org> <1338943709877-4655143.post@n4.nabble.com> <20120607210837.GF14722@phare.normalesup.org> Message-ID: <1339105437132-4655168.post@n4.nabble.com> Hi Nicolas, Thanks again for your time so far. I understand what you mean and I mistakenly thought that a compilable example would be preferred over a limited snippet. I put the snippet below in case you don't mind taking a quick look again. I would definitely appreciate any assistance you can offer. I believe that example code for re-compressing a compressed file (as opposed to current examples like output-example.c that does not take a compressed input) would be useful to a lot of other people and once I get it working I can write a wiki article with some advice for others. If such an example already exists I'd love to take a look. Anyway, here is the snippet where I think the problem is (I slightly rearranged it to make it simpler), and if you need any context I'd be happy to provide it: // decode audio from pkt into srcaudio AVFrame *srcaudio = avcodec_alloc_frame(); avcodec_get_frame_defaults(srcaudio); r = avcodec_decode_audio4(in_acodec, srcaudio, &got_audio, &pkt); // if got_audio true, resample audio to dest format AVFrame *destaudio = avcodec_alloc_frame(); // frame for resampled audio avcodec_get_frame_defaults(destaudio); destaudio->extended_data = av_malloc(sizeof(uint8_t*)); destaudio->extended_data[0] = av_malloc(audio_bufsize); r = avresample_convert(avr, (void**)destaudio->extended_data, destaudio->linesize[0], audio_bufsize, (void**)srcaudio->extended_data, srcaudio->linesize[0], srcaudio->nb_samples); // encode resampled audio AVPacket newpkt; // new packet for encoded output av_init_packet(&newpkt); // why does this encode succeed the first time but return -22 on subsequent calls? r = avcodec_encode_audio2(out_acodec, &newpkt, destaudio, &got_packet_ptr); -- View this message in context: http://libav-users.943685.n4.nabble.com/Example-for-recompressing-a-video-tp4655098p4655168.html Sent from the libav-users mailing list archive at Nabble.com. From wagner.patriota at gmail.com Fri Jun 8 22:53:16 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Fri, 8 Jun 2012 17:53:16 -0300 Subject: [Libav-user] Is it possible to concatenate MP4 audio AAC? Message-ID: I want something really hard. I need to concatenate MP4 files as fast as possible VIA CODE... is it possible? ONLY AUDIO FILES AAC. No video.... -------------- next part -------------- An HTML attachment was scrubbed... URL: From wagner.patriota at gmail.com Sat Jun 9 04:40:12 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Fri, 8 Jun 2012 23:40:12 -0300 Subject: [Libav-user] Is it possible to concatenate MP4 audio AAC? In-Reply-To: References: Message-ID: detail.... I just want to transmux it... not reencode... it must be very fast! On Fri, Jun 8, 2012 at 5:53 PM, Wagner Patriota wrote: > I want something really hard. > > I need to concatenate MP4 files as fast as possible VIA CODE... is it > possible? > > ONLY AUDIO FILES AAC. No video.... > -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.krieger.utkin at gmail.com Sat Jun 9 18:14:18 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Sat, 9 Jun 2012 19:14:18 +0300 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: References: Message-ID: ?????, 6 ???? 2012 ?. ???????????? Aleksey Shubin ?????: > Good day to all. > > I'm using libav in my application to encode live video to h264, mux it > in Live Smooth Streaming format and send to IIS Live Smooth Streaming > publishing point (via http). > > I need to achieve quite low latency (<3 seconds) of live video. When Latency you address everywhere in the letter is playback start latency, or time latency on player side? I assume first. > the video is recorded on regular frame rate (20-30 fps), everything is > good and latency is even lower. But when I try lower fps values, the > latency grows. For 5 fps the latency is 5-6 seconds, for 2 fps it is > 11 seconds and for 1 fps - 21 second. > > I've measured time of the encoding of each frame, it is approximately > 1.5 seconds and didn't changed with fps. Also disabled all buffering > at the video player side to exclude it. So the problem seems to be > somewhere at http transfer process (that is performed by libav too). > > First I thought that some kind of buffer is used in libav for http > transfer, and on the lower frame rate it is filled slower, and that's > the reason of increased latency. But changing video resolution and > bitrate doesn't affect on latency, though obviously should change > encoded frame size and so change the buffer filling rate. > > Now I'm completely out of ideas what is reason of that latency and how > to remove it. Does anyone have any suggestions? I just don't know, does iis streaming format have global metadata headers, or not. If not, the delay could be introduced by seeking for in-stream metadata. Afaiu x264 encodes instream metadata into keyframes, which go once per "keyframes interval" video frames. This explains why things are bad on low fps. You could try reduce keyframe interval for such cases. -- Andrey Utkin -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.krieger.utkin at gmail.com Sat Jun 9 18:28:25 2012 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Sat, 9 Jun 2012 19:28:25 +0300 Subject: [Libav-user] ffmpeg to publish to streaming server (Wowza) In-Reply-To: <6A4676A2-6F8D-4E46-BC9F-74B7DDBF2C15@bighillsoftware.com> References: <77125812-5704-450C-9925-9389280BAD15@bighillsoftware.com> <6A4676A2-6F8D-4E46-BC9F-74B7DDBF2C15@bighillsoftware.com> Message-ID: ?????, 6 ???? 2012 ?. ???????????? Brad O'Hearne ?????: > Any ideas on publishing / sending MPEG-TS over RTP using ffmpeg? > a) Can this be done? Should be. Just be sure you send in format wowza does understand. I don't know if wowza supports mpegts via rtp, a year ago it seemed to me rtp worked with elementary streams separately only. Anyway, there are surely the ways to publish onto wowza. I practiced it via rtmp protocol last days. > b) Any ideas on where to start? I'd try accomplishing task with ffmpeg utility to ensure it works without bugs, then learn ffmpeg libs API and wrire an app. -- Andrey Utkin -------------- next part -------------- An HTML attachment was scrubbed... URL: From nnkhanh at tma.com.vn Sat Jun 9 05:10:58 2012 From: nnkhanh at tma.com.vn (Khanh Nguyen Nam) Date: Sat, 09 Jun 2012 10:10:58 +0700 Subject: [Libav-user] Ask about license for using ffmpeg library in binary Message-ID: <4FD2BEC2.4010500@tma.com.vn> Dear all, I am developing an application which uses ffmpeg library as below: * Add ffmpeg binary to application source code * Call ffmpeg command line via C# code. I want to sell my application. Do I have to pay for using ffmpeg? And if I have to pay, who will I have to contact? Sorry if this email disturb you. Thanks for your help. Khanh TMA Mobile Solutions, http://mobi-development.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From philip at turmel.org Sat Jun 9 21:54:13 2012 From: philip at turmel.org (Phil Turmel) Date: Sat, 09 Jun 2012 15:54:13 -0400 Subject: [Libav-user] Ask about license for using ffmpeg library in binary In-Reply-To: <4FD2BEC2.4010500@tma.com.vn> References: <4FD2BEC2.4010500@tma.com.vn> Message-ID: <4FD3A9E5.9010704@turmel.org> Hi, On 06/08/2012 11:10 PM, Khanh Nguyen Nam wrote: > Dear all, > > I am developing an application which uses ffmpeg library as below: > > * Add ffmpeg binary to application source code > * Call ffmpeg command line via C# code. > > I want to sell my application. Do I have to pay for using ffmpeg? And if > I have to pay, who will I have to contact? > Sorry if this email disturb you. > > Thanks for your help. > Khanh You asked exactly this question two days ago, and Carl answered you. Perhaps you didn't see his reply, but it is visible in the archives. Perhaps you didn't understand him, nor realize that Carl is one of the developers. Or you didn't understand that there is *NO* way to pay for a commercial license. FFmpeg *can* be distributed with a commercial package if at least one of the distribution rules of the license is followed. If you follow the rules, you do not have to pay for a license. However, there are rules on patents that may or may not apply to you. FFmpeg does not control the patents, and the laws on software patents vary greatly from country to country. So you might need to research that. The rules are the the "GNU General Public License" and the "GNU Lesser General Public License". For your convenience, the FFmpeg developers created a checklist for complying with the rules in the most common situation (linking with the C API). Carl supplied a link that gives all of this information: http://ffmpeg.org/legal.html If after reading the linked material, you still cannot understand what you can or cannot do, or how to do what you can, you probably need to find a lawyer to help you. I am *not* a lawyer. Hope this helps, Phil From i.like.privacy.too at gmail.com Sun Jun 10 00:50:42 2012 From: i.like.privacy.too at gmail.com (Camera Man) Date: Sat, 09 Jun 2012 18:50:42 -0400 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: References: Message-ID: <4FD3D342.9090804@gmail.com> On 06/06/2012 02:57 AM, Aleksey Shubin wrote: > Now I'm completely out of ideas what is reason of that latency and how > to remove it. Does anyone have any suggestions? What player are you using? Most players (e.g. Windows Media Player or anything based on the Windows Media Codec infrastructure) will not play until they have buffered a few seconds of data (this can be adjusted, but not below 1 second if I recall correctly; the default used to be 5 seconds). If you are using ffplay / libav / ffmpeg as the decoder, be aware that by default it will use a multithreaded decoder in which each frame is decoded by a different thread, where the number of threads is the number of cores; This configuration introduces a delay of (number of cores) frames in the ffplay/ffmpeg decoding process, regardless of any other buffer - by switching to single-threaded mode, you can eliminate this delay. Further, depending on your encoding settings, there will be a delay of (number of reference frames). e.g. I have a camera that puts "number of refs = 4" in the stream, despite never using more than 1 ref; as a result, every conforming h264 decoder introduces a delay of 4 frames. This number is stream dependent and can go as high as 16. If you can control your encoder, set it to a low-latency mode (which means no B frames, max reorder=0, and only 1 reference frame). From jason.lun at asdtech.com Mon Jun 11 05:32:07 2012 From: jason.lun at asdtech.com (Jason LUN) Date: Mon, 11 Jun 2012 11:32:07 +0800 Subject: [Libav-user] FFMpeg dxva support Message-ID: Dear Sir, I am new to FFMpeg, and I got great experience on working with it. Currently, I am implementing a player which can play my 1080p h264 videos, it works fine with my i3 processor pc. However, when play the video with dual core pc, the decoding time is very slow for 0.08s per frame. Therefore, I would like to ask how could I use the ffplay with dxva so that it can accelerate the decoding process? Thank you for your kindly attentions. Best Regards, Jason LUN ASD Technology Ltd. 26/F Lever Tech Centre, 69-71 King Yip Street, Kwun Tong, Kowloon, Hong Kong. Direct Line: +852 2199 5330 Tel: +852 2770 8248 Fax: +852 2770 8249 Skype: asd_jason.lun -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jun 11 10:02:11 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 11 Jun 2012 08:02:11 +0000 (UTC) Subject: [Libav-user] FFMpeg dxva support References: Message-ID: Jason LUN writes: > Therefore, I would like to ask how could I use the ffplay > with dxva so that it can accelerate the decoding process? libavcodec contains support for dxva that can be used in videoplayers (vlc), ffplay does not contain any dxva-specific code. Carl Eugen From christian.bruemmer at gmx.de Mon Jun 11 13:14:16 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Mon, 11 Jun 2012 13:14:16 +0200 Subject: [Libav-user] Artifacts while encoding x264 video In-Reply-To: <4FC7992A.5070704@gmx.de> References: <4FC7992A.5070704@gmx.de> Message-ID: <4FD5D308.4000801@gmx.de> No idea? This is the x264 configuration from the ffmpeg print out: [libx264 @ 02a11060] profile High, level 3.1 [libx264 @ 02a11060] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Cop yleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deb lock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 m e_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chro ma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_c ompat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 we ightb=1 open_gop=0 weightp=2 keyint=48 keyint_min=4 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=1 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=6 9 qpstep=4 ip_ratio=1.40 aq=1:1.00 This may help? Am 31.05.2012 18:15, schrieb Christian Br?mmer: > Hi, > > i get strange artifacts while encoding a few dummy images to videoframes. > > this is the result: http://youtu.be/pL0bKaxTBiU > > This is my c-code configuration: > > codec = stream->codec; > codec->codec_id = codecID; > codec->codec_type = AVMEDIA_TYPE_VIDEO; > codec->bit_rate = mParameters.mBitRate; > codec->width = mParameters.mWidth; > codec->height = mParameters.mHeight; > codec->time_base.den = mParameters.mFrameRate; > codec->time_base.num = 1; > codec->gop_size = mParameters.mFrameRate; > codec->pix_fmt = PIXEL_FORMAT; > codec->b_frame_strategy = 0; > codec->level = 12; > > // for H264 > codec->me_range = 16; > codec->max_qdiff = 4; > // lower value for higher quality range: 0-52 > codec->qmin = 10; > codec->qmax = 26; > codec->qcompress = 0.6; > > with parameters: > > param.mBitRate = 40000; > param.mCodec = "x264"; > param.mFrameRate = 24; > param.mHeight = 480; > param.mWidth = 800; > > What can be the reason for those very ugly artifacs appearing every > few seconds? > > Best regards, > Christian > > > _______________________________________________ > 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 Jun 11 15:06:43 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 11 Jun 2012 13:06:43 +0000 (UTC) Subject: [Libav-user] Artifacts while encoding x264 video References: <4FC7992A.5070704@gmx.de> Message-ID: Christian Br?mmer writes: > What can be the reason for those very ugly > artifacs appearing every few seconds? Are the artefacts only reproducible with your code or also with ffmpeg (the application)? Carl Eugen From jp4work at gmail.com Mon Jun 11 21:17:42 2012 From: jp4work at gmail.com (JIA Pei) Date: Mon, 11 Jun 2012 12:17:42 -0700 Subject: [Libav-user] Problems to decode H.264 ... Message-ID: For the code CODEC_ID_H264 1) av_read_frame() seems always return a value < 0 at the wrong place. 2) decoding_encoding.c always fail to decode the video file due to len < 0, where len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); Have no idea where I'm wrong. The testing file is at http://www.visionopen.com/questions/emount.mp4 . Cheers Pei -- Pei JIA Email: jp4work at gmail.com cell: +1 604-362-5816 Welcome to Vision Open http://www.visionopen.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jun 11 23:23:09 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 11 Jun 2012 21:23:09 +0000 (UTC) Subject: [Libav-user] LGPL Compilation and 3GP Conversion Error References: Message-ID: Tim Bradstock writes: > ffmpeg.exe -i sample1.flv -vcodec mpeg4 -acodec aac > -strict experimental -ac 1 123.3gp > However, now I cannot get the above command line to work and cannot > convert to the 3GP format. Complete, uncut console output missing. > I've also tried using the following command line but this also fails:? > ffmpeg.exe -i sample1.flv -vcodec mpeg4 -acodec libvo-aacenc -ac 1 123.3gp Complete, uncut console output missing. Carl Eugen From ricardohenrylee at gmail.com Mon Jun 11 23:44:13 2012 From: ricardohenrylee at gmail.com (Richard H Lee) Date: Mon, 11 Jun 2012 22:44:13 +0100 Subject: [Libav-user] 2-pass bitrate problem Message-ID: <4FD666AD.2020503@gmail.com> Hi, I have a problem with running the second pass encoding for mpeg4 video using libavcodec. The program that uses the lib is a non-official branch of mplayer2. It works fine for single pass and the first pass of 2 pass encoding. The error I get is "requested bitrate is too low", followed by a segfault. This is a known bug for several years (I think). It basically occurs because the 1st pass log file is misread of something. And hence all_available_bits < all_const_bits in libavcodec/ratecontrol.c always returns true, throwing the error. I would like to try working on this bug. But first of all, I would like to know if anyone else has solved it or made progress on it? Richard From christian.bruemmer at gmx.de Mon Jun 11 23:54:45 2012 From: christian.bruemmer at gmx.de (=?UTF-8?B?Q2hyaXN0aWFuIEJyw7xtbWVy?=) Date: Mon, 11 Jun 2012 23:54:45 +0200 Subject: [Libav-user] Artifacts while encoding x264 video In-Reply-To: References: <4FC7992A.5070704@gmx.de> Message-ID: <4FD66925.50507@gmx.de> Oh - i didnt tried that. I've never used the ffmpeg application but i cant use the same input source cause the dummy images are generated on the fly. but that might be no problems if the configuration is wrong. i think i sould give it a try! Am 11.06.2012 15:06, schrieb Carl Eugen Hoyos: > Christian Br?mmer writes: > >> What can be the reason for those very ugly >> artifacs appearing every few seconds? > Are the artefacts only reproducible with your code > or also with ffmpeg (the application)? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From nitinkumgoyal at gmail.com Tue Jun 12 08:22:35 2012 From: nitinkumgoyal at gmail.com (NITIN GOYAL) Date: Tue, 12 Jun 2012 11:52:35 +0530 Subject: [Libav-user] Video with Multiple Resolutions Message-ID: Hi I have a requirement that i need to create a Video file with multiple resolutions as the raw content I am getting on the stream is of multiple resolutions and keeps on switching the resolutions from time to time. So, i will capture that content and transcode to an avi file with the multiple resolutions. I am not sure if it is possible and if ffmpeg can be used to tweaked in some way to do that. Can anyone guide or advice on the same? Regards Nitin -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbradshaw at sorensonmedia.com Tue Jun 12 19:44:03 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Tue, 12 Jun 2012 11:44:03 -0600 Subject: [Libav-user] How to know if lavf guessed the duration from the bitrate or not? Message-ID: avformat_find_stream_info() attempts to find the file's and streams' durations, but it will guess them based on the bitrate if it can't determine the actual duration. This guess can be useful, but I need to be able to know if the AVFormatContext's or AVStream's duration was a guess based on the bitrate or not, so I know how much I should trust this duration. Is there a way to know this? Thanks, Michael From wagner.patriota at gmail.com Tue Jun 12 21:47:45 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Tue, 12 Jun 2012 16:47:45 -0300 Subject: [Libav-user] Video with Multiple Resolutions In-Reply-To: References: Message-ID: AVI is not good for it... even Microsoft itself would not recommend it. I suggest you to use HLS (HTTP Live Stream)... it's free and works pretty fine. If you really want to use something from Microsoft, you would have to use Microsoft Smooth Streaming. On Tue, Jun 12, 2012 at 3:22 AM, NITIN GOYAL wrote: > Hi > > I have a requirement that i need to create a Video file with multiple > resolutions as the raw content I am getting on the stream is of multiple > resolutions and keeps on switching the resolutions from time to time. > > So, i will capture that content and transcode to an avi file with the > multiple resolutions. > > I am not sure if it is possible and if ffmpeg can be used to tweaked in > some way to do that. > > Can anyone guide or advice on the same? > > Regards > Nitin > > > > _______________________________________________ > 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 Jun 12 22:00:43 2012 From: chisholm at mitre.org (Michael Chisholm) Date: Tue, 12 Jun 2012 16:00:43 -0400 Subject: [Libav-user] avio_* APIs and muxing to memory Message-ID: <4FD79FEB.2030201@mitre.org> So I've been looking at how the I/O APIs have changed, to investigate updating our codebase to work with the latest libav* libraries. Our old way was to create a custom protocol, but the protocol registration APIs have become private. I think I can use the avio_* APIs, but it's awkward. I'm wondering if there is a better way. Our app transcodes video in a streaming fashion, so there is not necessarily any file to read nor any begin or end to the video. It's just a stream (e.g. network stream) you tap into. I need to mux encoded video data to an in-memory buffer. So here are some observations: The avio_*_dyn_buf() functions won't work for that, because that API is written to build up data behind the scenes and not give it to you until you call avio_close_dyn_buf() to close. Since I am working with a conceptually infinite stream, it would build up data infinitely. You can create your own AVIOContext via avio_alloc_context() and pass some reader/writer functions of your own. That seems to assume you want buffering above wherever the data is ultimately going (where your read/writer functions are reading and writing to): the first params are a buffer and size. But in my case, the ultimate destination of the data IS a buffer, and it doesn't make sense to buffer a buffer. That's the awkwardness. I could set the AVIOContext->direct flag, but the docs don't say you're ever allowed to pass NULL as the buffer in avio_alloc_context(), regardless of that flag. From inspecting the code, it seemed like it may work, but I want to rely on the public interface, not a quirk of the current implementation. So I am just wondering if others have found a good way of doing this? Is a NULL buffer supported (if not documented) if you set the direct flag? I am looking at the latest downloadable version, ffmpeg 0.11.1. Thanks Andy From x.morion.x at gmail.com Wed Jun 13 01:36:22 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Wed, 13 Jun 2012 10:36:22 +1100 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: References: Message-ID: 2012/6/10 Andrey Utkin : > Latency you address everywhere in the letter is playback start latency, or > time latency on player side? I assume first. The second. The player's playback position is behind the actual live position by the mentioned latency value. > I just don't know, does iis streaming format have global metadata headers, > or not. If not, the delay could be introduced by seeking for in-stream > metadata. Afaiu x264 encodes instream metadata into keyframes, which go once > per "keyframes interval" video frames. This explains why things are bad on > low fps. You could try reduce keyframe interval for such cases. Also don't sure about global metadata headers, but AVOutputFormat for Smooth Streaming has AVFMT_GLOBALHEADER flag, so seems it has the global headers. Anyway my keyframes interval is as small as possible (every frame is keyframe). From x.morion.x at gmail.com Wed Jun 13 01:54:04 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Wed, 13 Jun 2012 10:54:04 +1100 Subject: [Libav-user] http streaming latency depends on frame rate In-Reply-To: <4FD3D342.9090804@gmail.com> References: <4FD3D342.9090804@gmail.com> Message-ID: 2012/6/10 Camera Man : > What player are you using? Most players (e.g. Windows Media Player or > anything based on the Windows Media Codec infrastructure) will not play > until they have buffered a few seconds of data (this can be adjusted, but > not below 1 second if I recall correctly; the default used to be 5 seconds). I'm using Silverlight SMF player. It have buffering settings, and I've tuned it to not to buffer anything. Also I've tried to stream some low frame rate video from Expression Encoder (a tool that also can produce live Smooth Streaming video), and with it the latency doesn't depend on frame rate. So the problem seems to be on the server side of my application, not on the client (player). > If you are using ffplay / libav / ffmpeg as the decoder, be aware that by > default it will use a multithreaded decoder in which each frame is decoded > by a different thread, where the number of threads is the number of cores; > This configuration introduces a delay of (number of cores) frames in the > ffplay/ffmpeg decoding process, regardless of any other buffer - by > switching to single-threaded mode, you can eliminate this delay. No, the player is in Silverlight, it doesn't support ffmpeg and libav. > Further, depending on your encoding settings, there will be a delay of > (number of reference frames). e.g. I have a camera that puts "number of refs > = 4" in the stream, despite never using more than 1 ref; as a result, every > conforming h264 decoder introduces a delay of 4 frames. This number is > stream dependent and can go as high as 16. If you can control your encoder, > set it to a low-latency mode (which means no B frames, max reorder=0, and > only 1 reference frame). Yes, the encoder is configured to low-latency mode: 1 reference frame, no B-frames (actually even no P-frames, only I-frames), rc-lookahead = 0, sync-lookahead = 0. Didn't find "max reorder" option neither in libav, nor in x264 encoder. From michaelni at gmx.at Wed Jun 13 04:12:43 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 13 Jun 2012 04:12:43 +0200 Subject: [Libav-user] How to know if lavf guessed the duration from the bitrate or not? In-Reply-To: References: Message-ID: <20120613021243.GC19197@kiste2> On Tue, Jun 12, 2012 at 11:44:03AM -0600, Michael Bradshaw wrote: > avformat_find_stream_info() attempts to find the file's and streams' > durations, but it will guess them based on the bitrate if it can't > determine the actual duration. This guess can be useful, but I need to > be able to know if the AVFormatContext's or AVStream's duration was a > guess based on the bitrate or not, so I know how much I should trust > this duration. > > Is there a way to know this? One could parse the av_log() output other then that, i dont think theres a way thats not quite fragile currently. One thing that could be done is extending the API with a flag that specifies the expected accuracy of the duration field [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is dangerous to be right in matters on which the established authorities are wrong. -- Voltaire -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From cehoyos at ag.or.at Wed Jun 13 17:28:25 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 13 Jun 2012 15:28:25 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?avio=5F*_APIs_and_muxing_to_memory?= References: <4FD79FEB.2030201@mitre.org> Message-ID: Michael Chisholm writes: > Is a NULL buffer supported (if not documented) if you set the > direct flag? direct is the intended replacement, while it is not a good idea to pass NULL (that's why it is not documented), it may work. A better idea is to pass a buffer, note that neither the old API nor direct guarantee that no buffering is taking place, but for typical use cases, direct is sufficient. > I am looking at the latest downloadable version, ffmpeg 0.11.1. If you are a user (and not a distributor), you should always use current git head. Carl Eugen From mbradshaw at sorensonmedia.com Wed Jun 13 17:58:49 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 13 Jun 2012 09:58:49 -0600 Subject: [Libav-user] How to know if lavf guessed the duration from the bitrate or not? In-Reply-To: <20120613021243.GC19197@kiste2> References: <20120613021243.GC19197@kiste2> Message-ID: On Tue, Jun 12, 2012 at 8:12 PM, Michael Niedermayer wrote: > On Tue, Jun 12, 2012 at 11:44:03AM -0600, Michael Bradshaw wrote: >> avformat_find_stream_info() attempts to find the file's and streams' >> durations, but it will guess them based on the bitrate if it can't >> determine the actual duration. This guess can be useful, but I need to >> be able to know if the AVFormatContext's or AVStream's duration was a >> guess ? based on the bitrate or not, so I know how much I should trust >> this duration. >> >> Is there a way to know this? > > One could parse the av_log() output other then that, i dont think > theres a way thats not quite fragile currently. > > One thing that could be done is extending the API with ?a flag that > specifies the expected accuracy of the duration field I think the flag would be nice. Would it be added to both AVFormatContext and AVStream, or just one of them? I think AVFormatContext may be sufficient, and would be the simplest (as AVStream has no flags member). Perhaps 3 flags can be added: AVFMT_FLAG_DURATION_FROM_PTS AVFMT_FLAG_DURATION_FROM_STREAM AVFMT_FLAG_DURATION_FROM_BITRATE and estimate_timings() can set the proper flag according to what method it uses. Your thoughts? I can submit a patch today (if you don't beat me to it). Thanks, Michael From krishnaks at iwavesystems.com Thu Jun 14 07:08:41 2012 From: krishnaks at iwavesystems.com (krishnaks at iwavesystems.com) Date: Thu, 14 Jun 2012 10:38:41 +0530 Subject: [Libav-user] Avcodec_decode_video2 clariifcation Message-ID: Hi, I am using following API to decode H264 frame. int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, int *got_picture_ptr, const AVPacket *avpkt); But whenever 3rd parameter got_picture_ptr will be false, after that Whats the decode behavior. After this, Propagation delay is getting added to My application. Only if I am Reinitializing the decoder whenever got_picture_ptr is false(i.e. deleting decoder & Initializing the Avcodec,AvcodecContext etc..) My application will work without a propagation delay. Can anyone explain me what is the reason behind this? If got_picture_ptr is zero/false, how application should handle this so that can avoid propagation delay? Thanks in advance KP From 2508598925 at qq.com Thu Jun 14 03:15:55 2012 From: 2508598925 at qq.com (=?gb18030?B?us7QwNPu?=) Date: Thu, 14 Jun 2012 09:15:55 +0800 Subject: [Libav-user] error in building vlc for ios Message-ID: i catch a error when i build vlc for ios . developement background: ios 4.2 xcode 3.25 mac os 10.6.8 the attachment is my config.log. i hope you can help me,many thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: config.log Type: application/octet-stream Size: 92234 bytes Desc: not available URL: From nrson at win4net.com Thu Jun 14 11:05:27 2012 From: nrson at win4net.com (=?ks_c_5601-1987?B?vNWzsrfK?=) Date: Thu, 14 Jun 2012 18:05:27 +0900 Subject: [Libav-user] how do I solve "libavcodec/x86/h264_i386.h:101:5: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'"? Message-ID: <000601cd4a0c$db1630e0$914292a0$@win4net.com> Hello, I have a referenced in (http://ffmpeg.org/pipermail/ffmpeg-devel/2012- April/123815.html) because I want to speed up in H.264 decoder. However I have an errors during compiling as following: $ make CC libavcodec/h264_cabac.o libavcodec/h264_cabac.c: In function 'decode_cabac_residual_nondc_internal': libavcodec/x86/h264_i386.h:101:5: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' libavcodec/x86/h264_i386.h:101:5: error: 'asm' operand has impossible constraints libavcodec/x86/cabac.h:115:5: error: 'asm' operand has impossible constraints libavcodec/x86/cabac.h:115:5: error: 'asm' operand has impossible constraints libavcodec/x86/cabac.h:115:5: error: 'asm' operand has impossible constraints libavcodec/x86/cabac.h:115:5: error: 'asm' operand has impossible constraints make: *** [libavcodec/h264_cabac.o] Error 1 Also my configure for compiling is as following: $ ./configure --enable-gpl --enable-shared --enable-swscale --enable- hwaccel=h264_dxva2 --enable-decoder=h264 --enable-w32threads --enable-memalign-hack --enable- yasm --disable-libvorbis --enable-cross-compile --target-os=mingw32 --arch=x86 --disable-filters --disable-encoders how do I solve the problems? best regards in advances, -nrson- -------------- next part -------------- An HTML attachment was scrubbed... URL: From leandrosansilva at gmail.com Thu Jun 14 14:46:58 2012 From: leandrosansilva at gmail.com (Leandro Santiago) Date: Thu, 14 Jun 2012 09:46:58 -0300 Subject: [Libav-user] Help using libavfilter: filters aren't being applied Message-ID: Hello to all. I'm trying to use libavfilter and initially I created a simple .c file which reads a frame from a input and convert this frame to an output png image. I tried to follow the file doc/examples/filtering_video.c and right now my program just open a file, get a frame and save it in a PNG. I'm trying to convert pixel format with format filter (but it's not working). I'm also trying do draw a box in the image, but it seems my filter aren't being applied (although the log says they're being created). The complete source code is in: http://pastebin.com/9cjLnXZ6 Can you tell me what I'm doing wrong? The usage is: ./executable input.avi avi # (where avi is the input type) It will create a file called test.png in the current directory. -- ----- Sent from my Atari From cehoyos at ag.or.at Thu Jun 14 16:45:18 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 14 Jun 2012 14:45:18 +0000 (UTC) Subject: [Libav-user] how do I solve References: <000601cd4a0c$db1630e0$914292a0$@win4net.com> Message-ID: ??? writes: > $ ./configure --enable-gpl --enable-shared --enable-swscale > --enable-hwaccel=h264_dxva2 --enable-decoder=h264 > --enable-w32threads --enable-memalign-hack --enable-yasm > --disable-libvorbis > --enable-cross-compile Any reason why you have to use cross-compilation? Carl Eugen From gonzalfj at ymail.com Thu Jun 14 16:58:52 2012 From: gonzalfj at ymail.com (Fabio J. Gonzalez) Date: Thu, 14 Jun 2012 11:58:52 -0300 Subject: [Libav-user] Converting image/video pix format to RGB24? Message-ID: <4fd9fc2c.d4uq53OG5u5ETiHS%gonzalfj@ymail.com> I am developing a free software project. I wonder how to convert any video format supported to RGB24. I want to import the most different formats of video/images, but I want to work only with RGB24. I think for some reason img_convert deprecated(the compiler can not find this function). Know any other function (or way) that does exactly that? From mbradshaw at sorensonmedia.com Thu Jun 14 17:12:22 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 14 Jun 2012 09:12:22 -0600 Subject: [Libav-user] Converting image/video pix format to RGB24? In-Reply-To: <4fd9fc2c.d4uq53OG5u5ETiHS%gonzalfj@ymail.com> References: <4fd9fc2c.d4uq53OG5u5ETiHS%gonzalfj@ymail.com> Message-ID: On Thu, Jun 14, 2012 at 8:58 AM, Fabio J. Gonzalez wrote: > I am developing a free software project. I wonder how to convert any video format supported to RGB24. I want to import the most different formats of video/images, but I want to work only with RGB24. I think for some reason img_convert deprecated(the compiler can not find this function). Know any other function (or way) that does exactly that? You can use libswscale. Look at sws_getContext(), sws_scale(). You can pass the decoded frame to sws_scale(), and the frame you want to copy and convert it into. For this new frame, you'll probably want to allocate memory for the frame's data using avpicture_fill(). --Michael From 2508598925 at qq.com Thu Jun 14 09:19:02 2012 From: 2508598925 at qq.com (=?gb18030?B?us7QwNPu?=) Date: Thu, 14 Jun 2012 15:19:02 +0800 Subject: [Libav-user] build vlc for ios Message-ID: the following is my terminal consoles when i run ./buildMobileVLC.sh,i hope you can help me,many thanks. curl: (6) Couldn't resolve host 'dl.matroska.org' make: *** [../../contrib/tarballs/libebml-1.2.2.tar.bz2] Error 6 make: *** Deleting file `../../contrib/tarballs/libebml-1.2.2.tar.bz2' -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: log.docx Type: application/octet-stream Size: 422987 bytes Desc: not available URL: From killerappzz at gmail.com Thu Jun 14 20:56:39 2012 From: killerappzz at gmail.com (Florin Bratu) Date: Thu, 14 Jun 2012 20:56:39 +0200 Subject: [Libav-user] timestamp error Message-ID: Hello, I have a problem while using the ffmpeg development libraries. What I want to achieve is to create a video file from a sequence of images. The effect should be as similar as the one of issuing the ffmpeg command: $ ffmpeg -i test_%d.jpg -vcodec h263 -s 352x288 out.mp4 However, I need to achieve this programatically as I need to integrate it in a bigger application. As a start I thought of a simple approach: I read each image as an AVFrame and I encode it in the final video. I've quickly hacked an implementation of this approach, you can find the source code at the end of the email. However, when I compile and run it, I get the following error: [h263 @ 0x8058020] Error, Invalid timestamp=0, last=0 I get this error for each AVFrame I try to encode, starting with the second one, the first one is(or seems to be) correctly encoded. What can I do to overcome this issue? While searching through ffmpeg source code I found out that this error is related to PTS, so I tried a quick fix of setting it like this: picture->pts = i; but unfortunately I still get the same error! seems like the new pts value is not even taken into account! Do you have any ideas how to overcome this error? Am I doing something wrong? I am new to ffmpeg development and to the libav-users mailing list, so please pardon my hackish way of using ffmpeg. And feel free to point me any other better ways I could use ffmpeg(apart from the obvious refactoring this code could benefit from) hopefully in time I will arrive to cleanly master its power. Best regards, Florin. #include #include #include #define W_VIDEO 320 #define H_VIDEO 240 AVFrame* OpenImage(const char* imageFileName) { AVFormatContext *pFormatCtx; int ret = av_open_input_file(&pFormatCtx, imageFileName, NULL, 0, NULL); if(ret!=0) { printf("Can't open image file '%s': code %d, %s\n", imageFileName, ret, strerror(AVERROR(ret))); return NULL; } dump_format(pFormatCtx, 0, imageFileName, 0); AVCodecContext *pCodecCtx; pCodecCtx = pFormatCtx->streams[0]->codec; pCodecCtx->width = W_VIDEO; pCodecCtx->height = H_VIDEO; pCodecCtx->pix_fmt = PIX_FMT_YUV420P; // Find the decoder for the video stream AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id); if (!pCodec) { printf("Codec not found\n"); return NULL; } // Open codec if(avcodec_open(pCodecCtx, pCodec)<0) { printf("Could not open codec\n"); return NULL; } // AVFrame *pFrame; pFrame = avcodec_alloc_frame(); if (!pFrame) { printf("Can't allocate memory for AVFrame\n"); return NULL; } int frameFinished; int numBytes; // Determine required buffer size and allocate buffer numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, pCodecCtx->width, pCodecCtx->height); uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t)); avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUVJ420P, pCodecCtx->width, pCodecCtx->height); // Read frame AVPacket packet; int framesNumber = 0; while (av_read_frame(pFormatCtx, &packet) >= 0) { if(packet.stream_index != 0) continue; ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); if (ret > 0) { printf("Frame is decoded, size %d\n", ret); pFrame->quality = 4; // Free the packet that was allocated by av_read_frame av_free_packet(&packet); return pFrame; } else printf("Error [%d] while decoding frame: %s\n", ret, strerror(AVERROR(ret))); } // close codec avcodec_close(pCodecCtx); // Close the video file av_close_input_file(pFormatCtx); return pFrame; } int main(int argc, char *argv[]) { AVCodec *codec; AVCodecContext *c= NULL; int i, out_size, size, x, y, outbuf_size; FILE *f; uint8_t *outbuf; char* vidFileName = argv[1]; printf("Video encoding\n"); /* must be called before using avcodec lib */ avcodec_init(); /* register all the codecs */ avcodec_register_all(); av_register_all(); /* find the mpeg1 video encoder */ codec = avcodec_find_encoder(CODEC_ID_H263); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c= avcodec_alloc_context(); /* put sample parameters */ c->bit_rate = 400000; /* resolution must be a multiple of two */ c->width = 352; c->height = 288; /* frames per second */ c->time_base= (AVRational){1,25}; c->gop_size = 10; /* emit one intra frame every ten frames */ c->pix_fmt = PIX_FMT_YUV420P; /* open it */ if (avcodec_open(c, codec) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(vidFileName, "wb"); if (!f) { fprintf(stderr, "could not open %s\n", vidFileName); exit(1); } /* alloc image and output buffer */ outbuf_size = 100000; outbuf = malloc(outbuf_size); AVFrame *picture; for(i=2;ipts = i; /* encode the image */ out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); printf("encoding frame %3d (size=%5d)\n", i, out_size); fwrite(outbuf, 1, out_size, f); } /* get the delayed frames */ for(; out_size; i++) { fflush(stdout); out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); printf("write frame %3d (size=%5d)\n", i, out_size); fwrite(outbuf, 1, out_size, f); } /* add sequence end code to have a real mpeg file */ outbuf[0] = 0x00; outbuf[1] = 0x00; outbuf[2] = 0x01; outbuf[3] = 0xb7; fwrite(outbuf, 1, 4, f); fclose(f); free(outbuf); avcodec_close(c); av_free(c); av_free(picture); printf("\n"); } -------------- next part -------------- An HTML attachment was scrubbed... URL: From nrson at win4net.com Fri Jun 15 04:12:51 2012 From: nrson at win4net.com (=?utf-8?B?7IaQ64Ko66GA?=) Date: Fri, 15 Jun 2012 11:12:51 +0900 Subject: [Libav-user] how do I solve In-Reply-To: References: <000601cd4a0c$db1630e0$914292a0$@win4net.com> Message-ID: <000001cd4a9c$669a6340$33cf29c0$@win4net.com> Hi There is no reason. However I remove the option(--enable-cross-compile), I can success make. Thank you nrson -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of Carl Eugen Hoyos Sent: Thursday, June 14, 2012 11:45 PM To: libav-user at ffmpeg.org Subject: Re: [Libav-user] how do I solve ??? writes: > $ ./configure --enable-gpl --enable-shared --enable-swscale > --enable-hwaccel=h264_dxva2 --enable-decoder=h264 --enable-w32threads > --enable-memalign-hack --enable-yasm --disable-libvorbis > --enable-cross-compile Any reason why you have to use cross-compilation? Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From namballa.vijaykumar at gmail.com Fri Jun 15 09:18:41 2012 From: namballa.vijaykumar at gmail.com (Vijay Ajay) Date: Fri, 15 Jun 2012 12:48:41 +0530 Subject: [Libav-user] save YUV420p file Message-ID: Hai all, i am decoding jpeg using avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); I want to save pFrame to a file i,e in yuv420 format. Can some one please help me. Thanks in advance. vijay From misha.penkov at gmail.com Fri Jun 15 13:50:01 2012 From: misha.penkov at gmail.com (Misha Penkov) Date: Fri, 15 Jun 2012 20:50:01 +0900 Subject: [Libav-user] avcodec_decode_audio4 yields silence (zero data) Message-ID: Hi, I'm playing around with the FFmpeg tutorials at (http://dranger.com/ffmpeg/) and trying to update them to the most recent version of FFmpeg. I'm having problems decoding audio. In particular, the entire data array of the AVFrame I pass in is zero after decoding. Here's the code around the problem area: int bytes_consumed; int got_frame; bytes_consumed = avcodec_decode_audio4 ( aCodecCtx, frame, &got_frame, &pkt ); if (got_frame) { int bytes_decoded = av_samples_get_buffer_size ( NULL, aCodecCtx->channels, frame->nb_samples, aCodecCtx->sample_fmt, 1 ); int sum = 0; int i = 0; for (i = i; i < bytes_decoded; ++i) sum += abs(frame->data[0][i]); fprintf(stderr, "sum: %d\n", sum); return bytes_decoded; } The whole data array sums to zero every time, and I get silence as output. I'm attaching my full source for reference. Why does this happen? What am I doing wrong? ffmpeg version N-41103-g67b7631 built on Jun 4 2012 17:00:05 with gcc 4.4.3 Thank you in advance for your help. Cheers, Michael -------------- next part -------------- A non-text attachment was scrubbed... Name: tutorial03.c Type: text/x-csrc Size: 16502 bytes Desc: not available URL: From misha.penkov at gmail.com Fri Jun 15 14:18:35 2012 From: misha.penkov at gmail.com (Misha Penkov) Date: Fri, 15 Jun 2012 21:18:35 +0900 Subject: [Libav-user] avcodec_decode_audio4 yields silence (zero data) In-Reply-To: References: Message-ID: I've solved my problem. I wasn't updating the packet correctly in between calls to decode. Please disregard my previous message. Michael On 15 June 2012 20:50, Misha Penkov wrote: > Hi, > > I'm playing around with the FFmpeg tutorials at > (http://dranger.com/ffmpeg/) and trying to update them to the most > recent version of FFmpeg. ?I'm having problems decoding audio. ?In > particular, the entire data array of the AVFrame I pass in is zero > after decoding. > > Here's the code around the problem area: > > int bytes_consumed; > int got_frame; > bytes_consumed = > ? ?avcodec_decode_audio4 > ? ?( > ? ? ? ?aCodecCtx, > ? ? ? ?frame, > ? ? ? ?&got_frame, > ? ? ? ?&pkt > ? ?); > if (got_frame) > { > ? ?int bytes_decoded = > ? ? ? ?av_samples_get_buffer_size > ? ? ? ?( > ? ? ? ? ? ?NULL, > ? ? ? ? ? ?aCodecCtx->channels, > ? ? ? ? ? ?frame->nb_samples, > ? ? ? ? ? ?aCodecCtx->sample_fmt, > ? ? ? ? ? ?1 > ? ? ? ?); > ? ?int sum = 0; > ? ?int i = 0; > ? ?for (i = i; i < bytes_decoded; ++i) > ? ? ? ?sum += abs(frame->data[0][i]); > ? ?fprintf(stderr, "sum: %d\n", sum); > ? ?return bytes_decoded; > } > > The whole data array sums to zero every time, and I get silence as > output. ?I'm attaching my full source for reference. > > Why does this happen? ?What am I doing wrong? > > ffmpeg version N-41103-g67b7631 > built on Jun ?4 2012 17:00:05 with gcc 4.4.3 > > Thank you in advance for your help. > > Cheers, > Michael From rui.luis at gmail.com Fri Jun 15 17:24:50 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Fri, 15 Jun 2012 16:24:50 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID Message-ID: Good Day. I am using ffmepg (0.11) in android through JNI and i have with sucees been able to stream a video. However i am having a huge problem. If i go back and forth in my aplication in order to see several videos after the 4 or 5 video ffmpeg crash and does not output any error. Every time i start the activity that contains the JNI calls to ffmepg it start a new "running" of the ffmpeg. AVFormatContext *pFormatCtx; int video_index = -1; int audio_index = -1; int i; av_log_set_flags(AV_LOG_SKIP_REPEATED); // Register all formats and codecs avcodec_register_all(); av_register_all(); avformat_network_init(); ... and then it crashes in the decoding cycle.. AVPacket pkt1, *packet = &pkt1; if(av_read_frame(global_video_state->pFormatCtx, packet) < 0) { decode_thread_fail(); decodingEnabled = 0; }else{ int failed = 1; if(packet->stream_index == global_video_state->videoStream) { //LOG_INFO("VIDEO"); av_free_packet(packet); //failed=videoDecoderAddPacket(global_video_state,packet); } else if(packet->stream_index == global_video_state->audioStream) { //LOG_INFO("AUDIO"); av_free_packet(packet); //failed=audioDecoderAddPacket(packet); } else { av_free_packet(packet); } if(failed==0){ decodingEnabled = 0; decode_thread_fail(); } } as you can see i am not eveng processing the packets... As i said.. this only occurs after several successfull.... i really need help.. Thanks.. ------ Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexcohn at netvision.net.il Fri Jun 15 19:42:10 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 15 Jun 2012 20:42:10 +0300 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: On Jun 15, 2012 6:24 PM, "Rui Lu?s" wrote: > > Good Day. > I am using ffmepg (0.11) in android through JNI and i have with sucees been able to stream a video. However i am having a huge problem. If i go back and forth in my aplication in order to see several videos after the 4 or 5 video ffmpeg crash and does not output any error. What kind of crash do you get? How do you know it's in ffmpeg? BR, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.bruemmer at gmx.de Sat Jun 16 01:10:56 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-15?Q?Christian_Br=FCmmer?=) Date: Sat, 16 Jun 2012 01:10:56 +0200 Subject: [Libav-user] Split encoded x264 frame into nal units? In-Reply-To: <4FDBC041.7080108@gmx.de> References: <4FDBC041.7080108@gmx.de> Message-ID: <4FDBC100.50800@gmx.de> Hi! I'm using Live555 for RTSP streaming but i need to pass single nal units to the sink. I know a ffmpeg x264 frame may consists of several nal units. How can i split the payload into the nals? Another question: each frame begins with the h264 start code - i have to get rid of it before parsing to the live555 sink. How can i cut off the start code from the payload? It is always the first 4 bytes? Best regards, Christian From christian.bruemmer at gmx.de Sat Jun 16 14:27:49 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-15?Q?Christian_Br=FCmmer?=) Date: Sat, 16 Jun 2012 14:27:49 +0200 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? Message-ID: <4FDC7BC5.8040109@gmx.de> Hi guys! How can i access the x264 encoding configurations to apply custom or default presets and tuning profiles? For live-streaming the zero latency tune seems to fit perfectly my needs but im using ffmpeg for x264 encoding. how can i set the specific x264 configurations ? cant found any informations concerning that via google :/. Best regards, Christian From alexcohn at netvision.net.il Sat Jun 16 17:42:47 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sat, 16 Jun 2012 18:42:47 +0300 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? In-Reply-To: <4FDC7BC5.8040109@gmx.de> References: <4FDC7BC5.8040109@gmx.de> Message-ID: On Jun 16, 2012 3:27 PM, "Christian Br?mmer" wrote: > > Hi guys! > > How can i access the x264 encoding configurations to apply custom or default presets and tuning profiles? > > For live-streaming the zero latency tune seems to fit perfectly my needs but im using ffmpeg for x264 encoding. how can i set the specific x264 configurations ? > > cant found any informations concerning that via google :/. > > Best regards, > Christian http://www.google.com/search?q=ffmpeg+x264+parameters gives a nice even if a bit outdated site http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping BR, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From christian.bruemmer at gmx.de Sat Jun 16 23:57:33 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Sat, 16 Jun 2012 23:57:33 +0200 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? In-Reply-To: References: <4FDC7BC5.8040109@gmx.de> Message-ID: <4FDD014D.8010907@gmx.de> I need information how to set those parameter via c/c++! this where things become tricky Am 16.06.2012 17:42, schrieb Alex Cohn:o > > > On Jun 16, 2012 3:27 PM, "Christian Br?mmer" > > wrote: > > > > Hi guys! > > > > How can i access the x264 encoding configurations to apply custom or > default presets and tuning profiles? > > > > For live-streaming the zero latency tune seems to fit perfectly my > needs but im using ffmpeg for x264 encoding. how can i set the > specific x264 configurations ? > > > > cant found any informations concerning that via google :/. > > > > Best regards, > > Christian > > http://www.google.com/search?q=ffmpeg+x264+parameters gives a nice > even if a bit outdated site > http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping > > BR, Alex Cohn > > > > _______________________________________________ > 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 x.morion.x at gmail.com Sun Jun 17 02:16:27 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Sun, 17 Jun 2012 11:16:27 +1100 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? In-Reply-To: <4FDD014D.8010907@gmx.de> References: <4FDC7BC5.8040109@gmx.de> <4FDD014D.8010907@gmx.de> Message-ID: There is "preset" and "tune" options in ffmpeg, you can set them that way: #include "opt.h" av_opt_set(codecContex->priv_data, "preset", "ultrafast", 0); av_opt_set(codecContex->priv_data, "tune", "zerolatency", 0); where codecContex is AVCodecContext. For other x264 options that isn't presented in ffmpeg you could use "x264opts" option: av_opt_set(codecContex->priv_data, "x264opts", "no-mbtree:sliced-threads:sync-lookahead=0", 0); 2012/6/17 Christian Br?mmer : > I need information how to set those parameter via c/c++! this where things > become tricky From christian.bruemmer at gmx.de Sun Jun 17 12:09:19 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Sun, 17 Jun 2012 12:09:19 +0200 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? In-Reply-To: References: <4FDC7BC5.8040109@gmx.de> <4FDD014D.8010907@gmx.de> Message-ID: <4FDDACCF.1060201@gmx.de> Nice this is exactly what i need! Thank you! Am 17.06.2012 02:16, schrieb Aleksey Shubin: > There is "preset" and "tune" options in ffmpeg, you can set them that way: > > #include "opt.h" > > av_opt_set(codecContex->priv_data, "preset", "ultrafast", 0); > av_opt_set(codecContex->priv_data, "tune", "zerolatency", 0); > > where codecContex is AVCodecContext. > > For other x264 options that isn't presented in ffmpeg you could use > "x264opts" option: > > av_opt_set(codecContex->priv_data, "x264opts", > "no-mbtree:sliced-threads:sync-lookahead=0", 0); > > > 2012/6/17 Christian Br?mmer: >> I need information how to set those parameter via c/c++! this where things >> become tricky > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From christian.bruemmer at gmx.de Sun Jun 17 13:01:02 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Sun, 17 Jun 2012 13:01:02 +0200 Subject: [Libav-user] Split encoded x264 frame into nal units? In-Reply-To: <4FDBC100.50800@gmx.de> References: <4FDBC041.7080108@gmx.de> <4FDBC100.50800@gmx.de> Message-ID: <4FDDB8EE.3080506@gmx.de> Am 16.06.2012 01:10, schrieb Christian Br?mmer: > > Hi! > > I'm using Live555 for RTSP streaming but i need to pass single nal units > to the sink. I know a ffmpeg x264 frame may consists of several nal > units. How can i split the payload into the nals? > > Another question: each frame begins with the h264 start code - i have to > get rid of it before parsing to the live555 sink. How can i cut off the > start code from the payload? It is always the first 4 bytes? > > Best regards, > Christian > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > I figured out that a nal unit (annex b) starts with the startcode 0x00000001 or 0x000001 (depends on the encoder implementation). the size of a nal unit isnt known but you can search for the next startcode and the bytes between are the nal unit. anyway with my encoding configuration i never get more than one startcode at the beginning of a encoded frame. cutting the first 4 bytes off is working for me so far! From christian.bruemmer at gmx.de Sun Jun 17 13:12:33 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Sun, 17 Jun 2012 13:12:33 +0200 Subject: [Libav-user] FFmpeg x264 settings for zero-delay encoding? In-Reply-To: <4FDDACCF.1060201@gmx.de> References: <4FDC7BC5.8040109@gmx.de> <4FDD014D.8010907@gmx.de> <4FDDACCF.1060201@gmx.de> Message-ID: <4FDDBBA1.3080805@gmx.de> The configuration this way is working as expected but i get into another problem., I m using the built in rtsp client to connect to a live555 server. the video is playing perfectly till i lost a packet (for testing purpose im using ffplay) than the decoding breaks and i get many artifacts and flickering which never returns back to a well output. i think this is because of frames which depending on other frames. what im expecting of zerolantency is one packet (frame/nal) is not depending on other frames so it can be decoded as it is. this seems to be not the case. what configuration is needed to get sure one packet - one nal unit can be encoded without another packet/nal unit? Am 17.06.2012 12:09, schrieb Christian Br?mmer: > Nice this is exactly what i need! > > Thank you! > > Am 17.06.2012 02:16, schrieb Aleksey Shubin: >> There is "preset" and "tune" options in ffmpeg, you can set them that >> way: >> >> #include "opt.h" >> >> av_opt_set(codecContex->priv_data, "preset", "ultrafast", 0); >> av_opt_set(codecContex->priv_data, "tune", "zerolatency", 0); >> >> where codecContex is AVCodecContext. >> >> For other x264 options that isn't presented in ffmpeg you could use >> "x264opts" option: >> >> av_opt_set(codecContex->priv_data, "x264opts", >> "no-mbtree:sliced-threads:sync-lookahead=0", 0); >> >> >> 2012/6/17 Christian Br?mmer: >>> I need information how to set those parameter via c/c++! this where >>> things >>> become tricky >> _______________________________________________ >> 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 lizhang at utelisys.com Mon Jun 18 11:30:00 2012 From: lizhang at utelisys.com (Li Zhang) Date: Mon, 18 Jun 2012 11:30:00 +0200 Subject: [Libav-user] How to control av_write_frame() to get a correct frame sequence. Message-ID: Hi everyone, I have a problem when I used av_write_frame() or av_interleaved_write_frame() for TS muxer. The sequence of video and audio is not what I wanted to have. I was trying to output a video frame, and then an audio frame which has similar dts or pts with that video frame. Loop this process, if their dts are different too much, then output a video or audio frame which is slower than the other. However, I can not control the output frame sequence when I used the av_write_frame() or av_interleaved_write_frame(). For example, for my situation, video rate:128kbps, audio:32kbps, then the final output frame sequence I got was: 10-12 video frames and then 10 audio frames(16 188-ts-packets). Then, when I use VLC to play this stream, it always said that like "buffer too early (-40364), down-sampling". After 10 hours, the audio and video is in-synchronized, and audio is about 5 seconds earlier than video. I have tried let VLC to transcode the same stream and output stream with the same parameters. I check VLC'S output stream sequence: video frame-> audio frame->video frame->audio->frame->video frame-> audio frame->video frame->video frame... .... So I am wondering how to control the muxer in ffmpeg to get an output stream with the correct sequence which I want to have. Thanks in advance. Best regards, Li From rui.luis at gmail.com Mon Jun 18 11:26:57 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Mon, 18 Jun 2012 10:26:57 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: I know that is ffmpeg because if i remove the code related to ffmepg it works fine. The problem is that i do not get any error output. i belive the problem is in avformat_network_init(); however i do a deinit in the end.. ------ Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. On Fri, Jun 15, 2012 at 6:42 PM, Alex Cohn wrote: > > On Jun 15, 2012 6:24 PM, "Rui Lu?s" wrote: > > > > Good Day. > > I am using ffmepg (0.11) in android through JNI and i have with sucees > been able to stream a video. However i am having a huge problem. If i go > back and forth in my aplication in order to see several videos after the 4 > or 5 video ffmpeg crash and does not output any error. > > What kind of crash do you get? How do you know it's in ffmpeg? > > BR, > Alex Cohn > > _______________________________________________ > 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 alexcohn at netvision.net.il Mon Jun 18 11:47:19 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Mon, 18 Jun 2012 12:47:19 +0300 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: On Mon, Jun 18, 2012 at 12:26 PM, Rui Lu?s wrote: > The problem is that i do not get any error output. This is very strange. Usually with Android, you can see a crash report with logcat, something like SIGSEGV(11). It is also worthwhile to monitor memory usage when you switch videos. Could it be that you simply run out of memory? BR, Alex Cohn From rui.luis at gmail.com Mon Jun 18 12:33:19 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Mon, 18 Jun 2012 11:33:19 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: SIGSEGV was what i was expeting but nothing appears.. about the memory is no problem because i remove all that is created and i am only using 10mb i try to put the ffmeg initialization to run only once but that also didn't help.. finally some errors that were not appearing in the log cat and now appear just before crashing 06-18 10:59:53.898: W/InputDispatcher(155): channel '4161de58 com.inter/com.inter.aFAndroidActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8 06-18 10:59:53.898: E/InputDispatcher(155): channel '4161de58 com.inter/com.inter.aFAndroidActivity (server)' ~ Channel is unrecoverably broken and will be disposed! Start to search for answer.. but i still didn't find one.. ------ Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. On Mon, Jun 18, 2012 at 10:47 AM, Alex Cohn wrote: > On Mon, Jun 18, 2012 at 12:26 PM, Rui Lu?s wrote: > > > The problem is that i do not get any error output. > > This is very strange. Usually with Android, you can see a crash report > with logcat, something like SIGSEGV(11). It is also worthwhile to > monitor memory usage when you switch videos. Could it be that you > simply run out of memory? > > BR, > Alex Cohn > _______________________________________________ > 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 alexcohn at netvision.net.il Mon Jun 18 14:09:31 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Mon, 18 Jun 2012 15:09:31 +0300 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: On Mon, Jun 18, 2012 at 1:33 PM, Rui Lu?s wrote: > SIGSEGV was what i was expeting but nothing appears.. > about the memory is no problem because i remove all that is created and i > am only using 10mb > > i try to put the ffmeg initialization to run only once but that also > didn't help.. > > finally some errors that were not appearing in the log cat and now appear > just before crashing > > 06-18 10:59:53.898: W/InputDispatcher(155): channel '4161de58 > com.inter/com.inter.aFAndroidActivity (server)' ~ Consumer closed input > channel or an error occurred. events=0x8 > 06-18 10:59:53.898: E/InputDispatcher(155): channel '4161de58 > com.inter/com.inter.aFAndroidActivity (server)' ~ Channel is unrecoverably > broken and will be disposed! > Your crash suggests that some files are closed unexpectedly. BR, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From rui.luis at gmail.com Mon Jun 18 14:56:12 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Mon, 18 Jun 2012 13:56:12 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: I do not open any files. ------ Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. On Mon, Jun 18, 2012 at 1:09 PM, Alex Cohn wrote: > On Mon, Jun 18, 2012 at 1:33 PM, Rui Lu?s wrote: > >> SIGSEGV was what i was expeting but nothing appears.. >> about the memory is no problem because i remove all that is created and i >> am only using 10mb >> >> i try to put the ffmeg initialization to run only once but that also >> didn't help.. >> >> finally some errors that were not appearing in the log cat and now appear >> just before crashing >> >> 06-18 10:59:53.898: W/InputDispatcher(155): channel '4161de58 >> com.inter/com.inter.aFAndroidActivity (server)' ~ Consumer closed input >> channel or an error occurred. events=0x8 >> 06-18 10:59:53.898: E/InputDispatcher(155): channel '4161de58 >> com.inter/com.inter.aFAndroidActivity (server)' ~ Channel is unrecoverably >> broken and will be disposed! >> > > Your crash suggests that some files are closed unexpectedly. > > BR, > Alex Cohn > > _______________________________________________ > 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 alexcohn at netvision.net.il Mon Jun 18 16:00:04 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Mon, 18 Jun 2012 17:00:04 +0300 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: On Mon, Jun 18, 2012 at 3:56 PM, Rui Lu?s wrote: > I do not open any files. > ffmpeg streaming goes through file descriptors. On Mon, Jun 18, 2012 at 1:09 PM, Alex Cohn wrote: > >> On Mon, Jun 18, 2012 at 1:33 PM, Rui Lu?s wrote: >> >>> SIGSEGV was what i was expeting but nothing appears.. >>> about the memory is no problem because i remove all that is created and >>> i am only using 10mb >>> >>> i try to put the ffmeg initialization to run only once but that also >>> didn't help.. >>> >>> finally some errors that were not appearing in the log cat and now >>> appear just before crashing >>> >>> 06-18 10:59:53.898: W/InputDispatcher(155): channel '4161de58 >>> com.inter/com.inter.aFAndroidActivity (server)' ~ Consumer closed input >>> channel or an error occurred. events=0x8 >>> 06-18 10:59:53.898: E/InputDispatcher(155): channel '4161de58 >>> com.inter/com.inter.aFAndroidActivity (server)' ~ Channel is unrecoverably >>> broken and will be disposed! >>> >> >> Your crash suggests that some files are closed unexpectedly. >> > BR, Alex Cohn -------------- next part -------------- An HTML attachment was scrubbed... URL: From leandrosansilva at gmail.com Mon Jun 18 17:56:24 2012 From: leandrosansilva at gmail.com (Leandro Santiago) Date: Mon, 18 Jun 2012 12:56:24 -0300 Subject: [Libav-user] Help using libavfilter: filters aren't being applied In-Reply-To: References: Message-ID: [FIXED] Ooops, The error was mine, not of libavfilter. I was encoding a frame without filtering (a noob's problem of variable name) when I had to use the frame resulted of filer process. 2012/6/14 Leandro Santiago : > Hello to all. I'm trying to use libavfilter and initially I created a > simple .c file which reads a frame from a input and convert this frame > to an output png image. > > I tried to follow the file doc/examples/filtering_video.c and right > now my program just open a file, get a frame and save it in a PNG. I'm > trying to convert pixel format with format filter (but it's not > working). > > I'm also trying do draw a box in the image, but it seems my filter > aren't being applied (although the log says they're being created). > > The complete source code is in: http://pastebin.com/9cjLnXZ6 > > Can you tell me what I'm doing wrong? > > The usage is: > ./executable input.avi avi # (where avi is the input type) > > It will create a file called test.png in the current directory. > > -- > ----- > Sent from my Atari -- ----- Sent from my Atari From rui.luis at gmail.com Mon Jun 18 18:59:03 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Mon, 18 Jun 2012 17:59:03 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: 99% of the time the problem is located between the monitor and the chair.. And this is such a case... After almost a week.. i was able to detect the possible cause of the problem.. and is a memory leak from my side.. some memory that i was counting being removed.. was not.. it seems to be fine now.. Thanks for the help. and sorry for the time spend. ------ Give a man a fish and you feed him for a day. Teach him how to fish and you feed him for a lifetime. On Mon, Jun 18, 2012 at 3:00 PM, Alex Cohn wrote: > On Mon, Jun 18, 2012 at 3:56 PM, Rui Lu?s wrote: > >> I do not open any files. >> > > ffmpeg streaming goes through file descriptors. > > On Mon, Jun 18, 2012 at 1:09 PM, Alex Cohn wrote: >> >>> On Mon, Jun 18, 2012 at 1:33 PM, Rui Lu?s wrote: >>> >>>> SIGSEGV was what i was expeting but nothing appears.. >>>> about the memory is no problem because i remove all that is created and >>>> i am only using 10mb >>>> >>>> i try to put the ffmeg initialization to run only once but that also >>>> didn't help.. >>>> >>>> finally some errors that were not appearing in the log cat and now >>>> appear just before crashing >>>> >>>> 06-18 10:59:53.898: W/InputDispatcher(155): channel '4161de58 >>>> com.inter/com.inter.aFAndroidActivity (server)' ~ Consumer closed input >>>> channel or an error occurred. events=0x8 >>>> 06-18 10:59:53.898: E/InputDispatcher(155): channel '4161de58 >>>> com.inter/com.inter.aFAndroidActivity (server)' ~ Channel is unrecoverably >>>> broken and will be disposed! >>>> >>> >>> Your crash suggests that some files are closed unexpectedly. >>> >> > BR, > Alex Cohn > > _______________________________________________ > 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 alexcohn at netvision.net.il Tue Jun 19 08:24:22 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 19 Jun 2012 09:24:22 +0300 Subject: [Libav-user] save YUV420p file In-Reply-To: References: Message-ID: On Fri, Jun 15, 2012 at 10:18 AM, Vijay Ajay wrote: > Hai all, > > i am decoding jpeg using > > avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); > > I want to save pFrame to a file i,e in yuv420 format. > Can some one please help me. > You can use rawvideo format with yuv pixel format. If you want to access an `AVFrame` structure directly, you should look at `data[0]` (for Y), `data[1]` (for U), and `data[2]` (for V). For Y plane you should read `height` lines, `linesize[0]` bytes per line. For U and V planes, there will be `height/2` lines, and linesize[1] and linesize[2] will define bytes per line for each plane. `linesize` is expected to be the same for U and for V. Thanks in advance. > vijay > Good luck, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From misha.penkov at gmail.com Tue Jun 19 08:37:49 2012 From: misha.penkov at gmail.com (Misha Penkov) Date: Tue, 19 Jun 2012 15:37:49 +0900 Subject: [Libav-user] save YUV420p file In-Reply-To: References: Message-ID: On 19 June 2012 15:24, Alex Cohn wrote: > On Fri, Jun 15, 2012 at 10:18 AM, Vijay Ajay > wrote: >> >> Hai all, >> >> i am decoding jpeg using >> >> avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); >> >> I want ?to save pFrame to a file i,e in yuv420 ?format. >> Can some one please help me. Also have a look at http://dranger.com/ffmpeg/tutorial01.html (there's a more recent version of the source here: https://github.com/mpenkov/sandpit/blob/master/ffmpeg/tutorial01.c) > You can use rawvideo format with yuv pixel format. If you want to access an > `AVFrame` structure directly, you should look at `data[0]` (for Y), > `data[1]` (for U), and `data[2]` (for V). For Y plane you should read > `height` lines, `linesize[0]` bytes per line. For U and V planes, there will > be `height/2` lines, and linesize[1] and linesize[2] will define bytes per > line for each plane. `linesize` is expected to be the same for U and for V. > >> Thanks in advance. >> vijay > > > Good luck, > Alex > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From amir.rouhi at rmit.edu.au Tue Jun 19 09:02:41 2012 From: amir.rouhi at rmit.edu.au (amir.rouhi at rmit.edu.au) Date: Tue, 19 Jun 2012 17:02:41 +1000 Subject: [Libav-user] How to create a video stream without IDR slices? Message-ID: Hi I have a TRECVID database of short videos. I want to convert all of the videos to H.264 AVC format with: 1- Not any IDR slices. & 2- 1 second interval between I slices. Would you let me know how can i achieve this by FFMPEG? Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 19 09:14:24 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 19 Jun 2012 07:14:24 +0000 (UTC) Subject: [Libav-user] How to create a video stream without IDR slices? References: Message-ID: writes: > 1- Not any IDR slices. & > 2- 1 second interval between I slices.? Out of curiosity: Could you explain why you want I-slices / frames but not IDR? > Would you let me know how can i?achieve?this by FFMPEG? FFmpeg does not support h264 encoding, the external library x264 does, so I suspect this is a question for a x264-forum. If you just want to avoid the bitstream peaks that I(DR) produces, try --intra-refresh. Carl Eugen From amir.rouhi at rmit.edu.au Tue Jun 19 11:30:43 2012 From: amir.rouhi at rmit.edu.au (amir.rouhi at rmit.edu.au) Date: Tue, 19 Jun 2012 19:30:43 +1000 Subject: [Libav-user] How to create a video stream without IDR slices? In-Reply-To: References: Message-ID: i have written a code for intra frame extraction out of stream, and the code just work on i slices, IDR slices made some errors with my code. BTW ffmpeg by proper vcodec can encode h264.avc. are you sure it cant? I will check intra-refresh for that purpose. thanks. On 19 June 2012 17:14, Carl Eugen Hoyos wrote: > writes: > > > 1- Not any IDR slices. & > > 2- 1 second interval between I slices. > > Out of curiosity: > Could you explain why you want I-slices / frames but not IDR? > > > Would you let me know how can i achieve this by FFMPEG? > > FFmpeg does not support h264 encoding, the external library > x264 does, so I suspect this is a question for a x264-forum. > > If you just want to avoid the bitstream peaks that I(DR) produces, > try --intra-refresh. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 19 12:01:52 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 19 Jun 2012 10:01:52 +0000 (UTC) Subject: [Libav-user] How to create a video stream without IDR slices? References: Message-ID: writes: > i have written a code for intra frame extraction out of stream, > and the code just work on i slices, IDR slices made some > errors with my code. > BTW ffmpeg by?proper?vcodec can encode h264.avc. are you > sure it cant? It can if you compiled FFmpeg with support for the external library libx264. I just try to explain that since it is an external library (not developed in the FFmpeg project), it may make sense to ask in a x264 forum. > I will check intra-refresh for that purpose. Unfortunately, that will disable all I-frames iiuc. Carl Eugen From amir.rouhi at rmit.edu.au Tue Jun 19 12:19:16 2012 From: amir.rouhi at rmit.edu.au (amir.rouhi at rmit.edu.au) Date: Tue, 19 Jun 2012 20:19:16 +1000 Subject: [Libav-user] How to create a video stream without IDR slices? In-Reply-To: References: Message-ID: what about fixed rate i-frame interval? do you have any idea? for example i want to generate a stream with one i-frame in every 1 second. I have not worked with x264. can you give me more info about how to use it? or whats the difference of x264 and FFmpeg for converting a video to h.264 avc? Thanks On 19 June 2012 20:01, Carl Eugen Hoyos wrote: > writes: > > > i have written a code for intra frame extraction out of stream, > > and the code just work on i slices, IDR slices made some > > errors with my code. > > BTW ffmpeg by proper vcodec can encode h264.avc. are you > > sure it cant? > > It can if you compiled FFmpeg with support for the external > library libx264. I just try to explain that since it is an > external library (not developed in the FFmpeg project), it > may make sense to ask in a x264 forum. > > > I will check intra-refresh for that purpose. > > Unfortunately, that will disable all I-frames iiuc. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 19 12:27:11 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 19 Jun 2012 10:27:11 +0000 (UTC) Subject: [Libav-user] How to create a video stream without IDR slices? References: Message-ID: writes: > what about fixed rate i-frame interval? Afaiu, this produces the IDR frames that you want to avoid. > do you have any idea? for example i want to generate a > stream with one i-frame in every 1 second. > I have not worked with x264. > can you give me more info about how to use it? No, I only know about FFmpeg. > or whats the difference of x264 and FFmpeg for > converting a video to h.264 avc? None, FFmpeg forwards all x264 options to x264, that is why you should ask in a x264 forum. Carl Eugen From christian.bruemmer at gmx.de Tue Jun 19 16:16:52 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-15?Q?Christian_Br=FCmmer?=) Date: Tue, 19 Jun 2012 16:16:52 +0200 Subject: [Libav-user] Byte-Order and AVCodecContext SPS/PPS configuration Message-ID: <4FE089D4.1040508@gmx.de> Hi, i m struggeling while sending the AVCodecContext.extradata (as it is) via Network through a Android-Device which is parsing those informations to the ffmpeg (NDK) decoder. If i use the extradata on the same PC twice for encoding and decoding it works very well but if i try to send it over network to the phone i get "non existing pps 0 referenced" which means wrong pps informations. I know the Endianness of the Windows machine is Little-Endian - the network byteorder is Big-Endian - and the Android-Device is Little-Endian (Java: ByteOrder.nativeOrder() -> Little-Endian). If i try to transfer Integervalues as Bytestream i have to reorder to Little-Endian to get the right representation on the Android-Device. I dont know if the Byte-Array containing the SPS and PPS informations (uint8_*) has to be swapped in any way? In case of a bytestream which gets encoded by ffmpeg i thoughts its nothing i have to worry about. Of course it could be a problem with the parsing/communication - but i want to get sure to be right. Best regards, Christian From christian.bruemmer at gmx.de Tue Jun 19 17:24:43 2012 From: christian.bruemmer at gmx.de (=?ISO-8859-1?Q?Christian_Br=FCmmer?=) Date: Tue, 19 Jun 2012 17:24:43 +0200 Subject: [Libav-user] Byte-Order and AVCodecContext SPS/PPS configuration In-Reply-To: <4FE089D4.1040508@gmx.de> References: <4FE089D4.1040508@gmx.de> Message-ID: <4FE099BB.1040805@gmx.de> After searching for hours i found it was a bug in my JNI-Code. It works as expected. No reordering needed! Nevermind! Am 19.06.2012 16:16, schrieb Christian Br?mmer: > Hi, > > i m struggeling while sending the AVCodecContext.extradata (as it is) > via Network through a Android-Device which is parsing those > informations to the ffmpeg (NDK) decoder. If i use the extradata on > the same PC twice for encoding and decoding it works very well but if > i try to send it over network to the phone i get "non existing pps 0 > referenced" which means wrong pps informations. > > I know the Endianness of the Windows machine is Little-Endian - the > network byteorder is Big-Endian - and the Android-Device is > Little-Endian (Java: ByteOrder.nativeOrder() -> Little-Endian). If i > try to transfer Integervalues as Bytestream i have to reorder to > Little-Endian to get the right representation on the Android-Device. > > I dont know if the Byte-Array containing the SPS and PPS informations > (uint8_*) has to be swapped in any way? In case of a bytestream which > gets encoded by ffmpeg i thoughts its nothing i have to worry about. > Of course it could be a problem with the parsing/communication - but i > want to get sure to be right. > > Best regards, > Christian > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From s3288736 at student.rmit.edu.au Thu Jun 21 03:32:20 2012 From: s3288736 at student.rmit.edu.au (Rouhi Amirhossein) Date: Thu, 21 Jun 2012 11:32:20 +1000 Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? Message-ID: Hi I convert a video from mp4 to elementary stream h264 . but after conversion in spite of same fps but the video looks playing faster . the information of main and converted videos are: main video: Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 513 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc converted video: Stream #0:0: Video: h264 (High), yuv420p, 320x240, 25 fps, 25 tbr, 1200k tbn, 50 tbc tbn shows a big change and fps and tbr are same in the both videos. Regards -- Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From nguyenle.it at gmail.com Thu Jun 21 05:14:54 2012 From: nguyenle.it at gmail.com (clarkkent) Date: Wed, 20 Jun 2012 20:14:54 -0700 (PDT) Subject: [Libav-user] Write decoded file to disk Message-ID: <1340248494110-4655236.post@n4.nabble.com> Hello everybody I was new with FFMPEG. I research about it and try to run the samples of ffmpeg. But some samples don't work correctly. I searched for the answer but got no correct answer. Could anyone help me please? The goal is read an input file from disk then decode a little bit, after that i will write the decoded to a new file. I tried many time but not success yet. I know how to read and decode, but about write a new file to disk, i don't have much knowledge about it The samples i got from this site: http://ffmpeg.org/doxygen/trunk/muxing_8c-source.html Any sample codes would be great. Thanks Clark -- View this message in context: http://libav-users.943685.n4.nabble.com/Write-decoded-file-to-disk-tp4655236.html Sent from the libav-users mailing list archive at Nabble.com. From nguyenle.it at gmail.com Thu Jun 21 06:30:01 2012 From: nguyenle.it at gmail.com (clarkkent) Date: Wed, 20 Jun 2012 21:30:01 -0700 (PDT) Subject: [Libav-user] Convert video from avi to mp4 In-Reply-To: References: Message-ID: <1340253001808-4655237.post@n4.nabble.com> Can you show some code or some examples that work. I tried this one, but it can not run correctly : http://ffmpeg.org/doxygen/trunk/muxing_8c-source.html Thanks Clark -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Convert-video-from-avi-to-mp4-tp4554570p4655237.html Sent from the libav-users mailing list archive at Nabble.com. From alexcohn at netvision.net.il Thu Jun 21 12:22:15 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Thu, 21 Jun 2012 13:22:15 +0300 Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? In-Reply-To: References: Message-ID: On Thu, Jun 21, 2012 at 4:32 AM, Rouhi Amirhossein < s3288736 at student.rmit.edu.au> wrote: > > Hi > I convert a video from mp4 to elementary stream h264 . but after > conversion in spite of same fps but the video looks playing faster . the > information of main and converted videos are: > main video: Stream #0:0(und): Video: h264 (Constrained > Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 513 kb/s, 25 fps, 25 tbr, > 25 tbn, 50 tbc > converted video: Stream #0:0: Video: h264 (High), yuv420p, 320x240, 25 > fps, 25 tbr, 1200k tbn, 50 tbc > tbn shows a big change and fps and tbr are same in the both videos. > Regards > -- > Amir > 1. How do you play back? Which player do you use? 2. How did you convert? Please provide any console output from conversion, too. BR, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From gavlig at gmail.com Thu Jun 21 13:50:40 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Thu, 21 Jun 2012 14:50:40 +0300 Subject: [Libav-user] BGR24 - crash during encoding - FIXED Message-ID: Hey everybody! I've fixed my issue already :) Yes, i needed to convert frames from BGR24 to YUV420p and here how i do it: AVFrame * Videocut::convertFrameToYUV420( AVCodecContext *aCtx, AVFrame *aFrame ) { if (NULL == aFrame || NULL == aCtx) { return NULL; /* NOTREACHED */ } SwsContext *imgConvertCtx = NULL; AVFrame *tempFrame = 0; imgConvertCtx = sws_getContext( aCtx->width, aCtx->height, aCtx->pix_fmt, aCtx->width, aCtx->height, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL ); if (NULL == imgConvertCtx) { cout << "\nCan not initialize the conversion context\n"; return NULL; /* NOTREACHED */ } tempFrame = avcodec_alloc_frame(); if (NULL == tempFrame) { sws_freeContext(imgConvertCtx); return NULL; /* NOTREACHED */ } int numBytes = avpicture_get_size(PIX_FMT_YUV420P, aCtx->width, aCtx->height); uint8_t *buffer = new uint8_t[numBytes]; avpicture_fill( (AVPicture *)tempFrame, buffer, PIX_FMT_YUV420P, aCtx->width, aCtx->height ); sws_scale(imgConvertCtx, aFrame->data, aFrame->linesize, 0, aCtx->height, tempFrame->data, tempFrame->linesize ); av_free(aFrame); sws_freeContext(imgConvertCtx); return tempFrame; } Cheers! gavlig -------------- next part -------------- An HTML attachment was scrubbed... URL: From gavlig at gmail.com Wed Jun 20 23:36:08 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Thu, 21 Jun 2012 00:36:08 +0300 Subject: [Libav-user] BGR24 - crash during encoding Message-ID: Hello everyone! I'm writing an application which cuts videos in pieces with transcoding. Generally it works, but sometimes it crashes on some certain files with BGR24 pix_fmt when i transcode them into mpeg4 with YUV420p. I tracked down that crash and it leaded me to ff_MPV_encode_picture -> load_input_picture, and sigsegv occurres in this loop: for (i = 0; i < 3; i++) { .... int src_stride = pic_arg->linesize[i]; uint8_t *src = pic_arg->data[i]; .... ..... else { while (h--) { memcpy(dst, src, w); //<-----HERE dst += dst_stride; src += src_stride; } } } because src is NULL. Everything was ok when i == 0, but on the next iteration *src* pointer moves to another pic_arg->data[i] which is 0x0... I've noticed that not only pic_arg->data[i], but linesize also contains only one value(-2160) and that confused me a lot. Could anyone tell me how can I fix that? I undestand that frame->data and frame->linesize should contain at least three values, but they contain only one after decoding. At first i though that i need to convert frames from BGR24 to YUV420p, but that doesn't help here is the code of conversation BGR24->YUV420p: AVFrame * Videocut::convertFrameToYUV420( AVCodecContext *aCtx, AVFrame *aFrame ) { if (NULL == aFrame || NULL == aCtx) { return NULL; /* NOTREACHED */ } SwsContext *imgConvertCtx = NULL; AVFrame *tempFrame = 0; /* as we only generate a YUV420P picture, we must convert it to the codec pixel format if needed */ imgConvertCtx = sws_getContext( aCtx->width, aCtx->height, aCtx->pix_fmt, aCtx->width, aCtx->height, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL ); if (NULL == imgConvertCtx) { cout << "\nCan not initialize the conversion context\n"; return NULL; /* NOTREACHED */ } tempFrame = avcodec_alloc_frame(); if (NULL == tempFrame) { sws_freeContext(imgConvertCtx); return NULL; /* NOTREACHED */ } int numBytes = avpicture_get_size(PIX_FMT_YUV420P, aCtx->width, aCtx->height); uint8_t *buffer = new uint8_t[numBytes]; avpicture_fill( (AVPicture *)tempFrame, buffer, PIX_FMT_YUV420P, aCtx->width, aCtx->height ); avcodec_get_frame_defaults(tempFrame); sws_scale(imgConvertCtx, aFrame->data, aFrame->linesize, 0, aCtx->height, tempFrame->data, tempFrame->linesize ); av_freep(aFrame); sws_freeContext(imgConvertCtx); return tempFrame; } I can show you all the code where i decode and encode, but it's all huge and I don't want to make a book from this letter, So you can find it here http://www.pasteall.org/33080/cpp Btw, video has not common size 720x280, i don't if that could help. Any help would be much appreciated! Thank you guys in advance! Best regards, gavlig -------------- next part -------------- An HTML attachment was scrubbed... URL: From gavlig at gmail.com Thu Jun 21 19:07:33 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Thu, 21 Jun 2012 20:07:33 +0300 Subject: [Libav-user] can't perform avformat_seek_file after transcoding Message-ID: Hello again! The issue is that i can't perform avformat_seek_file on video that i have transcoded before(with my application). I've tracked down the cause of the error and it is ff_index_search_timestamp which returns -1. I have no idea what is stream index(except stream index in AVFormatContext) and why it can be -1. I guess that i'm doing transcoding wrong or i just don't store some valuable information into new AVFormatContext before closing it. Any ideas what could it be? And another question, I have one video that flips horizontally after i copy some of it's frames to another AVFormatContext. How can i avoid that? Where is the information about flipping stored? I tried to determine codec manually and change priv_data manually by using corresponding struct, but that was of no help. all code is here http://www.pasteall.org/33080/cpp I think, main parts in this issue are methods openOutput and cutVideo. Any help would be much appreciated! best regards, gavlig -------------- next part -------------- An HTML attachment was scrubbed... URL: From jgraham at cs.unc.edu Thu Jun 21 22:43:46 2012 From: jgraham at cs.unc.edu (Jeremy Graham) Date: Thu, 21 Jun 2012 16:43:46 -0400 Subject: [Libav-user] Decoding a H.264 stream from TCP Message-ID: <4FE38782.2090800@cs.email.edu> Hello, everyone: I am working with the Parrot AR.Drone 2.0. I don't know if anyone is familiar with that device, but to make a long story short, it transmits video data from an on-board camera via TCP and the video is encoded with H.264. I am trying to make a program that continuously receives the TCP packets from the drone and decodes them in order to get the images sent from the camera. Could anyone steer me in the possibly correct direction toward accomplishing this goal? I tried to do it based off of code like what can be found here http://libav.org/doxygen/master/libavcodec_2api-example_8c-example.html or here http://dranger.com/ffmpeg/tutorial01.html. However, I am getting nowhere. I guess getting frame data from network packets is not like getting it from an actual video file. I am a complete novice when it comes to video, codecs, and streaming video over a network. If someone could help me figure out where to even begin I would be so appreciative. Thanks! From gavlig at gmail.com Thu Jun 21 23:30:47 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Fri, 22 Jun 2012 00:30:47 +0300 Subject: [Libav-user] can't perform avformat_seek_file after transcoding -> continue Message-ID: Looks loke i broke index table during transcoding. How can i fix it? > Hello again! > > The issue is that i can't perform avformat_seek_file on video that i have > transcoded before(with my application). > I've tracked down the cause of the error and it is > ff_index_search_timestamp which returns -1. I have no idea what is stream > index(except stream index in AVFormatContext) and why it can be -1. I > guess that i'm doing transcoding wrong or i just don't store some valuable > information into new AVFormatContext before closing it. Any ideas what > could it be? > And another question, > I have one video that flips horizontally after i copy some of it's frames > to another AVFormatContext. How can i avoid that? Where is the information > about flipping stored? I tried to determine codec manually and change > priv_data manually by using corresponding struct, but that was of no help. > all code is here http://www.pasteall.org/33080/cpp > I think, main parts in this issue are methods openOutput and cutVideo. > Any help would be much appreciated! > best regards, > gavlig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From amir.rouhi at rmit.edu.au Fri Jun 22 03:23:27 2012 From: amir.rouhi at rmit.edu.au (amir.rouhi at rmit.edu.au) Date: Fri, 22 Jun 2012 11:23:27 +1000 Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? In-Reply-To: References: Message-ID: For playback i use ffplay or SMplayer, both shows the same, a faster playing video. The encoding command is as bellow: ffmpeg -i C:\r.mp4 -an -vcodec libx264 -threads 0 -f h264 -g 0 C:\r.264 On 21 June 2012 20:22, Alex Cohn wrote: > On Thu, Jun 21, 2012 at 4:32 AM, Rouhi Amirhossein < > s3288736 at student.rmit.edu.au> wrote: > >> >> Hi >> I convert a video from mp4 to elementary stream h264 . but after >> conversion in spite of same fps but the video looks playing faster . the >> information of main and converted videos are: >> main video: Stream #0:0(und): Video: h264 (Constrained >> Baseline) (avc1 / 0x31637661), yuv420p, 320x240, 513 kb/s, 25 fps, 25 tbr, >> 25 tbn, 50 tbc >> converted video: Stream #0:0: Video: h264 (High), yuv420p, 320x240, >> 25 fps, 25 tbr, 1200k tbn, 50 tbc >> tbn shows a big change and fps and tbr are same in the both videos. >> Regards >> -- >> Amir >> > > 1. How do you play back? Which player do you use? > > 2. How did you convert? Please provide any console output from conversion, > too. > > BR, > Alex > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From notzed at gmail.com Fri Jun 22 05:30:23 2012 From: notzed at gmail.com (Michael Zucchi) Date: Fri, 22 Jun 2012 13:00:23 +0930 Subject: [Libav-user] android crash with armeabi-v7a + tegra3 Message-ID: <4FE3E6CF.5090309@gmail.com> Morning, I've been working on an android port of my jjmpeg library (a GPLv3 java binding for FFmpeg) and i've hit a snag when optimising for newer arm devices: for a given video I get a reliable but unpredictable bus error whenever i build for the armeabi-v7a platform. I've included details below. I've seen it crash in other decoders as well, but usually at one of those low-level asm lines. It happens with 0.10.4 or 0.11.1, but i haven't tried HEAD yet. It usually happens after about 5 minutes of video playing, but can vary from 1-20, so it's a bit of a pain to debug. I've tried various player designs from simple single-threaded to many-threaded ones, opengles or not, etc. I don't see such problems if i use just plain armeabi (armv5 i guess), or on amd64/x86 cpus. I still get the same problem if i disable neon and/or vfp as well, it just seems to be related to armeabi-v7a on the tablet i'm using. The device is a tegra 3 tablet (asus transformer prime w/ latest vendor firmware). It doesn't appear to crash in the emulator, but that is only a single-cpu so isn't hitting the same code-paths. It's the only device I have access to at the moment but i'll probably get some cheap chinese arm device(s) to play with soon. I've run out of ideas at my end, but if anyone has any pointers? If I can't get anywhere I will just default to armeabi for development and put it down to a shitty piece of hardware, so it's not a show-stopper for me, just a pita and a big waste of time. Regards, Michael Z PS I tried compiling with no optimisation but the build fails if i do that, so the bt is a bit off. Program received signal SIGBUS, Bus error. [Switching to Thread 1495] mpeg4_decode_block (s=0x1f97f40, block=0x20b0870, n=18, coded=, intra=292, rvlc=1536293248) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavutil/arm/intreadwrite.h:54 54 __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*q)); (gdb) where #0 mpeg4_decode_block (s=0x1f97f40, block=0x20b0870, n=18, coded=, intra=292, rvlc=1536293248) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavutil/arm/intreadwrite.h:54 #1 0x5b91f980 in mpeg4_decode_mb (s=0x1f97f40, block=0x20b0770) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/mpeg4videodec.c:1477 #2 0x5b79820c in decode_slice (s=0x1f97f40) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/h263dec.c:217 #3 0x5b799704 in ff_h263_decode_frame (avctx=0x1f66570, data=, data_size=, avpkt=) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/h263dec.c:675 #4 0x5b99bd84 in frame_worker_thread (arg=) at /home/notzed/svn/jjmpeg-0.10/jjmpeg-core/jni/ffmpeg-0.10/libavcodec/pthread.c:381 #5 0x40073e30 in __thread_entry () from /home/notzed/svn/jjmpeg-0.10/jjmpeg-android/obj/local/armeabi-v7a/libc.so #6 0x40073984 in pthread_create () from /home/notzed/svn/jjmpeg-0.10/jjmpeg-android/obj/local/armeabi-v7a/libc.so #7 0x00000000 in ?? () (gdb) info registers r0 0x1 1 r1 0x7 7 r2 0x12 18 r3 0xe97f 59775 r4 0x4 4 r5 0x1f97f40 33128256 r6 0x20b0870 34277488 r7 0x5bf1a72c 1542563628 r8 0x29ec 10732 r9 0x215b710 34977552 r10 0x1f980b0 33128624 r11 0x20acd58 34262360 r12 0xa 10 sp 0x5ceb6cb8 0x5ceb6cb8 lr 0x5b91f980 1536293248 pc 0x5b91df5c 0x5b91df5c fps 0x0 0 cpsr 0x80000010 2147483664 (gdb) disassemble Dump of assembler code for function mpeg4_decode_block: ... 0x5b91df34 : strne r2, [sp, #28] 0x5b91df38 : strne r3, [sp, #20] 0x5b91df3c : movw r3, #10740 ; 0x29f4 0x5b91df40 : movw r8, #10732 ; 0x29ec 0x5b91df44 : movw r12, #63488 ; 0xf800 0x5b91df48 : ldr r3, [r5, r3] 0x5b91df4c : movt r12, #65535 ; 0xffff 0x5b91df50 : str r12, [sp, #40] 0x5b91df54 : and r1, r3, #7 ; 0x7 0x5b91df58 : ldr r9, [r5, r8] 0x5b91df5c : ldr r2, [r9, r3, lsr #3] 0x5b91df60 : rev r2, r2 0x5b91df64 : mov r1, r2, lsl r1 0x5b91df68 : mov r2, r1, lsr #23 0x5b91df6c : mov r2, r2, lsl #2 (gdb) x /10x 0x1f97f40 + 0x29ec 0x1f9a92c: 0x0215b710 0x02160a22 0x0000e967 0x00029890 0x1f9a93c: 0x00029898 0x00000000 0x00000000 0x00000000 0x1f9a94c: 0x00000000 0x00000001 (gdb) x /10x 0x215b710 + (0xe97f >> 3) 0x215d43f: 0xa20f047d 0x08142840 0xdeb9354c 0xb24ba7f7 0x215d44f: 0xb6d71947 0xf7bedeb5 0x9f318e57 0xfa883a97 0x215d45f: 0xf45edcda 0xd02a0f51 Build config #define FFMPEG_CONFIGURATION "--prefix=/home/notzed/svn/jjmpeg-0.10/jjmpeg-android/jni/build/armeabi-v7a --cross-prefix=/usr/local/android-ndk-r7c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- --enable-cross-compile --target-os=linux --extra-cflags='-I/usr/local/android-ndk-r7c/platforms/android-8/arch-arm//usr/include -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a -g -O0 --sysroot=/usr/local/android-ndk-r7c/platforms/android-8/arch-arm/' --extra-ldflags='-L/usr/local/android-ndk-r7c/platforms/android-8/arch-arm//usr/lib --sysroot=/usr/local/android-ndk-r7c/platforms/android-8/arch-arm/' --arch=arm --disable-stripping --enable-debug --assert-level=2 --disable-shared --enable-static --disable-symver --enable-pthreads --enable-gpl --enable-version3 --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-avdevice --disable-avfilter --disable-postproc" #define ARCH_ARM 1 #define HAVE_ARMV5TE 1 #define HAVE_ARMV6 1 #define HAVE_ARMV6T2 1 #define HAVE_ARMVFP 1 #define HAVE_NEON 1 #define HAVE_VFPV3 1 #define HAVE_FAST_UNALIGNED 1 #define HAVE_PTHREADS 1 From cehoyos at ag.or.at Fri Jun 22 08:45:33 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 06:45:33 +0000 (UTC) Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? References: Message-ID: writes: > For playback i use ffplay or SMplayer, both shows the same, > a faster playing video. The encoding command is as bellow: > ffmpeg -i C:\r.mp4 -an -vcodec libx264 -threads 0 ?-f h264 -g 0 C:\r.264 Complete, uncut console output missing. I believe that ffplay and SMplayer are not good at playing raw h264 content (speed-wise). Carl Eugen From amir.rouhi at rmit.edu.au Fri Jun 22 09:40:05 2012 From: amir.rouhi at rmit.edu.au (amir.rouhi at rmit.edu.au) Date: Fri, 22 Jun 2012 17:40:05 +1000 Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? In-Reply-To: References: Message-ID: Would you explain more? what item missing in my command? And whats your suggestion for a player for raw 264 stream? On 22 June 2012 16:45, Carl Eugen Hoyos wrote: > writes: > > > For playback i use ffplay or SMplayer, both shows the same, > > a faster playing video. The encoding command is as bellow: > > ffmpeg -i C:\r.mp4 -an -vcodec libx264 -threads 0 -f h264 -g 0 C:\r.264 > > Complete, uncut console output missing. > > I believe that ffplay and SMplayer are not good at playing > raw h264 content (speed-wise). > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Jun 22 09:54:19 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 07:54:19 +0000 (UTC) Subject: [Libav-user] android crash with armeabi-v7a + tegra3 References: <4FE3E6CF.5090309@gmail.com> Message-ID: Michael Zucchi writes: > PS I tried compiling with no optimisation but the build > fails if i do that How? / Did you report this? It may make sense to fix this to get more useful information about the crash. What about --disable-asm (--disable-neon if this is neon)? Carl Eugen From cehoyos at ag.or.at Fri Jun 22 09:55:23 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 07:55:23 +0000 (UTC) Subject: [Libav-user] Decoding a H.264 stream from TCP References: <4FE38782.2090800@cs.email.edu> Message-ID: Jeremy Graham writes: > I am working with the Parrot AR.Drone 2.0. I don't know if anyone is > familiar with that device, but to make a long story short, it transmits > video data from an on-board camera via TCP and the video is encoded with > H.264. Did you try ffmpeg -i http://xxxx ? Does it work? Carl Eugen From cehoyos at ag.or.at Fri Jun 22 09:58:23 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 07:58:23 +0000 (UTC) Subject: [Libav-user] Why video plays faster after conversion in spite of same FPS? References: Message-ID: writes: > Would you explain more? what item missing in my command? What is missing of "complete, uncut console output"? Everything. > And whats your?suggestion?for a player for raw 264 stream? Unfortunately, I don't have a suggestion, but I remember that playback speed looks sometimes incorrect for raw h264, so it is difficult to say if this is an encoding or a decoding issue. Carl Eugen From notzed at gmail.com Fri Jun 22 12:19:01 2012 From: notzed at gmail.com (Michael Zucchi) Date: Fri, 22 Jun 2012 19:49:01 +0930 Subject: [Libav-user] android crash with armeabi-v7a + tegra3 In-Reply-To: References: <4FE3E6CF.5090309@gmail.com> Message-ID: <4FE44695.2030708@gmail.com> Hi Carl, On 22/06/12 17:24, Carl Eugen Hoyos wrote: > Michael Zucchi writes: > >> PS I tried compiling with no optimisation but the build >> fails if i do that > > How? / Did you report this? I didn't report it because I assumed it was a mistake my end or just an unsupported configuration. I tried various things in the past but following this email I had another go to confirm the details. The configure options are otherwise the same as in my previous email. If I add: --disable-optimisations So it looks like the FFmpeg build itself goes through (i'm only building the libs), but when linking to my code it fails with a bunch of stuff like this: /home/notzed/svn/jjmpeg-0.11/jjmpeg-android/obj/local/armeabi/libavcodec.a(h264dsp_init_arm.o): In function `ff_h264dsp_init_neon': /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/h264dsp_init_arm.c:99: undefined reference to `ff_h264_v_loop_filter_luma_neon' /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/h264dsp_init_arm.c:99: undefined reference to `ff_h264_h_loop_filter_luma_neon' .. a bunch more in the same file /home/notzed/svn/jjmpeg-0.11/jjmpeg-android/obj/local/armeabi-v7a/libavcodec.a(h264pred_init_arm.o): In function `ff_h264_pred_init_neon': /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/h264pred_init_arm.c:77: undefined reference to `ff_pred8x8_vert_neon' /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/h264pred_init_arm.c:77: undefined reference to `ff_pred8x8_hor_neon' /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/h264pred_init_arm.c:77: undefined reference to `ff_pred8x8_plane_neon' .. and more in that file > It may make sense to fix this to get more useful information > about the crash. Yeah, I thought as much. > What about --disable-asm (--disable-neon if this is neon)? If I also add to the above: --disable-asm Then it builds and runs ok - but it doesn't crash either. I didn't test it exhaustively - but I will leave it running for the next hour (the length of the video) in gdb and see how it goes (i got sidetracked and tried more stuff and it's still going after nearly an hour). But this is close to the 'armeabi' config anyway which i've already found to be pretty stable. If I change that to: --disable-neon Then the FFmpeg build fails on the first file: /usr/local/android-ndk-r7c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -I. -I/home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -DHAVE_AV_CONFIG_H -I/usr/local/android-ndk-r7c/platforms/android-8/arch-arm//usr/include -mfloat-abi=softfp -mfpu=neon -marm -march=armv7-a --sysroot=/usr/local/android-ndk-r7c/platforms/android-8/arch-arm/ -std=c99 -fPIC -marm -g -Wdeclaration-after-statement -Wall -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wno-pointer-sign -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -Werror=implicit-function-declaration -Werror=missing-prototypes -MMD -MF libavformat/4xm.d -MT libavformat/4xm.o -c -o libavformat/4xm.o /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavformat/4xm.c In file included from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/intmath.h:36, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/common.h:102, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/avutil.h:327, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/samplefmt.h:22, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/avcodec.h:30, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavformat/avformat.h:197, from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavformat/4xm.c:32: /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/arm/intmath.h: In function 'av_clip_uintp2_arm': /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/arm/intmath.h:82: warning: asm operand 2 probably doesn't match constraints /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavutil/arm/intmath.h:82: error: impossible constraint in 'asm' make[1]: *** [libavformat/4xm.o] Error 1 If I comment out av_clip_uintp2_arm() in that function, then it compiles until it hits this: In file included from /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/dca.c:48: /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/dca.h: In function 'decode_blockcodes': /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/dca.h:36: error: can't find a register in class 'CORE_REGS' while reloading 'asm' /home/notzed/svn/jjmpeg-0.11/jjmpeg-core/jni/ffmpeg-0.11/libavcodec/arm/dca.h:36: error: 'asm' operand has impossible constraints If I comment out decode_blockcodes() it compiles the libraries ok. But then it fails linking my library with all the missing *_neon functions as described in the first part of this mail. I can log reports for this if that would help. Michael From lizhang at utelisys.com Fri Jun 22 12:37:14 2012 From: lizhang at utelisys.com (Li Zhang) Date: Fri, 22 Jun 2012 12:37:14 +0200 Subject: [Libav-user] how to configure rc_buffer_size and muxrate? Message-ID: Hi everyone, Can anybody tell me what the relationship between rc_buffer_size and muxrate or output video stream bit rate? I want to get a CRB output when I using ffmpeg to perform H.264 encoding. oVcc is AVCodecContext pointer, and output_context is the AVFormatContext pointer. v_bitrate is the the output video stream bit rate which I wanted. oVcc->rc_min_rate = v_bitrate; oVcc->rc_max_rate = v_bitrate; oVcc->bit_rate_tolerance = v_bitrate; oVcc->rc_buffer_size = ?????????; oVcc->rc_initial_cplx = 0.5; oVcc->rc_initial_buffer_occupancy = oVcc->rc_buffer_size*3/4; oVcc->rc_buffer_aggressivity = (float)1.0; oVcc->qcompress = 0.0f; And how to configure the muxrate further? Should it be the sum of video bit rate and audio bit rate? Here is a sample output information of H.264 from FFmpeg. Is this all right? Output #0, mpegts, to 'udp://130.89.172.7:1254': Stream #0:0, 0, 1/90000: Video: h264 (hq), yuv420p, 704x576 [SAR 16:11 DAR 16:9], 1/25, q=10-51, 1300 kb/s, 90k tbn, 25 tbc Stream #0:1, 0, 1/90000: Audio: aac (LC), 48000 Hz, stereo, s16, 96 kb/s err{or,}_recognition separate: 1; 1 err{or,}_recognition combined: 1; 10001 using SAR=16/11 using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX profile High, level 3.0 264 - core 122 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=30 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=1300 ratetol=1.0 qcomp=0.00 qpmin=10 qpmax=51 qpstep=4 vbv_maxrate=1300 vbv_bufsize=52 nal_hrd=none ip_ratio=1.40 aq=1:1.00 err{or,}_recognition separate: 1; 1 err{or,}_recognition combined: 1; 10001 muxrate 1396000, pcr every 18 pkts, sdt every 464, pat/pmt every 92 pkts. Best regards, Li Zhang From cehoyos at ag.or.at Fri Jun 22 16:04:44 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 14:04:44 +0000 (UTC) Subject: [Libav-user] android crash with armeabi-v7a + tegra3 References: <4FE3E6CF.5090309@gmail.com> <4FE44695.2030708@gmail.com> Message-ID: Michael Zucchi writes: > undefined reference to > `ff_h264_v_loop_filter_luma_neon' Could you test the patch I attached to ticket 1241? https://ffmpeg.org/trac/ffmpeg/ticket/1241 Consider reporting the --disable-neon problem... Thank you, Carl Eugen From jgraham at cs.unc.edu Fri Jun 22 16:43:42 2012 From: jgraham at cs.unc.edu (Jeremy Graham) Date: Fri, 22 Jun 2012 10:43:42 -0400 Subject: [Libav-user] Decoding a H.264 stream from TCP In-Reply-To: References: <4FE38782.2090800@cs.email.edu> Message-ID: <4FE4849E.4070006@cs.email.edu> I typed in the following command while the drone was streaming data: jeramboquai at jeramboquai-NV55S:~/Documents$ ffmpeg -i http://192.168.1.1:5555 It immediately output this and then paused, I assume to attempt to interpret the stream: ffmpeg version git-2012-06-20-b2e2287 Copyright (c) 2000-2012 the FFmpeg developers builjeramboquai at jeramboquai-NV55S:~/Documents$ ffmpeg -i http://192.168.1.1:5555 ffmpeg version git-2012-06-20-b2e2287 Copyright (c) 2000-2012 the FFmpeg developers built on Jun 20 2012 17:25:25 with gcc 4.6.3 configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab libavutil 51. 59.100 / 51. 59.100 libavcodec 54. 27.100 / 54. 27.100 libavformat 54. 9.100 / 54. 9.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 82.100 / 2. 82.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 libpostproc 52. 0.100 / 52. 0.100 When I stopped the stream it then output this: [h264 @ 0xada1260] non-existing PPS referenced [h264 @ 0xada1260] non-existing PPS 0 referenced [h264 @ 0xada1260] decode_slice_header error [h264 @ 0xada1260] no frame! [h264 @ 0xad993e0] max_analyze_duration 5000000 reached at 5000000 [h264 @ 0xad993e0] Estimating duration from bitrate, this may be inaccurate ...and then after a few seconds, it output this and quit. Input #0, h264, from 'http://192.168.1.1:5555': Duration: N/A, bitrate: N/A Stream #0:0: Video: h264 (Baseline), yuv420p, 640x360, 25 fps, 25 tbr, 1200k tbn, 50 tbc At least one output file must be specified It appears that it tried to decode SOMETHING, but couldn't. So no, it apparently didn't work. :( On 06/22/2012 03:55 AM, Carl Eugen Hoyos wrote: > Jeremy Graham writes: > >> I am working with the Parrot AR.Drone 2.0. I don't know if anyone is >> familiar with that device, but to make a long story short, it transmits >> video data from an on-board camera via TCP and the video is encoded with >> H.264. > Did you try ffmpeg -i http://xxxx ? > Does it work? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From cehoyos at ag.or.at Fri Jun 22 16:46:44 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 22 Jun 2012 14:46:44 +0000 (UTC) Subject: [Libav-user] Decoding a H.264 stream from TCP References: <4FE38782.2090800@cs.email.edu> <4FE4849E.4070006@cs.email.edu> Message-ID: Jeremy Graham writes: > Input #0, h264, from 'http://192.168.1.1:5555': > Duration: N/A, bitrate: N/A > Stream #0:0: Video: h264 (Baseline), yuv420p, 640x360, 25 fps, 25 > tbr, 1200k tbn, 50 tbc > At least one output file must be specified > > It appears that it tried to decode SOMETHING, but couldn't. So no, it > apparently didn't work. :( Afaict, it works fine. You can either specify an output file if you want to transcode or use ffplay for playback. Please do not top-post here. Carl Eugen From gavlig at gmail.com Fri Jun 22 16:50:28 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Fri, 22 Jun 2012 17:50:28 +0300 Subject: [Libav-user] can't perform avformat_seek_file after transcoding[RESOLVED] Message-ID: Last issue is fixed, i was breaking index table by not specifying which frame is key after encoding. these four lines fix everything: if (outputStream->codec->coded_frame->key_frame) packet.flags |= AV_PKT_FLAG_KEY; else packet.flags ^= AV_PKT_FLAG_KEY; Now issue with flipping left, does anybody have any ideas about it? :) Looks loke i broke index table during transcoding. How can i fix it? ... > Hello again! > > The issue is that i can't perform avformat_seek_file on video that i have > transcoded before(with my application). > I've tracked down the cause of the error and it is > ff_index_search_timestamp which returns -1. I have no idea what is stream > index(except stream index in AVFormatContext) and why it can be -1. I > guess that i'm doing transcoding wrong or i just don't store some valuable > information into new AVFormatContext before closing it. Any ideas what > could it be? > And another question, > I have one video that flips horizontally after i copy some of it's frames > to another AVFormatContext. How can i avoid that? Where is the information > about flipping stored? I tried to determine codec manually and change > priv_data manually by using corresponding struct, but that was of no help. > all code is here http://www.pasteall.org/33080/cpp > I think, main parts in this issue are methods openOutput and cutVideo. > Any help would be much appreciated! > best regards, > gavlig > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jgraham at cs.unc.edu Fri Jun 22 22:02:29 2012 From: jgraham at cs.unc.edu (Jeremy Graham) Date: Fri, 22 Jun 2012 16:02:29 -0400 Subject: [Libav-user] Decoding a H.264 stream from TCP In-Reply-To: References: <4FE38782.2090800@cs.email.edu> <4FE4849E.4070006@cs.email.edu> Message-ID: <4FE4CF55.9060800@cs.email.edu> Hmm...using ffplay did open a window but nothing showed but an entirely black image. In either case, I was actually interested in decoding frames as they appear in the network socket so that I can get the images from the camera to do some real-time processing. With that in mind, would you happen to have any advice? My apologizes for the "top post". Just for my own information, is top-posting where you quote a prior message in a thread in your response? Thanks for your input too! From mbradshaw at sorensonmedia.com Fri Jun 22 22:12:21 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Fri, 22 Jun 2012 14:12:21 -0600 Subject: [Libav-user] Decoding a H.264 stream from TCP In-Reply-To: <4FE4CF55.9060800@cs.email.edu> References: <4FE38782.2090800@cs.email.edu> <4FE4849E.4070006@cs.email.edu> <4FE4CF55.9060800@cs.email.edu> Message-ID: On Fri, Jun 22, 2012 at 2:02 PM, Jeremy Graham wrote: > In either case, I was actually interested in decoding frames as they appear > in the network socket so that I can get the images from the camera to do > some real-time processing. ?With that in mind, would you happen to have any > advice? If you want to use libav* to decode the video in your own program, you certainly can do that. When you open a "file" you pass it a URL (if it's just a file on your local hard drive, you can pass something like "video.mov" and it will open it with the file protocol). If your "filename" was something like "http://192.168.1.1:5555" it should open it just fine, and you can decode incoming frames like normal. > My apologizes for the "top post". ?Just for my own information, is > top-posting where you quote a prior message in a thread in your response? "top posting" is when you quote someone and put your response above theirs (on top of theirs). Bottom posting (which is what's encouraged on these mailing lists) is when you quote someone and put your response below theirs (like Carl and I have done). (Relevant Wikipedia article: http://en.wikipedia.org/wiki/Posting_style) --mbradshaw From notzed at gmail.com Sat Jun 23 06:09:15 2012 From: notzed at gmail.com (Michael Zucchi) Date: Sat, 23 Jun 2012 13:39:15 +0930 Subject: [Libav-user] android crash with armeabi-v7a + tegra3 In-Reply-To: References: <4FE3E6CF.5090309@gmail.com> <4FE44695.2030708@gmail.com> Message-ID: <4FE5416B.2030709@gmail.com> On 22/06/12 23:34, Carl Eugen Hoyos wrote: > Michael Zucchi writes: > >> undefined reference to >> `ff_h264_v_loop_filter_luma_neon' > > Could you test the patch I attached to ticket 1241? > https://ffmpeg.org/trac/ffmpeg/ticket/1241 I had a look at that patch, and changed it for 0.11, but ... Now when I use --disable-optimizations at all it just always fails straight away with the impossible constraint errors - sorry i think i had some stale build issues with my still immature build system. I found adding --enable-small allowed most of it to build, until some nested macro code broke. I filed a bug with all the details and a patch for the macro code. https://ffmpeg.org/trac/ffmpeg/ticket/1479 I now have a build with debug on, optimisations off, inline asm on, and it still crashes which is what i was after. Except the backtrace is just the same so i've basically gotten no-where. > Consider reporting the --disable-neon problem... This was with --disable-optimisations on, so that's the same bug as above. --disable-neon on it's own builds. From notzed at gmail.com Sat Jun 23 07:34:06 2012 From: notzed at gmail.com (Michael Zucchi) Date: Sat, 23 Jun 2012 15:04:06 +0930 Subject: [Libav-user] android crash with armeabi-v7a + tegra3 In-Reply-To: <4FE5416B.2030709@gmail.com> References: <4FE3E6CF.5090309@gmail.com> <4FE44695.2030708@gmail.com> <4FE5416B.2030709@gmail.com> Message-ID: <4FE5554E.70305@gmail.com> I did more research, it looks like this tablet has the unaligned access set to cause a bus error in the kernel. I don't have access to the TRM so I don't know if this is tegra-related, or just an asus kernel decision. I manually changed HAVE_FAST_UNALIGNED to 0, and so far have had no problems, even with optimisations enabled. There doesn't seem much point in trying to detect this behaviour at run-time (if it's even possible/practical) so perhaps fast_unaligned needs to be an option and not just based on the cpu architecture. I'm mostly just surprised it happens so rarely, as I would've expected it to pop up a lot. (I can't confirm this against git head at this time, although the relevant arm bits look the same to me). From cehoyos at ag.or.at Sat Jun 23 08:58:34 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 23 Jun 2012 06:58:34 +0000 (UTC) Subject: [Libav-user] android crash with armeabi-v7a + tegra3 References: <4FE3E6CF.5090309@gmail.com> <4FE44695.2030708@gmail.com> <4FE5416B.2030709@gmail.com> Message-ID: Michael Zucchi writes: > >> undefined reference to > >> `ff_h264_v_loop_filter_luma_neon' > > > > Could you test the patch I attached to ticket 1241? > > https://ffmpeg.org/trac/ffmpeg/ticket/1241 > > I had a look at that patch, and changed it for 0.11, but ... If you use a minimal configure line - something like --enable-cross-compile --cc=... - with --disable-optimizations --disable-neon on current git head, does compilation succeed? Carl Eugen From notzed at gmail.com Sat Jun 23 10:03:45 2012 From: notzed at gmail.com (Michael Zucchi) Date: Sat, 23 Jun 2012 17:33:45 +0930 Subject: [Libav-user] android crash with armeabi-v7a + tegra3 In-Reply-To: References: <4FE3E6CF.5090309@gmail.com> <4FE44695.2030708@gmail.com> <4FE5416B.2030709@gmail.com> Message-ID: <4FE57861.90703@gmail.com> On 23/06/12 16:28, Carl Eugen Hoyos wrote: > Michael Zucchi writes: > >>>> undefined reference to >>>> `ff_h264_v_loop_filter_luma_neon' >>> >>> Could you test the patch I attached to ticket 1241? >>> https://ffmpeg.org/trac/ffmpeg/ticket/1241 >> >> I had a look at that patch, and changed it for 0.11, but ... > > If you use a minimal configure line - something like > --enable-cross-compile --cc=... - with --disable-optimizations > --disable-neon on current git head, does compilation succeed? > Updated the bug. Seems my configure line is pretty busted as well. From krishnaks at iwavesystems.com Sat Jun 23 15:01:33 2012 From: krishnaks at iwavesystems.com (krishnaks at iwavesystems.com) Date: Sat, 23 Jun 2012 18:31:33 +0530 Subject: [Libav-user] Avcodec_decode_video2 clariifcation In-Reply-To: References: Message-ID: <3f98f7072e9b6c82a598cddd1baadcf1.squirrel@124.124.219.233> Hi, I am still unable to solve this issue. Is this issue related to network? Because most of the time got_picture_ptr will be zero only when packet arrival rate is not uniform. i.e Duration between previous packet arrival & current packet arrival is double(some time trible also) of expected duration. > Hi, > > I am using following API to decode H264 frame. > > int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, > int *got_picture_ptr, > const AVPacket *avpkt); > But whenever 3rd parameter got_picture_ptr will be false, after that Whats > the decode behavior. > After this, Propagation delay is getting added to My application. > Only if I am Reinitializing the decoder whenever got_picture_ptr is > false(i.e. deleting decoder & Initializing the Avcodec,AvcodecContext > etc..) My application will work without a propagation delay. > > Can anyone explain me what is the reason behind this? > > If got_picture_ptr is zero/false, how application should handle this so > that can avoid propagation delay? > > Thanks in advance > KP > > From killerappzz at gmail.com Sat Jun 23 19:01:51 2012 From: killerappzz at gmail.com (Florin Bratu) Date: Sat, 23 Jun 2012 19:01:51 +0200 Subject: [Libav-user] timestamp error In-Reply-To: References: Message-ID: Hello, Still struggling with this one. I've changed a bit the approach; what I've noticed is that the AVFrame's created in the api-example.c (with random generated content) are well encoded. So my approach now is to create AVFrames just like in the api example the fill them in with the information from the source JPEGs(and of course with format conversion), I am using sws_scale for this. But now I am getting segmentation fault when calling sws_scale. I've well checked my pointers they have valid values before entering the sws_scale call. But I'm not sure I am calling it as I should: void copyFrame(AVCodecContext *destContext, AVFrame* dest, AVCodecContext *srcContext, AVFrame* source) { static struct SwsContext *swsContext; swsContext = sws_getContext(srcContext->width, srcContext->height,PIX_FMT_YUVJ420P, destContext->width, destContext->height, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); sws_scale(swsContext, source->data, source->linesize, 0, srcContext->height, dest->data, dest->linesize); sws_freeContext(swsContext); } destContext is the context used for encoding; dest is the AVFrame to be encoded. srcContext is the context used for decoding the JPEGs; source is the AVFrame the result of reading one JPG file. I attach the new version for source code. Thanks in advance for any helpful info you might have. Best regards, Florin. On Thu, Jun 14, 2012 at 8:56 PM, Florin Bratu wrote: > Hello, > > I have a problem while using the ffmpeg development libraries. What I want > to achieve is to create a video file from a sequence of images. The effect > should be as similar as the one of issuing the ffmpeg command: > $ ffmpeg -i test_%d.jpg -vcodec h263 -s 352x288 out.mp4 > However, I need to achieve this programatically as I need to integrate it > in a bigger application. > > As a start I thought of a simple approach: I read each image as an AVFrame > and I encode it in the final video. I've quickly hacked an implementation > of this approach, you can find the source code at the end of the email. > > However, when I compile and run it, I get the following error: > [h263 @ 0x8058020] Error, Invalid timestamp=0, last=0 > > I get this error for each AVFrame I try to encode, starting with the > second one, the first one is(or seems to be) correctly encoded. > > What can I do to overcome this issue? While searching through ffmpeg > source code I found out that this error is related to PTS, so I tried a > quick fix of setting it like this: > picture->pts = i; > > but unfortunately I still get the same error! seems like the new pts value > is not even taken into account! > > Do you have any ideas how to overcome this error? Am I doing something > wrong? > > I am new to ffmpeg development and to the libav-users mailing list, so > please pardon my hackish way of using ffmpeg. And feel free to point me any > other better ways I could use ffmpeg(apart from the obvious refactoring > this code could benefit from) hopefully in time I will arrive to cleanly > master its power. > > Best regards, > Florin. > > > #include > #include > > #include > > #define W_VIDEO 320 > #define H_VIDEO 240 > > AVFrame* OpenImage(const char* imageFileName) > { > AVFormatContext *pFormatCtx; > > int ret = av_open_input_file(&pFormatCtx, imageFileName, NULL, 0, > NULL); > if(ret!=0) > { > printf("Can't open image file '%s': code %d, %s\n", > imageFileName, ret, strerror(AVERROR(ret))); > return NULL; > } > > dump_format(pFormatCtx, 0, imageFileName, 0); > > AVCodecContext *pCodecCtx; > > pCodecCtx = pFormatCtx->streams[0]->codec; > pCodecCtx->width = W_VIDEO; > pCodecCtx->height = H_VIDEO; > pCodecCtx->pix_fmt = PIX_FMT_YUV420P; > > // Find the decoder for the video stream > AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id); > if (!pCodec) > { > printf("Codec not found\n"); > return NULL; > } > > // Open codec > if(avcodec_open(pCodecCtx, pCodec)<0) > { > printf("Could not open codec\n"); > return NULL; > } > > // > AVFrame *pFrame; > > pFrame = avcodec_alloc_frame(); > > if (!pFrame) > { > printf("Can't allocate memory for AVFrame\n"); > return NULL; > } > > int frameFinished; > int numBytes; > > // Determine required buffer size and allocate buffer > numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, pCodecCtx->width, > pCodecCtx->height); > uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t)); > > avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUVJ420P, > pCodecCtx->width, pCodecCtx->height); > > // Read frame > > AVPacket packet; > > int framesNumber = 0; > while (av_read_frame(pFormatCtx, &packet) >= 0) > { > if(packet.stream_index != 0) > continue; > > ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, > &packet); > if (ret > 0) > { > printf("Frame is decoded, size %d\n", ret); > pFrame->quality = 4; > // Free the packet that was allocated by av_read_frame > av_free_packet(&packet); > return pFrame; > } > else > printf("Error [%d] while decoding frame: %s\n", ret, > strerror(AVERROR(ret))); > } > > // close codec > avcodec_close(pCodecCtx); > > // Close the video file > av_close_input_file(pFormatCtx); > > return pFrame; > } > > > int main(int argc, char *argv[]) > { > AVCodec *codec; > AVCodecContext *c= NULL; > int i, out_size, size, x, y, outbuf_size; > FILE *f; > uint8_t *outbuf; > char* vidFileName = argv[1]; > > printf("Video encoding\n"); > > /* must be called before using avcodec lib */ > avcodec_init(); > > /* register all the codecs */ > avcodec_register_all(); > av_register_all(); > > /* find the mpeg1 video encoder */ > codec = avcodec_find_encoder(CODEC_ID_H263); > if (!codec) { > fprintf(stderr, "codec not found\n"); > exit(1); > } > > c= avcodec_alloc_context(); > > /* put sample parameters */ > c->bit_rate = 400000; > /* resolution must be a multiple of two */ > c->width = 352; > c->height = 288; > /* frames per second */ > c->time_base= (AVRational){1,25}; > c->gop_size = 10; /* emit one intra frame every ten frames */ > c->pix_fmt = PIX_FMT_YUV420P; > > /* open it */ > if (avcodec_open(c, codec) < 0) { > fprintf(stderr, "could not open codec\n"); > exit(1); > } > > f = fopen(vidFileName, "wb"); > if (!f) { > fprintf(stderr, "could not open %s\n", vidFileName); > exit(1); > } > > /* alloc image and output buffer */ > outbuf_size = 100000; > outbuf = malloc(outbuf_size); > AVFrame *picture; > > for(i=2;i fflush(stdout); > printf("encoding file %s \n", argv[i]); > /* load the image to be encoded*/ > picture = OpenImage(argv[i]); > // The above line was my initial attempt to fix, but to no avail > // picture->pts = i; > > /* encode the image */ > out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); > printf("encoding frame %3d (size=%5d)\n", i, out_size); > fwrite(outbuf, 1, out_size, f); > } > > /* get the delayed frames */ > for(; out_size; i++) { > fflush(stdout); > > out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); > printf("write frame %3d (size=%5d)\n", i, out_size); > fwrite(outbuf, 1, out_size, f); > } > > /* add sequence end code to have a real mpeg file */ > outbuf[0] = 0x00; > outbuf[1] = 0x00; > outbuf[2] = 0x01; > outbuf[3] = 0xb7; > fwrite(outbuf, 1, 4, f); > fclose(f); > free(outbuf); > > avcodec_close(c); > av_free(c); > av_free(picture); > printf("\n"); > } > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: timestamp_v2.c Type: text/x-csrc Size: 5965 bytes Desc: not available URL: From gavlig at gmail.com Sat Jun 23 20:01:54 2012 From: gavlig at gmail.com (=?KOI8-R?B?98zBxCDnwdDeyd4=?=) Date: Sat, 23 Jun 2012 21:01:54 +0300 Subject: [Libav-user] timestamp error In-Reply-To: References: Message-ID: Hello! I can't find an error in your code for the first look, but you can take my code(which is slighlty modified code from an example :)), where i do the same thing and it works http://www.pasteall.org/33175/cpp If that will cause segfault, then you're doing something wrong before getting to this part :) Hope that help! Best regards, Vlad 2012/6/23 Florin Bratu > Hello, > > Still struggling with this one. I've changed a bit the approach; what I've > noticed is that the AVFrame's created in the api-example.c (with random > generated content) are well encoded. So my approach now is to create > AVFrames just like in the api example the fill them in with the information > from the source JPEGs(and of course with format conversion), I am using > sws_scale for this. But now I am getting segmentation fault when calling > sws_scale. I've well checked my pointers they have valid values before > entering the sws_scale call. But I'm not sure I am calling it as I should: > > void copyFrame(AVCodecContext *destContext, AVFrame* dest, > AVCodecContext *srcContext, AVFrame* source) { > static struct SwsContext *swsContext; > > swsContext = sws_getContext(srcContext->width, > srcContext->height,PIX_FMT_YUVJ420P, > destContext->width, destContext->height, PIX_FMT_YUV420P, > SWS_FAST_BILINEAR, NULL, NULL, NULL); > > sws_scale(swsContext, source->data, source->linesize, 0, > srcContext->height, dest->data, dest->linesize); > > sws_freeContext(swsContext); > } > > destContext is the context used for encoding; dest is the AVFrame to be > encoded. > srcContext is the context used for decoding the JPEGs; source is the > AVFrame the result of reading one JPG file. > > I attach the new version for source code. > > Thanks in advance for any helpful info you might have. > > Best regards, > Florin. > > On Thu, Jun 14, 2012 at 8:56 PM, Florin Bratu wrote: > >> Hello, >> >> I have a problem while using the ffmpeg development libraries. What I >> want to achieve is to create a video file from a sequence of images. The >> effect should be as similar as the one of issuing the ffmpeg command: >> $ ffmpeg -i test_%d.jpg -vcodec h263 -s 352x288 out.mp4 >> However, I need to achieve this programatically as I need to integrate it >> in a bigger application. >> >> As a start I thought of a simple approach: I read each image as an >> AVFrame and I encode it in the final video. I've quickly hacked an >> implementation of this approach, you can find the source code at the end of >> the email. >> >> However, when I compile and run it, I get the following error: >> [h263 @ 0x8058020] Error, Invalid timestamp=0, last=0 >> >> I get this error for each AVFrame I try to encode, starting with the >> second one, the first one is(or seems to be) correctly encoded. >> >> What can I do to overcome this issue? While searching through ffmpeg >> source code I found out that this error is related to PTS, so I tried a >> quick fix of setting it like this: >> picture->pts = i; >> >> but unfortunately I still get the same error! seems like the new pts >> value is not even taken into account! >> >> Do you have any ideas how to overcome this error? Am I doing something >> wrong? >> >> I am new to ffmpeg development and to the libav-users mailing list, so >> please pardon my hackish way of using ffmpeg. And feel free to point me any >> other better ways I could use ffmpeg(apart from the obvious refactoring >> this code could benefit from) hopefully in time I will arrive to cleanly >> master its power. >> >> Best regards, >> Florin. >> >> >> #include >> #include >> >> #include >> >> #define W_VIDEO 320 >> #define H_VIDEO 240 >> >> AVFrame* OpenImage(const char* imageFileName) >> { >> AVFormatContext *pFormatCtx; >> >> int ret = av_open_input_file(&pFormatCtx, imageFileName, NULL, 0, >> NULL); >> if(ret!=0) >> { >> printf("Can't open image file '%s': code %d, %s\n", >> imageFileName, ret, strerror(AVERROR(ret))); >> return NULL; >> } >> >> dump_format(pFormatCtx, 0, imageFileName, 0); >> >> AVCodecContext *pCodecCtx; >> >> pCodecCtx = pFormatCtx->streams[0]->codec; >> pCodecCtx->width = W_VIDEO; >> pCodecCtx->height = H_VIDEO; >> pCodecCtx->pix_fmt = PIX_FMT_YUV420P; >> >> // Find the decoder for the video stream >> AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id); >> if (!pCodec) >> { >> printf("Codec not found\n"); >> return NULL; >> } >> >> // Open codec >> if(avcodec_open(pCodecCtx, pCodec)<0) >> { >> printf("Could not open codec\n"); >> return NULL; >> } >> >> // >> AVFrame *pFrame; >> >> pFrame = avcodec_alloc_frame(); >> >> if (!pFrame) >> { >> printf("Can't allocate memory for AVFrame\n"); >> return NULL; >> } >> >> int frameFinished; >> int numBytes; >> >> // Determine required buffer size and allocate buffer >> numBytes = avpicture_get_size(PIX_FMT_YUVJ420P, pCodecCtx->width, >> pCodecCtx->height); >> uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof(uint8_t)); >> >> avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUVJ420P, >> pCodecCtx->width, pCodecCtx->height); >> >> // Read frame >> >> AVPacket packet; >> >> int framesNumber = 0; >> while (av_read_frame(pFormatCtx, &packet) >= 0) >> { >> if(packet.stream_index != 0) >> continue; >> >> ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, >> &packet); >> if (ret > 0) >> { >> printf("Frame is decoded, size %d\n", ret); >> pFrame->quality = 4; >> // Free the packet that was allocated by av_read_frame >> av_free_packet(&packet); >> return pFrame; >> } >> else >> printf("Error [%d] while decoding frame: %s\n", ret, >> strerror(AVERROR(ret))); >> } >> >> // close codec >> avcodec_close(pCodecCtx); >> >> // Close the video file >> av_close_input_file(pFormatCtx); >> >> return pFrame; >> } >> >> >> int main(int argc, char *argv[]) >> { >> AVCodec *codec; >> AVCodecContext *c= NULL; >> int i, out_size, size, x, y, outbuf_size; >> FILE *f; >> uint8_t *outbuf; >> char* vidFileName = argv[1]; >> >> printf("Video encoding\n"); >> >> /* must be called before using avcodec lib */ >> avcodec_init(); >> >> /* register all the codecs */ >> avcodec_register_all(); >> av_register_all(); >> >> /* find the mpeg1 video encoder */ >> codec = avcodec_find_encoder(CODEC_ID_H263); >> if (!codec) { >> fprintf(stderr, "codec not found\n"); >> exit(1); >> } >> >> c= avcodec_alloc_context(); >> >> /* put sample parameters */ >> c->bit_rate = 400000; >> /* resolution must be a multiple of two */ >> c->width = 352; >> c->height = 288; >> /* frames per second */ >> c->time_base= (AVRational){1,25}; >> c->gop_size = 10; /* emit one intra frame every ten frames */ >> c->pix_fmt = PIX_FMT_YUV420P; >> >> /* open it */ >> if (avcodec_open(c, codec) < 0) { >> fprintf(stderr, "could not open codec\n"); >> exit(1); >> } >> >> f = fopen(vidFileName, "wb"); >> if (!f) { >> fprintf(stderr, "could not open %s\n", vidFileName); >> exit(1); >> } >> >> /* alloc image and output buffer */ >> outbuf_size = 100000; >> outbuf = malloc(outbuf_size); >> AVFrame *picture; >> >> for(i=2;i> fflush(stdout); >> printf("encoding file %s \n", argv[i]); >> /* load the image to be encoded*/ >> picture = OpenImage(argv[i]); >> // The above line was my initial attempt to fix, but to no avail >> // picture->pts = i; >> >> /* encode the image */ >> out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); >> printf("encoding frame %3d (size=%5d)\n", i, out_size); >> fwrite(outbuf, 1, out_size, f); >> } >> >> /* get the delayed frames */ >> for(; out_size; i++) { >> fflush(stdout); >> >> out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); >> printf("write frame %3d (size=%5d)\n", i, out_size); >> fwrite(outbuf, 1, out_size, f); >> } >> >> /* add sequence end code to have a real mpeg file */ >> outbuf[0] = 0x00; >> outbuf[1] = 0x00; >> outbuf[2] = 0x01; >> outbuf[3] = 0xb7; >> fwrite(outbuf, 1, 4, f); >> fclose(f); >> free(outbuf); >> >> avcodec_close(c); >> av_free(c); >> av_free(picture); >> printf("\n"); >> } >> >> > > > _______________________________________________ > 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 killerappzz at gmail.com Mon Jun 25 01:18:31 2012 From: killerappzz at gmail.com (Florin) Date: Sun, 24 Jun 2012 16:18:31 -0700 (PDT) Subject: [Libav-user] timestamp error In-Reply-To: References: Message-ID: <1340579911511-4655266.post@n4.nabble.com> Hello Vlad, Thanks for your reply. I just tried the code you sent me, but now when I run I get the following error when running the application: [swscaler @ 0x8e56780] bad dst image pointers However this brings me closer to the answer. After searching I see that this error is thrown if the pointers to the destination data planes are not valid. But shouldn't they have been set by the avpicture_fill call? I tried a quick'n'dirty fix: just before the sws_scale call, I manually set the pointers to the planes, like this: int size = aCtx->width * aCtx->height; tempFrame->data[0] = buffer; tempFrame->data[1] = tempFrame->data[0] + size; tempFrame->data[2] = tempFrame->data[1] + size / 4; tempFrame->linesize[0] = aCtx->width; tempFrame->linesize[1] = aCtx->width / 2; tempFrame->linesize[2] = aCtx->width / 2; And after doing this, I get again segmentation fault! So, on the good news side, at least now I found out the cause of the segmentation fault from my previous attempt, it comes from my wrongly setting these data planes. So now, question is: how to set the pointers to the destination data planes ? Best regards, Florin. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-timestamp-error-tp4655201p4655266.html Sent from the libav-users mailing list archive at Nabble.com. From francesco at bltitalia.com Mon Jun 25 10:19:37 2012 From: francesco at bltitalia.com (francesco at bltitalia.com) Date: Mon, 25 Jun 2012 10:19:37 +0200 (added by postmaster@virgilio.it) Subject: [Libav-user] Encoding in MPEG2 XDCAM 50Mbit problem Message-ID: <4F6643C109E7AEB2@vsmtp2.tin.it> (added by postmaster@virgilio.it) Hi to all I am attempting to encode in MPEG2 XDCAM long gop 50Mbit using libavcodec, but I think that some settings are wrong and I can't setup values correctly. Here is the code that generates first 20 blocks of data in separate files: /* find the video encoder */ pcodec_xd = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO); if (pcodec_xd==NULL) { Memo1->Lines->Add("Unable to find codec "); goto _Encod1Frame_err;} pCodecCtx_xd = avcodec_alloc_context3(pcodec_xd); if(pCodecCtx_xd==NULL) { Memo1->Lines->Add("Unable to alloc codec context");goto _Encod1Frame_err;} pFrame_xd = avcodec_alloc_frame(); if(pFrame_xd==NULL) { Memo1->Lines->Add("Unable to alloc frame");goto _Encod1Frame_err;} vform.num = 16; vform.den = 9; pCodecCtx_xd->sample_aspect_ratio = vform; // Set 16:9 aspect ratio pCodecCtx_xd->rc_max_rate = pCodecCtx_xd->rc_min_rate =pCodecCtx_xd->bit_rate = 50000000; pCodecCtx_xd->flags = CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME ;//| CODEC_FLAG_CLOSED_GOP ; pCodecCtx_xd->qmin = 1; // pCodecCtx_xd->qmax = 3; pCodecCtx_xd->rc_buffer_size = 2000000; pCodecCtx_xd->rc_initial_buffer_occupancy = 2000000; pCodecCtx_xd->time_base.num = 1; pCodecCtx_xd->time_base.den = 25; pCodecCtx_xd->gop_size = 12; pCodecCtx_xd->max_b_frames= 1; pCodecCtx_xd->pix_fmt = PIX_FMT_YUV422P; pCodecCtx_xd->thread_count = Thread_Count; // Thread_Count = Number of available processors /* resolution must be a multiple of two */ pCodecCtx_xd->width = Hsize; // Hsize = 1920 pCodecCtx_xd->height = (Vsize<<1) ; // Vsize = 540 /* the image can be allocated by any means and av_image_alloc() is * just the most convenient way if av_malloc() is to be used */ rtv = av_image_alloc(pFrame_xd->data, pFrame_xd->linesize, pCodecCtx_xd->width, pCodecCtx_xd->height, pCodecCtx_xd->pix_fmt, 1); pFrame_xd->qscale_type = 1; pFrame_xd->top_field_first = 1; pFrame_xd->interlaced_frame = 1; if (avcodec_open2(pCodecCtx_xd, pcodec_xd,NULL) < 0) {rtv = -6; goto _Encod1Frame_err; } for(fldXDCamCnt=0;fldXDCamCntdata[] > out_size = avcodec_encode_video(pCodecCtx_xd, tempBuffer,encBufSize , pFrame_xd); // encBufSize = 0x500000; if(out_size>0) { str1 = ExtractFilePath(Application->ExeName) + "\\RecompDir\\compressed_"; str1.cat_printf("f%d_b%d.m2v",xd_frmNum,blk_cnt); PutBufferIntoFile (str1.c_str(), tempBuffer, frameSz); str1.printf("Saved block %d",blk_cnt); Memo1->Lines->Add(str1); blk_cnt++; if(blk_cnt>20) break; } } Some questions: Data out is analyzed using MPEG2-Video ES utils, and has a sample aspect ratio of 1:2.21 not 16:9. Why ? If I set the CODEC_FLAG_CLOSED_GOP in the pCodecCtx_xd->flags then the avcodec_open2 routine fails (returns -1). Why he fails ? I have a block output for every frame in input. Shouldn't I have a block about every 12 frames ? Did someone have an idea ? From wagner.patriota at gmail.com Mon Jun 25 17:25:00 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Mon, 25 Jun 2012 12:25:00 -0300 Subject: [Libav-user] Problems with DVD subtitles... why they appear in black? Message-ID: Any idea why these subtitles appear black in my video? what's wrong with them? https://dl.dropbox.com/u/8674304/GVT/s-ama.sub https://dl.dropbox.com/u/8674304/GVT/s.sub Where can I find the specification of this standard for me to parse by myself / debug / etc? The command line I am using to add the subtitle is this: ffmpeg \ -i video.m2t \ -i audio.aac \ *-i subtitle.sub \* -vcodec copy \ -acodec copy \ *-scodec dvbsub \* -metadata:s:a:0 language=por \ -metadata:s:s:0 language=por \ -map 0 -map 1 -map 2 \ -y out.ts -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jun 25 20:47:16 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 25 Jun 2012 18:47:16 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Problems_with_DVD_subtitles=2E=2E=2E_why_t?= =?utf-8?q?hey_appear_in=09black=3F?= References: Message-ID: Wagner Patriota writes: > Any idea why these subtitles appear black in my video? > what's wrong with them? Without looking at the sample, I suspect the file that contains the subtitle colour information is missing (it usually is after ripping the dvd), so FFmpeg has to guess the colour. Carl Eugen From radford.parker at gmail.com Mon Jun 25 20:59:19 2012 From: radford.parker at gmail.com (radparker) Date: Mon, 25 Jun 2012 11:59:19 -0700 (PDT) Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption Message-ID: <1340650759048-4655270.post@n4.nabble.com> I have code working properly to read in a UDP stream for a couple of seconds. Soon after, the stream becomes severely pixelated. I have my code below and the output of my stream in video form below that. Has anybody seen something like this before? I am using libav-0.8.3 and have tried increasing my stack size and altering the buffer_size as an input option with the url. I should mention that the UDP input stream is multicast and the format is mpegts. Any help would be greatly appreciated. Thanks! http://libav-users.943685.n4.nabble.com/file/n4655270/output.mp4 output.mp4 -- View this message in context: http://libav-users.943685.n4.nabble.com/UDP-Stream-Read-Pixelation-Macroblock-Corruption-tp4655270.html Sent from the libav-users mailing list archive at Nabble.com. From jgraham at cs.unc.edu Mon Jun 25 21:59:06 2012 From: jgraham at cs.unc.edu (Jeremy Graham) Date: Mon, 25 Jun 2012 15:59:06 -0400 Subject: [Libav-user] Decoding a H.264 stream from TCP In-Reply-To: References: <4FE38782.2090800@cs.email.edu> <4FE4849E.4070006@cs.email.edu> <4FE4CF55.9060800@cs.email.edu> Message-ID: <4FE8C30A.6070506@cs.email.edu> On 06/22/2012 04:12 PM, Michael Bradshaw wrote: > If you want to use libav* to decode the video in your own program, you > certainly can do that. When you open a "file" you pass it a URL (if > it's just a file on your local hard drive, you can pass something like > "video.mov" and it will open it with the file protocol). If your > "filename" was something like "http://192.168.1.1:5555" it should open > it just fine, and you can decode incoming frames like normal. Interesting. This sounds like something to try. Are you referring to using a URL in conjunction with a function like fopen or is there a function specified somewhere in libav* that you had in mind? From constantins at neyasystems.com Mon Jun 25 23:32:24 2012 From: constantins at neyasystems.com (Constantin Savtchenko) Date: Mon, 25 Jun 2012 17:32:24 -0400 Subject: [Libav-user] Decoding H264 Frames From RTSP Half the Image is Distorted Message-ID: <000f01cd531a$0379a010$0a6ce030$@neyasystems.com> Hello all, I have been attempting to use Live555 to decode an incoming RTSP stream. Arash has already kindly pointed out that this can be done using url_fopen. However, I'ld really like to use what I've worked on so far with Live555 which gives me greater control over the RTSP connection. I've gotten pretty far, I think, but today I took a look at some of the decoded images and they did not look right. The top half of the image seems okay, while the bottom half seems distorted, skewed to the right. Other RTSP streams the entire image is skewed to the right (diagonally, downwards and to right). I would like to note that av_decode is not spitting out any errors, I managed to remove all of my errors by setting 'codec_context_->flags2 |= CODEC_FLAG2_CHUNKS;' My question is where could the problem lie? I don't know how to approach debugging this problem, media is not my strong suit. Below, I outline my approach so far: - Live555 fills my unsigned char * buffer with a NAL unit and tells me a frame_size (the size of this NAL unit), it fills it at buffer+4 and the buffer contains 0x00000001 - I prepend each NAL frame I get from Live555 with 0x00000001 by giving Live555 the address of the buffer + 4 and pad the end of the same buffer with 16 bytes of 0 - AVPacket current_frame; is initialized with av_init_packet - current_frame.size = 4 (h264 header size) + frame_size (live555 NAL size) + 16 (suggested padding size) - current_frame.data = my unsigned char * buffer containing the newest NAL unit, and padded as described - Avcodec_decode_video2 . no problems - Print PGM (examing it shows its skewed to the right) A final reiteration, the RTSP streams that are completely skewed, seem be smaller resolutions (half the resolution of my goal resolution). My goal resolution only the bottom half is affected, while the smaller resolutions are entirely affected. Kind Regards, Constantin -------------- next part -------------- An HTML attachment was scrubbed... URL: From simondaniels23 at gmail.com Tue Jun 26 08:18:51 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Mon, 25 Jun 2012 23:18:51 -0700 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 Message-ID: Hey guys, I'm walking through frames of a video to do some analysis on the pixel data. I'd like to save each frame as an image so I can verify the analysis algorithm is running on the expected data. I don't want to use the ffmpeg command-line to save out the frames because for some reason the frame counts are not matching. Ffmpeg.exe saves more frame jpegs than avcodec_decode_video2 seems to find. Here's my code: while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStreamIndex && (frameLocation++ % frameSkip == 0) ) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); // Did we get a video frame? if (isFrameFinished) { // I'D LIKE TO SAVE FRAME AS A JPEG HERE } } } This is with ffmpeg 0.11.1. Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: From misha.penkov at gmail.com Tue Jun 26 09:10:26 2012 From: misha.penkov at gmail.com (Misha Penkov) Date: Tue, 26 Jun 2012 16:10:26 +0900 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 In-Reply-To: References: Message-ID: On 26 June 2012 15:18, Simon Daniels wrote: > Hey guys, > > I'm walking through frames of a video to do some analysis on the pixel data. > I'd like to save each frame as an image so I can verify the analysis > algorithm is running on the expected data. > > I don't want to use the ffmpeg command-line to save out the frames because > for some reason the frame counts are not matching. Ffmpeg.exe saves more > frame jpegs than avcodec_decode_video2 seems to find. > > Here's my code: > > > while (av_read_frame(pFormatCtx, &packet) >= 0) > { > > // Is this a packet from the video stream? > if (packet.stream_index == videoStreamIndex && > (frameLocation++ % frameSkip == 0) > ) > { > // Decode video frame > avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); > > // Did we get a video frame? > if (isFrameFinished) { One thing you could do here would be to link with a JPEG library (like http://www.ijg.org/) and use that to write your JPEGs. Any other library that handles JPEG writing will also work. There may be a way to do it without external libraries, but I've never had to go down that path. > } > > } > } > > > This is with ffmpeg 0.11.1. > > Thanks! > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From alexcohn at netvision.net.il Tue Jun 26 10:02:21 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 26 Jun 2012 11:02:21 +0300 Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption In-Reply-To: <1340650759048-4655270.post@n4.nabble.com> References: <1340650759048-4655270.post@n4.nabble.com> Message-ID: On Mon, Jun 25, 2012 at 9:59 PM, radparker wrote: > I have code working properly to read in a UDP stream for a couple of seconds. > Soon after, the stream becomes severely pixelated. I have my code below and > the output of my stream in video form below that. Has anybody seen something > like this before? I am using libav-0.8.3 and have tried increasing my stack > size and altering the buffer_size as an input option with the url. I should > mention that the UDP input stream is multicast and the format is mpegts. Any > help would be greatly appreciated. Thanks! The demonstrated effect could easily be explained by lost packets. With a UDP stream, some packets can be lost. You could try to improve the situation on the receiver side by making your socket buffers larger, but the problem may be out of your control. For example, with WiFi such behavior, especially with high bitrates, is quite typical. BR, Alex Cohn From alexcohn at netvision.net.il Tue Jun 26 10:13:48 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 26 Jun 2012 11:13:48 +0300 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 In-Reply-To: References: Message-ID: On Tue, Jun 26, 2012 at 9:18 AM, Simon Daniels wrote: > Hey guys, > > I'm walking through frames of a video to do some analysis on the pixel data. > I'd like to save each frame as an image so I can verify the analysis > algorithm is running on the expected data. > > I don't want to use the ffmpeg command-line to save out the frames because > for some reason the frame counts are not matching. Ffmpeg.exe saves more > frame jpegs than avcodec_decode_video2 seems to find. > > Here's my code: > > > while (av_read_frame(pFormatCtx, &packet) >= 0) > { > > // Is this a packet from the video stream? > if (packet.stream_index == videoStreamIndex && > (frameLocation++ % frameSkip == 0) > ) > { > // Decode video frame > avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); > > // Did we get a video frame? > if (isFrameFinished) { > > ? ? ? ? ? ? ?// I'D LIKE TO SAVE FRAME AS A JPEG HERE > > } > > } > } > > > This is with ffmpeg 0.11.1. > > Thanks! See an old thread http://libav-users.943685.n4.nabble.com/Save-AVFrame-to-jpg-file-td2314979.html BR, Alex Cohn From naresh at vizexperts.com Tue Jun 26 10:15:35 2012 From: naresh at vizexperts.com (Naresh Sankapelly) Date: Tue, 26 Jun 2012 13:45:35 +0530 Subject: [Libav-user] RTSP Client Message-ID: <002301cd5373$de0dc040$9a2940c0$@com> Hey All, I have an IP camera which give RTSP streams(rtsp://192.168.1.90/MediaInput/mpeg4). I want to use libav for playing this stream and also for recording. Is it possible to do so in ffmpeg? If yes, Are there any sample programs for this? Thanks in advance Naresh Ph. 8884199804 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 26 10:15:06 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 08:15:06 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Save_frame_to_jpg_with_data_from=09avcodec?= =?utf-8?q?=5Fdecode=5Fvideo2?= References: Message-ID: Misha Penkov writes: > > I don't want to use the ffmpeg command-line to save out > > the frames because for some reason the frame counts are > > not matching. Ffmpeg.exe saves more frame jpegs than > > avcodec_decode_video2 seems to find. (Command line and complete, uncut console output missing.) -vsync 0 ? [...] > One thing you could do here would be to link with a JPEG > library and use that to write your JPEGs. FFmpeg does support encoding jpegs. Carl Eugen From nitinkumgoyal at gmail.com Tue Jun 26 10:48:54 2012 From: nitinkumgoyal at gmail.com (NITIN GOYAL) Date: Tue, 26 Jun 2012 14:18:54 +0530 Subject: [Libav-user] RTSP Client In-Reply-To: <002301cd5373$de0dc040$9a2940c0$@com> References: <002301cd5373$de0dc040$9a2940c0$@com> Message-ID: Hi Playing with stream means? You can use mplayer for playing it or can create your own player like mplayer using ffmpeg. Yeah all the feature you have mentioned are very well supported by libav. VLC is also using libav for many codecs. Regards Nitin On Tue, Jun 26, 2012 at 1:45 PM, Naresh Sankapelly wrote: > ** > > ** ** > > I have an IP camera which give RTSP streams(rtsp:// > 192.168.1.90/MediaInput/mpeg4). I want to use libav for playing this > stream and also for recording. Is it possible to do so in ffmpeg? If yes, > Are there any sample programs for this? **** > > ** ** > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From naresh at vizexperts.com Tue Jun 26 10:56:59 2012 From: naresh at vizexperts.com (Naresh Sankapelly) Date: Tue, 26 Jun 2012 14:26:59 +0530 Subject: [Libav-user] RTSP Client In-Reply-To: References: <002301cd5373$de0dc040$9a2940c0$@com> Message-ID: <00e301cd5379$a6cd19e0$f4674da0$@com> Thanks Nitin! I have to get frames from RTSP server for rendering using OpenGL. I pretty new here, Are there any sample programs that work as RTSP client? Thanks Naresh Ph. 8884199804 From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of NITIN GOYAL Sent: Tuesday, June 26, 2012 2:19 PM To: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. Subject: Re: [Libav-user] RTSP Client Hi Playing with stream means? You can use mplayer for playing it or can create your own player like mplayer using ffmpeg. Yeah all the feature you have mentioned are very well supported by libav. VLC is also using libav for many codecs. Regards Nitin On Tue, Jun 26, 2012 at 1:45 PM, Naresh Sankapelly wrote: I have an IP camera which give RTSP streams(rtsp://192.168.1.90/MediaInput/mpeg4). I want to use libav for playing this stream and also for recording. Is it possible to do so in ffmpeg? If yes, Are there any sample programs for this? -------------- next part -------------- An HTML attachment was scrubbed... URL: From i.like.privacy.too at gmail.com Tue Jun 26 11:00:55 2012 From: i.like.privacy.too at gmail.com (Camera Man) Date: Tue, 26 Jun 2012 05:00:55 -0400 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 In-Reply-To: References: Message-ID: <4FE97A47.1040308@gmail.com> On 06/26/2012 04:13 AM, Alex Cohn wrote: > On Tue, Jun 26, 2012 at 9:18 AM, Simon Daniels > wrote: >> I don't want to use the ffmpeg command-line to save out the frames >> because >> for some reason the frame counts are not matching. Ffmpeg.exe saves more >> frame jpegs than avcodec_decode_video2 seems to find.See an old thread > http://libav-users.943685.n4.nabble.com/Save-AVFrame-to-jpg-file-td2314979.html I've been using that code successfully. I've done a git pull recently, and noticed that the encoders (including mjpegs) are now frame/slice multithread capable. Does this mean it's possible that the return from avcodec_encode_video2 is somehow pipelined for mjpeg? That is, when calling avcodec_decode_video2(), you put in a packet, you get a frame, but the frame might be related to an earlier packet (either because of I/P/B/reference frame reordering, or because of a multithreaded decoder). Is it possible that when calling avcodec_encode_video2() for mjpeg, you will receive an encoded packet which is related to an earlier frame because of the new multithreading infrastructure? From amir.rouhi at rmit.edu.au Tue Jun 26 11:05:25 2012 From: amir.rouhi at rmit.edu.au (Rouhi Amirhossein2) Date: Tue, 26 Jun 2012 19:05:25 +1000 Subject: [Libav-user] Extracting I-Frame intra-prediction modes Message-ID: Hi You know that in h264, a methos is used for compression which is called intra prediction method. totally we have 9 intra prediction modes which showing different direction of top and left side pixels of 4x4 blocks. I want to extract such modes in any frame that uses intra prediction such as I-Frames and IDR,s. Do you know how can i achive this purpose? In JM software i did the same in decoder, do you think it should be done in FFplay as a decoder or it can be done by FFmpeg? Thanks for your expert advice. Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From misha.penkov at gmail.com Tue Jun 26 11:12:18 2012 From: misha.penkov at gmail.com (Misha Penkov) Date: Tue, 26 Jun 2012 18:12:18 +0900 Subject: [Libav-user] Extracting I-Frame intra-prediction modes In-Reply-To: References: Message-ID: On 26 June 2012 18:05, Rouhi Amirhossein2 wrote: > > Hi > You know that in h264, a methos is used for compression which is called > intra prediction method. totally we have 9 intra prediction modes which > showing different direction of top and left side pixels of 4x4 blocks. I > want to extract such modes in any frame that uses intra prediction such as > I-Frames and IDR,s. Do you know how can i achive this purpose? > In JM software i did the same in decoder, do you think it should be done in > FFplay as a decoder or it can be done by FFmpeg? AFAIK, H.264 I-frames and keyframes are the same thing. Once you have an AVFrame, you can check its key_frame member. It will be non-zero if it's a keyframe (I-frame). For full code, have a look here: https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c Provided that you're using MP4 as the container, you can confirm that the keyframes extracted are indeed I-frames by using the mp4videoinfo utility (http://mpeg4ip.sourceforge.net/documentation/index.php). > Thanks for your expert?advice. > Amir > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From i.like.privacy.too at gmail.com Tue Jun 26 11:18:42 2012 From: i.like.privacy.too at gmail.com (Camera Man) Date: Tue, 26 Jun 2012 05:18:42 -0400 Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption In-Reply-To: References: <1340650759048-4655270.post@n4.nabble.com> Message-ID: <4FE97E72.207@gmail.com> On 06/26/2012 04:02 AM, Alex Cohn wrote: > The demonstrated effect could easily be explained by lost packets. > With a UDP stream, some packets can be lost. You could try to improve > the situation on the receiver side by making your socket buffers > larger, but the problem may be out of your control. For example, with > WiFi such behavior, especially with high bitrates, is quite typical. For large frames (even as small as 1280x720), the way libavcodec works might be the culprit: It sets the UDP socket buffer size to 64K by default (which IIRC linux interprets to mean 128K, still small; not sure about other operating systems). If you give the UDP url yourself, you can add a ?buffer_size= parameter to fix this. However, if the URL is constructed by e.g. RTSP, there is no way to specify a buffer size. On the cameras I use, an I-frame at 1280x720 of a typical scene is often 300K and almost always >200K - so packet loss is essentially guaranteed for almost every I-frame. If the original poster is using rtsp, they might need to switch to rtsp/tcp until this is fixed, even if there is no UDP packet loss at the network level. I pointed this out in ; I've just noticed it was sent as HTML for some reason, so I'm copying again here in case this is relevant and hard to find or was impossible to read back then: ---- If you look at udp.c (just git pulled), routine udp_open actually parses the URI looking for libav-specific instructions such as "reuse", "ttl", "localport", "pkt_size", "buffer_size", "connect" and "localaddr". Specifically, the "buffer_size" parameter (which defaults to UDP_MAX_PKT_SIZE=65536 for reading) is used to set the UDP buffer size. I need to increase that buffer size significantly (to > 256KB) so that packets don't get lost., because I-frames at 1280x720 are already 220KB/sec. I can recompile replacing the default buffer_size from UDP_MAX_PKT_SIZE to (e.g.) 4*UDP_MAX_PKT_SIZE, but I'd rather do that with configuration and use a stock libav. So, the question is: given that I'm passing an rtsp url ("rtsp://a.b.c.d/axis-media/media.amp"), how do I set buffer_size and/or ttl? There does not appear to be an avoption based way to do that, but maybe I'm missing something? (This is also relevant to setting the timeout for tcp transports, and I guess; although the http transport does seem to get its parameters from avoptions; and rtsp does pass "localport", "ttl" and "connect" parameter to udp somehow) From amir.rouhi at rmit.edu.au Tue Jun 26 11:21:49 2012 From: amir.rouhi at rmit.edu.au (Rouhi Amirhossein2) Date: Tue, 26 Jun 2012 19:21:49 +1000 Subject: [Libav-user] Extracting I-Frame intra-prediction modes In-Reply-To: References: Message-ID: Hi Misha Thanks for prompt reply. That would be a very useful code for extracting key frame images. but actually need to extract the intra-prediction modes in each key frame of an input video stream. Can you help me to achieve this? the input of the program would be an h264 raw video file and the output would be a text file that stores intra-prediction modes with related MB address and i-frame id. On 26 June 2012 19:12, Misha Penkov wrote: > On 26 June 2012 18:05, Rouhi Amirhossein2 wrote: > > > > Hi > > You know that in h264, a methos is used for compression which is called > > intra prediction method. totally we have 9 intra prediction modes which > > showing different direction of top and left side pixels of 4x4 blocks. I > > want to extract such modes in any frame that uses intra prediction such > as > > I-Frames and IDR,s. Do you know how can i achive this purpose? > > In JM software i did the same in decoder, do you think it should be done > in > > FFplay as a decoder or it can be done by FFmpeg? > > AFAIK, H.264 I-frames and keyframes are the same thing. Once you have > an AVFrame, you can check its key_frame member. It will be non-zero > if it's a keyframe (I-frame). > > For full code, have a look here: > > https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c > > Provided that you're using MP4 as the container, you can confirm that > the keyframes extracted are indeed I-frames by using the mp4videoinfo > utility (http://mpeg4ip.sourceforge.net/documentation/index.php). > > > Thanks for your expert advice. > > Amir > > > > _______________________________________________ > > 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 > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco at bltitalia.com Tue Jun 26 12:34:21 2012 From: francesco at bltitalia.com (francesco at bltitalia.com) Date: Tue, 26 Jun 2012 12:34:21 +0200 (added by postmaster@virgilio.it) Subject: [Libav-user] Compressing in MPEG2 with closed GOP Message-ID: <4FE0AD2200C6A6A8@vsmtp21.tin.it> (added by postmaster@virgilio.it) Hi to all Did anyone compress in MPEG2 using CODEC_FLAG_CLOSED_GOP ? It works ? If I set this flag the avcodec_open2 function returns -1. From cehoyos at ag.or.at Tue Jun 26 12:50:47 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 10:50:47 +0000 (UTC) Subject: [Libav-user] Compressing in MPEG2 with closed GOP References: <38765.7546475113$1340706866@news.gmane.org> Message-ID: writes: > Did anyone compress in MPEG2 using CODEC_FLAG_CLOSED_GOP ? > It works ? If I set this flag the avcodec_open2 function returns -1. Wasn't an error shown explaining the reason? Carl Eugen From alexcohn at netvision.net.il Tue Jun 26 12:51:59 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 26 Jun 2012 13:51:59 +0300 Subject: [Libav-user] Extracting I-Frame intra-prediction modes In-Reply-To: References: Message-ID: On Tue, Jun 26, 2012 at 12:21 PM, Rouhi Amirhossein2 wrote: > Hi Misha > Thanks for prompt reply. That would be a very useful code for extracting key > frame images. but actually need to extract the intra-prediction modes in > each key frame of an input video stream. Can you help me to achieve this? > the input of the program would be an h264 raw video file and the output > would be a text file that stores intra-prediction modes with related MB > address and i-frame id. > > > On 26 June 2012 19:12, Misha Penkov wrote: >> >> On 26 June 2012 18:05, Rouhi Amirhossein2 wrote: >> > >> > Hi >> > You know that in h264, a methos is used for compression which is called >> > intra prediction method. totally we have 9 intra prediction modes which >> > showing different direction of top and left side pixels of 4x4 blocks. I >> > want to extract such modes in any frame that uses intra prediction such >> > as >> > I-Frames and IDR,s. Do you know how can i achive this purpose? >> > In JM software i did the same in decoder, do you think it should be done >> > in >> > FFplay as a decoder or it can be done by FFmpeg? >> >> AFAIK, H.264 I-frames and keyframes are the same thing. ?Once you have >> an AVFrame, you can check its key_frame member. ?It will be non-zero >> if it's a keyframe (I-frame). >> >> For full code, have a look here: >> >> https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c >> >> Provided that you're using MP4 as the container, you can confirm that >> the keyframes extracted are indeed I-frames by using the mp4videoinfo >> utility (http://mpeg4ip.sourceforge.net/documentation/index.php). >> >> > Thanks for your expert?advice. >> > Amir >> > > -- > Amir H. Rouhi > PhD Student/ CSIT RMIT University > Room: 14-09-04 > http://raws.adc.rmit.edu.au/~s3288736/blog2/ Check ffmpeg -debug options, especially pict and mv: -debug EDVAS print specific debug info pict .DV.. picture info mb_type .DV.. macroblock (MB) type mv .DV.. motion vector Regards, Alex Cohn From alexcohn at netvision.net.il Tue Jun 26 12:59:24 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 26 Jun 2012 13:59:24 +0300 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 In-Reply-To: <4FE97A47.1040308@gmail.com> References: <4FE97A47.1040308@gmail.com> Message-ID: On Tue, Jun 26, 2012 at 12:00 PM, Camera Man wrote: > On 06/26/2012 04:13 AM, Alex Cohn wrote: > >> On Tue, Jun 26, 2012 at 9:18 AM, Simon Daniels >> wrote: >>> >>> I don't want to use the ffmpeg command-line to save out the frames >>> because >>> for some reason the frame counts are not matching. Ffmpeg.exe saves more >>> frame jpegs than avcodec_decode_video2 seems to find.See an old thread >> >> >> http://libav-users.943685.n4.nabble.com/Save-AVFrame-to-jpg-file-td2314979.html > > > I've been using that code successfully. I've done a git pull recently, and > noticed that the encoders (including mjpegs) are now frame/slice multithread > capable. Does this mean it's possible that the return from > avcodec_encode_video2 is somehow pipelined for mjpeg? > > That is, when calling avcodec_decode_video2(), you put in a packet, you get > a frame, but the frame might be related to an earlier packet (either because > of I/P/B/reference frame reordering, or because of a multithreaded decoder). > > Is it possible that when calling avcodec_encode_video2() for mjpeg, you will > receive an encoded packet which is related to an earlier frame because of > the new multithreading infrastructure? To the best of my knowledge, with multithreading you are still expected to receive results in correct order, but the delay may be effected. BR, Alex Cohn From francesco at bltitalia.com Tue Jun 26 12:59:54 2012 From: francesco at bltitalia.com (francesco at bltitalia.com) Date: Tue, 26 Jun 2012 12:59:54 +0200 (added by postmaster@virgilio.it) Subject: [Libav-user] Compressing in MPEG2 with closed GOP Message-ID: <4F6643C10A146869@vsmtp2.tin.it> (added by postmaster@virgilio.it) At 10.50 26/06/2012 +0000, you wrote: > writes: > >> Did anyone compress in MPEG2 using CODEC_FLAG_CLOSED_GOP ? >> It works ? If I set this flag the avcodec_open2 function returns -1. > >Wasn't an error shown explaining the reason? > >Carl Eugen > >_______________________________________________ >Libav-user mailing list >Libav-user at ffmpeg.org >http://ffmpeg.org/mailman/listinfo/libav-user > >__________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 7241 (20120622) __________ > >Il messaggio ? stato controllato da ESET NOD32 Antivirus. > >www.nod32.it > > > > I didn't find nothing regarding. There is a post that explain ? In the code (avcodec.h )I found that the CODEC_FLAG_CLOSED_GOP is under the flags for h263 codec. May be that the closed gop option is unsuported for MPEG2 ? From cehoyos at ag.or.at Tue Jun 26 13:02:01 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 11:02:01 +0000 (UTC) Subject: [Libav-user] Compressing in MPEG2 with closed GOP References: <18404.322610195$1340708396@news.gmane.org> Message-ID: writes: > In the code (avcodec.h )I found that the CODEC_FLAG_CLOSED_GOP > is under the flags for h263 codec. May be that the closed gop > option is unsuported for MPEG2 ? It is supported but it needs scenechange_threshold of at least 1000000000 Carl Eugen > From radford.parker at gmail.com Tue Jun 26 15:55:19 2012 From: radford.parker at gmail.com (radparker) Date: Tue, 26 Jun 2012 06:55:19 -0700 (PDT) Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption In-Reply-To: <4FE97E72.207@gmail.com> References: <1340650759048-4655270.post@n4.nabble.com> <4FE97E72.207@gmail.com> Message-ID: <1340718919000-4655292.post@n4.nabble.com> Thanks for the responses! I suppose I should mention that if I try to record the UDP stream from vlc using I have no problems. The output file is completely clean. Also, if I play the stream through the vlc gui, I have no problems with pixelation (presumably caused by lost packets). I can play the stream as long as I want with no problem. Also, when I record the stream with ffmpeg using I still don't have any problems. The pixelation only occurs when I use libav function calls in my own code. This leads me to believe that it is possible to properly read this stream using the current libraries I have configured, I'm just not sure what vlc or ffmpeg are doing differently. I have tried recompiling libav after changing UDP_TX_BUF_SIZE to 8 * UDP_TX_BUF_SIZE and UDP_MAX_PKT_SIZE to 8 * UDP_MAX_PKT_SIZE. I have also tried setting the buffer size using the ?buffer_size parameter. None of these fixes alters the behavior of the stream reading. I should also mention that someone else has set up this UDP stream, but it is on a hard-wired ethernet LAN and the stream is set at ~60 fps. Can anyone else think of a different approach other than altering the stream to use tcp? Thanks again. -- View this message in context: http://libav-users.943685.n4.nabble.com/UDP-Stream-Read-Pixelation-Macroblock-Corruption-tp4655270p4655292.html Sent from the libav-users mailing list archive at Nabble.com. From alexcohn at netvision.net.il Tue Jun 26 16:38:11 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Tue, 26 Jun 2012 17:38:11 +0300 Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption In-Reply-To: <1340650759048-4655270.post@n4.nabble.com> References: <1340650759048-4655270.post@n4.nabble.com> Message-ID: On Mon, Jun 25, 2012 at 9:59 PM, radparker wrote: > I have code working properly to read in a UDP stream for a couple of seconds. > Soon after, the stream becomes severely pixelated. I have my code below and > the output of my stream in video form below that. Has anybody seen something > like this before? I am using libav-0.8.3 and have tried increasing my stack > size and altering the buffer_size as an input option with the url. I should > mention that the UDP input stream is multicast and the format is mpegts. Any > help would be greatly appreciated. Thanks! > > > http://libav-users.943685.n4.nabble.com/file/n4655270/output.mp4 output.mp4 > while (av_read_frame(format_context, &packet) >= 0){ // If packet is video if(packet.stream_index == video_stream_idx) { if (packet.size > 0) { frame_finished = 0; if (avcodec_decode_video2(codec_context, frame_yuv, &frame_finished, &packet) >= 0) { // Did we get a video frame? if(frame_finished) { // Convert the image from its native format to RGB sws_scale(sws_context, frame_yuv->data, frame_yuv->linesize, 0, codec_context->height, frame_bgr->data, frame_bgr->linesize); if(fskip == 1) { ptr1 = frame_bgr->data[0]+ m * frame_bgr->linesize[0]; ptr2 = frame.data + m * frame.cols * 3; // Convert Frame for(m = 0; m < codec_context->height; ++m) { memcpy(ptr2, ptr1, 3 * frame.cols); ptr1 += frame_bgr->linesize[0]; ptr2 += frame.cols * 3; } fskip=0; break; } fskip++; } } } } } > -- > View this message in context: http://libav-users.943685.n4.nabble.com/UDP-Stream-Read-Pixelation-Macroblock-Corruption-tp4655270.html Your message does not contain the code snippet when looked at from the mail list. On nabble, I see that there is at least one problem with your loop: you should call avcodec_decode_video2() with null packet to extract frames that are "stuck" inside the decoder queue. Normally, we do it when the input is empty. But maybe you should try it on packets of size == 0? BR, Alex From radford.parker at gmail.com Tue Jun 26 16:50:18 2012 From: radford.parker at gmail.com (radparker) Date: Tue, 26 Jun 2012 07:50:18 -0700 (PDT) Subject: [Libav-user] UDP Stream Read Pixelation/Macroblock Corruption In-Reply-To: References: <1340650759048-4655270.post@n4.nabble.com> Message-ID: <1340722218338-4655294.post@n4.nabble.com> I have verified that the if statement is not needed. It appears as though every packet has a size. After removing that if statement, I still have the same behavior. Are you suggesting that I do something different? Thanks for your help. -- View this message in context: http://libav-users.943685.n4.nabble.com/UDP-Stream-Read-Pixelation-Macroblock-Corruption-tp4655270p4655294.html Sent from the libav-users mailing list archive at Nabble.com. From simondaniels23 at gmail.com Tue Jun 26 17:50:11 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 08:50:11 -0700 Subject: [Libav-user] Save frame to jpg with data from avcodec_decode_video2 In-Reply-To: References: <4FE97A47.1040308@gmail.com> Message-ID: Works perfectly Alex! Thanks! Carl -- I'll start a separate thread on the frame count inconsistencies. On Tue, Jun 26, 2012 at 3:59 AM, Alex Cohn wrote: > On Tue, Jun 26, 2012 at 12:00 PM, Camera Man > wrote: > > On 06/26/2012 04:13 AM, Alex Cohn wrote: > > > >> On Tue, Jun 26, 2012 at 9:18 AM, Simon Daniels < > simondaniels23 at gmail.com> > >> wrote: > >>> > >>> I don't want to use the ffmpeg command-line to save out the frames > >>> because > >>> for some reason the frame counts are not matching. Ffmpeg.exe saves > more > >>> frame jpegs than avcodec_decode_video2 seems to find.See an old thread > >> > >> > >> > http://libav-users.943685.n4.nabble.com/Save-AVFrame-to-jpg-file-td2314979.html > > > > > > I've been using that code successfully. I've done a git pull recently, > and > > noticed that the encoders (including mjpegs) are now frame/slice > multithread > > capable. Does this mean it's possible that the return from > > avcodec_encode_video2 is somehow pipelined for mjpeg? > > > > That is, when calling avcodec_decode_video2(), you put in a packet, you > get > > a frame, but the frame might be related to an earlier packet (either > because > > of I/P/B/reference frame reordering, or because of a multithreaded > decoder). > > > > Is it possible that when calling avcodec_encode_video2() for mjpeg, you > will > > receive an encoded packet which is related to an earlier frame because of > > the new multithreading infrastructure? > > To the best of my knowledge, with multithreading you are still > expected to receive results in correct order, but the delay may be > effected. > > BR, > Alex Cohn > _______________________________________________ > 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 simondaniels23 at gmail.com Tue Jun 26 20:34:46 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 11:34:46 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe Message-ID: Hey guys, I'm doing some simply video analysis in which I walk through frames of a video and do some calculations on the pixel data. I started noticing some issues with frame timing so I tried to compare my results with a simple thumbnail extraction script using ffmpeg.exe. *The thumbnails from my code did not visually line up with the thumbnails generated by ffmpeg.exe.* For example, without frame skipping, frame #225 in my code visually lines up to #250 from ffmpeg.exe. When skipping every 10 frames (in my "real" video analysis"), #280 visually lines up to #250 from ffmpeg.exe! I'd like to think I'm just calculating my frame number wrong, but even the total frames generated by both are different. I recently upgraded ffmpeg from 0.8.3 to 0.11.1 and I don't remember these issues before. I'm going to check 0.8.3 now. *More info* - Link to video: https://dl.dropbox.com/u/28441949/sample%20video.MP4 - Total frames reported using avStream->nb_frames: *480* - Total frames by iterating through av_read_frame(): *480* - Total frames if I save each frame as a jpg (ffmpeg.exe -i input.mp4 -vframes 1 -f image2 ?sameq -vcodec mjpeg frame-%05d.jpg): *510* - If I turn AV_LOG_DEBUG on, I see several messages like this: [h264 @ 06e420c0] Frame num gap int SimplifiedScan(const char* inputfile) { AVFormatContext *pFormatCtx; AVStream *pStream; AVFrame *pFrameYUV; AVCodecContext *pCodecCtx; AVCodec *pCodec; AVPacket packet; int numBytes; uint8_t *buffer; int width; int height; int av_errno; int isFrameFinished = 0; int frameLocation = 0; av_register_all(); // Open video file pFormatCtx = avformat_alloc_context(); av_errno = avformat_open_input(&pFormatCtx, inputfile, NULL, NULL); if (av_errno < 0) { return ErrorOpeningFile; } // Retrieve stream information av_errno = avformat_find_stream_info(pFormatCtx, NULL); if (av_errno < 0) { return ErrorFindingStreamInformation; } // Find the first video stream int videoStreamIndex = -1; for(unsigned int i=0; inb_streams; i++) { if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO) { videoStreamIndex = i; break; } } if(videoStreamIndex == -1) { pLog->Write("AVHelper::GetAVStream(): Couldn't find a video stream"); return ErrorFindingVideoStream; } pStream = pFormatCtx->streams[videoStreamIndex]; // Get a pointer to the codec context for the video stream pCodecCtx = pStream->codec; // Find the decoder for the video stream pCodec=avcodec_find_decoder(pCodecCtx->codec_id); if(pCodec==NULL) { return UnsupportedCodec; } // Inform the codec that we can handle truncated bitstreams -- i.e., // bitstreams where frame boundaries can fall in the middle of packets if(pCodec->capabilities & CODEC_CAP_TRUNCATED) pCodecCtx->flags|=CODEC_FLAG_TRUNCATED; // Open codec av_errno = avcodec_open2(pCodecCtx, pCodec, NULL); if (av_errno<0) { return ErrorOpeningCodec; } width = pCodecCtx->width; height = pCodecCtx->height; // Allocate an AVFrame structure pFrameYUV=avcodec_alloc_frame(); if(pFrameYUV==NULL) { return NULL; } // Determine required buffer size and allocate buffer numBytes=avpicture_get_size(PIX_FMT_YUV420P, width, height); buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); // Assign appropriate parts of buffer to image planes in pFrameYUV avpicture_fill((AVPicture *)pFrameYUV, buffer, PIX_FMT_YUV420P, width, height); int frameSkip = 1; while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStreamIndex && frameLocation++ % frameSkip == 0) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); #if DEBUG WriteJPEG(pCodecCtx, pFrameYUV, frameLocation); #endif // Did we get a video frame? if (isFrameFinished) { // done scanning frame #if DEBUG pLog->Write("Frame finished %d", frameLocation); #endif } else pLog->Write("Frame *NOT* finished %d", frameLocation); } // whether we were supposed to decode the frame av_free_packet(&packet); } // for each available frame //delete [] buffer; av_free(buffer); // Free the YUV frame av_free(pFrameYUV); // Close the codec avcodec_close(pCodecCtx); // Close the video file av_close_input_file(pFormatCtx); return 0; } *Ffmpeg version 0.11.1: * ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers built on Jun 12 2012 21:10:06 with gcc 4.6.3 configuration: --enable-version3 --disable-w32threads --enable-runtime-cpudete ct --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-lib celt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enabl e-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable -libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enabl e-zlib libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 Any thoughts? Thanks guys! Simon -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Jun 26 20:41:08 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 18:41:08 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Frames_are_not_visually_lining_up_between_?= =?utf-8?q?my_code_and=09ffmpeg=2Eexe?= References: Message-ID: Simon Daniels writes: > The thumbnails from my code did not visually line up with > the thumbnails generated by ffmpeg.exe. Command line and complete, uncut console output missing. If you are a user and not a distributor, please always use current git head. Carl Eugen From mbradshaw at sorensonmedia.com Tue Jun 26 20:44:04 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Tue, 26 Jun 2012 12:44:04 -0600 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: On Tue, Jun 26, 2012 at 12:34 PM, Simon Daniels wrote: > // Is this a packet from the video stream? > if (packet.stream_index == videoStreamIndex && frameLocation++ % frameSkip > == 0) > { > // Decode video frame > avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); You don't want to be doing it like this, I don't think. If there are B frames in the video, this could really mess things up (because frame 2 could depend on decoding frame 1 just before it, but you skipped decoding frame 1, so now frame 2 is junk/gets decoded wrong (and now all the ones decoded after it will be junk frames too until you hit a keyframe)). From simondaniels23 at gmail.com Tue Jun 26 21:09:10 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 12:09:10 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Sorry Carl -- here you go: C:\Users\Simon>ffmpeg.exe -i "sample video.mp4" -vframes 1 -f image2 -sameq -vcodec mjpeg "frame-%05d.jpg" ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers built on Jun 12 2012 21:10:06 with gcc 4.6.3 configuration: --enable-version3 --disable-w32threads --enable-runtime-cpudete ct --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-lib celt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enabl e-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable -libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enabl e-zlib libavutil 51. 54.100 / 51. 54.100 libavcodec 54. 23.100 / 54. 23.100 libavformat 54. 6.100 / 54. 6.100 libavdevice 54. 0.100 / 54. 0.100 libavfilter 2. 77.100 / 2. 77.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 01bbc940] multiple edit list entries, a/v desync migh t occur, patch welcome Last message repeated 1 times Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PATHHIDDEN\sample video.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.4.0 Duration: 00:00:17.00, start: 0.013000, bitrate: 10128 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x960 [SAR 1:1 DAR 4:3], 10609 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 128 kb/s Metadata: creation_time : 1970-01-01 00:00:00 handler_name : SoundHandler [buffer @ 01bb8a40] w:1280 h:960 pixfmt:yuv420p tb:1/30000 sar:1/1 sws_param:fla gs=2 [buffersink @ 01bb8ca0] No opaque field provided [format @ 01bb8de0] auto-inserting filter 'auto-inserted scaler 0' between the f ilter 'src' and the filter 'format' [scale @ 01bb9080] w:1280 h:960 fmt:yuv420p sar:1/1 -> w:1280 h:960 fmt:yuvj420p sar:1/1 flags:0x4 [buffer @ 0379ce60] w:1280 h:960 pixfmt:yuv420p tb:1/30000 sar:1/1 sws_param:fla gs=2 [buffersink @ 037ad3a0] No opaque field provided [format @ 037ad400] auto-inserting filter 'auto-inserted scaler 0' between the f ilter 'src' and the filter 'format' [scale @ 037ad460] w:1280 h:960 fmt:yuv420p sar:1/1 -> w:1280 h:960 fmt:yuvj420p sar:1/1 flags:0x4 Output #0, image2, to '???sameq': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf54.6.100 Stream #0:0(eng): Video: mjpeg, yuvj420p, 1280x960 [SAR 1:1 DAR 4:3], q=2-31 , 200 kb/s, 90k tbn, 29.97 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Output #1, image2, to 'PATHHIDDEN\frame-%05d.jpg': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf54.6.100 Stream #1:0(eng): Video: mjpeg, yuvj420p, 1280x960 [SAR 1:1 DAR 4:3], q=2-31 , 200 kb/s, 90k tbn, 29.97 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> mjpeg) Stream #0:0 -> #1:0 (h264 -> mjpeg) Press [q] to stop, [?] for help frame= 1 fps=0.0 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=1.0 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.7 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.5 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.4 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.3 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.3 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.2 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 q=24.8 size= 0kB time=00:00:00.03 bitrate= 0.0 frame= 1 fps=0.1 q=6.4 Lq=24.8 size= 0kB time=00:00:00.03 bitrate= 0. 0kbits/s dup=30 drop=0 video:18652kB audio:0kB global headers:0kB muxing overhead -100.000000% On Tue, Jun 26, 2012 at 11:44 AM, Michael Bradshaw < mbradshaw at sorensonmedia.com> wrote: > On Tue, Jun 26, 2012 at 12:34 PM, Simon Daniels > wrote: > > // Is this a packet from the video stream? > > if (packet.stream_index == videoStreamIndex && frameLocation++ % > frameSkip > > == 0) > > { > > // Decode video frame > > avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); > > You don't want to be doing it like this, I don't think. If there are B > frames in the video, this could really mess things up (because frame 2 > could depend on decoding frame 1 just before it, but you skipped > decoding frame 1, so now frame 2 is junk/gets decoded wrong (and now > all the ones decoded after it will be junk frames too until you hit a > keyframe)). > _______________________________________________ > 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 simondaniels23 at gmail.com Tue Jun 26 21:11:18 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 12:11:18 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Hi Michael -- after reading into things a bit more, I agree that it's risky what I'm doing. However, I only need about 3 frames per second so maybe waiting for a key frame isn't the end of the world... Is there a safer way? The decoding is extremely expensive so I only want to do it when I absolutely need to. Thanks! On Tue, Jun 26, 2012 at 11:44 AM, Michael Bradshaw < mbradshaw at sorensonmedia.com> wrote: > On Tue, Jun 26, 2012 at 12:34 PM, Simon Daniels > wrote: > > // Is this a packet from the video stream? > > if (packet.stream_index == videoStreamIndex && frameLocation++ % > frameSkip > > == 0) > > { > > // Decode video frame > > avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); > > You don't want to be doing it like this, I don't think. If there are B > frames in the video, this could really mess things up (because frame 2 > could depend on decoding frame 1 just before it, but you skipped > decoding frame 1, so now frame 2 is junk/gets decoded wrong (and now > all the ones decoded after it will be junk frames too until you hit a > keyframe)). > _______________________________________________ > 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 Jun 26 21:15:43 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 19:15:43 +0000 (UTC) Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe References: Message-ID: Simon Daniels writes: > frame= ? ?1 fps=0.1 q=6.4 Lq=24.8 size= ? ? ? 0kB time=00:00:00.03 > bitrate= ? 0.0kbits/s dup=30 drop=0 I do not completely understand the output (may be a Windows problem), but I suspect if you get "dup=30" away, you should be "lined up". Try -vsync 0 or add -r 25 (or similar) as an output option. Carl Eugen From simondaniels23 at gmail.com Tue Jun 26 21:22:50 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 12:22:50 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Interesting. There was a difference of 30 between the frames that ffmpeg.exe output and the result of ->nb_frames. Sure enough, ffmpeg.exe with -vsync 0 output 480 frames instead of 510. So now how do I get my code's output to match ffmpeg.exe's output? (and hopefully skip frames in the process) On Tue, Jun 26, 2012 at 12:15 PM, Carl Eugen Hoyos wrote: > Simon Daniels writes: > > > frame= 1 fps=0.1 q=6.4 Lq=24.8 size= 0kB time=00:00:00.03 > > bitrate= 0.0kbits/s dup=30 drop=0 > > I do not completely understand the output (may be a Windows problem), > but I suspect if you get "dup=30" away, you should be "lined up". > Try -vsync 0 or add -r 25 (or similar) as an output option. > > 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 tapitman11 at gmail.com Tue Jun 26 21:28:28 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Tue, 26 Jun 2012 12:28:28 -0700 Subject: [Libav-user] Segfault on corrupted video Message-ID: I'm experimenting with transmitting h264 over a lossy channel. On the receiver side I have a very simple libav/opengl video player that takes the stream and feeds it to avcodec_decode_video2 one NALU at a time. There are lots of errors but mostly they just result in artifacts, which is exactly what I want to happen. However, when the channel is bad libav segfaults with: mmco: unref short failure I was wondering if anyone has a guess as to how I can avoid this crashing. I don't care if the video looks horrible, I just want it to keep going and recover when the channel improves again. I have several ideas that I was going to try: 1) Make my video player NALU aware and checksum each NALU, throwing out bad ones. 2) Make my video player frame-aware and throw out bad frames. If I knew what it was about the NALU's that are crashing libav, I would just get rid of those ones and be done with it. I'm also planning to do some simple FEC, probably at the NALU level, which will help as well. Thanks, Tim From tapitman11 at gmail.com Tue Jun 26 21:33:40 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Tue, 26 Jun 2012 12:33:40 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: Sorry I forgot to give my setup: Ubuntu Linux 10.04 ffmpeg version git-2012-05-19-31dfe20 built on May 18 2012 18:08:16 with gcc 4.4.3 On the encoder side: ffmpeg from webcam: ffmpeg \ -y \ -f \ v4l2 \ -video_size 640x480 \ -r 25 \ -i /dev/video0 \ -bufsize 50 \ -f yuv4mpegpipe \ -pix_fmt yuv420p \ pipe0 x264 to channel: x264 \ --vbv-bufsize 50 \ --vbv-maxrate 2000 \ --bitrate 600 \ --fps 25 \ --tune zerolatency \ --intra-refresh \ --ref 0 \ --keyint 7 \ --muxer raw \ -o pipe1 \ pipe0 Decoder version of ffmpeg/libav is similar On Tue, Jun 26, 2012 at 12:28 PM, Tim Pitman wrote: > I'm experimenting with transmitting h264 over a lossy channel. On the > receiver side I have a very simple libav/opengl video player that > takes the stream and feeds it to avcodec_decode_video2 one NALU at a > time. There are lots of errors but mostly they just result in > artifacts, which is exactly what I want to happen. However, when the > channel is bad libav segfaults with: > > mmco: unref short failure > > I was wondering if anyone has a guess as to how I can avoid this > crashing. I don't care if the video looks horrible, I just want it to > keep going and recover when the channel improves again. > > I have several ideas that I was going to try: > 1) Make my video player NALU aware and checksum each NALU, throwing > out bad ones. > 2) Make my video player frame-aware and throw out bad frames. > > If I knew what it was about the NALU's that are crashing libav, I > would just get rid of those ones and be done with it. > > I'm also planning to do some simple FEC, probably at the NALU level, > which will help as well. > > Thanks, > Tim From cehoyos at ag.or.at Tue Jun 26 21:35:48 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 26 Jun 2012 19:35:48 +0000 (UTC) Subject: [Libav-user] Segfault on corrupted video References: Message-ID: Tim Pitman writes: > There are lots of errors but mostly they just result in > artifacts, which is exactly what I want to happen. However, > when the channel is bad libav segfaults with: > > mmco: unref short failure (Crashes are always important bugs) Can you reproduce the bug with ffmpeg (instead of using your application)? Please confirm that you are using current git head from http://ffmpeg.org/download.html and please provide backtrace etc. as explained on http://ffmpeg.org/bugreports.html Carl Eugen From simondaniels23 at gmail.com Tue Jun 26 21:57:24 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Tue, 26 Jun 2012 12:57:24 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: I've confirmed this does seem to be a regression. https://dl.dropbox.com/u/28441949/0.8.3.results.zip https://dl.dropbox.com/u/28441949/0.11.1.results.zip I ran the same code with the same video on ffmpeg 0.8.3 and 0.11.1 and you can see the thumbnails generated are not the same. #281 in 0.11.1 lines up with #221 in 0.8.3. On Tue, Jun 26, 2012 at 12:22 PM, Simon Daniels wrote: > Interesting. There was a difference of 30 between the frames that > ffmpeg.exe output and the result of ->nb_frames. > > Sure enough, ffmpeg.exe with -vsync 0 output 480 frames instead of 510. So > now how do I get my code's output to match ffmpeg.exe's output? (and > hopefully skip frames in the process) > > > > > On Tue, Jun 26, 2012 at 12:15 PM, Carl Eugen Hoyos wrote: > >> Simon Daniels writes: >> >> > frame= 1 fps=0.1 q=6.4 Lq=24.8 size= 0kB time=00:00:00.03 >> > bitrate= 0.0kbits/s dup=30 drop=0 >> >> I do not completely understand the output (may be a Windows problem), >> but I suspect if you get "dup=30" away, you should be "lined up". >> Try -vsync 0 or add -r 25 (or similar) as an output option. >> >> 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 mbradshaw at sorensonmedia.com Tue Jun 26 22:16:30 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Tue, 26 Jun 2012 14:16:30 -0600 Subject: [Libav-user] Crash/access violation when flushing when encoding audio Message-ID: Hi, I'm encoding an AMR-NB stream, and I see that the libopen-core-amrnb encoder has the CODEC_CAP_DELAY capability set. If I call avcodec_encode_audio2() with a NULL frame (like the docs say to when flushing the stream) more than once, I get an access violation and a crash (it works the first time though). I have to call av_init_packet() on the packet I pass to avcodec_encode_audio2() in order to avoid the crash (despite the fact that the docs say avcodec_encode_audio2() will call av_init_packet() for me (and I am setting the data and size fields of the packet to my own buffer, if that matters)). Is this behavior expected and lacking documentation, or is it likely a bug? I can, of course, provide greater details if it looks like a bug. Thanks, Michael From tapitman11 at gmail.com Tue Jun 26 22:51:07 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Tue, 26 Jun 2012 13:51:07 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: Ok, I did some more testing, and the problem is not reproducible with either ffmpeg or ffplay. I created a dump of the corrupted video stream. When I play it back through my player it crashes but ffplay just throws some new errors and then stops and the end of the video. Any ideas? On Tue, Jun 26, 2012 at 12:35 PM, Carl Eugen Hoyos wrote: > Tim Pitman writes: > >> There are lots of errors but mostly they just result in >> artifacts, which is exactly what I want to happen. However, >> when the channel is bad libav segfaults with: >> >> mmco: unref short failure > > (Crashes are always important bugs) > Can you reproduce the bug with ffmpeg (instead of using your application)? > Please confirm that you are using current git head from > http://ffmpeg.org/download.html and please provide backtrace etc. > as explained on http://ffmpeg.org/bugreports.html > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From tapitman11 at gmail.com Tue Jun 26 22:57:32 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Tue, 26 Jun 2012 13:57:32 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: After using gdb to run a backtrace it looks like my problem may be in my OpenGL rendering. Sorry about that. However, I still have one general question: When it comes to error detection in situations like this, is dropping corrupted data at the NALU level a good way to go, or is there a better way? Would I get much advantage from encapsulating in RTP packets? Thanks, Tim On Tue, Jun 26, 2012 at 1:51 PM, Tim Pitman wrote: > Ok, I did some more testing, and the problem is not reproducible with > either ffmpeg or ffplay. I created a dump of the corrupted video > stream. When I play it back through my player it crashes but ffplay > just throws some new errors and then stops and the end of the video. > > Any ideas? > > On Tue, Jun 26, 2012 at 12:35 PM, Carl Eugen Hoyos wrote: >> Tim Pitman writes: >> >>> There are lots of errors but mostly they just result in >>> artifacts, which is exactly what I want to happen. However, >>> when the channel is bad libav segfaults with: >>> >>> mmco: unref short failure >> >> (Crashes are always important bugs) >> Can you reproduce the bug with ffmpeg (instead of using your application)? >> Please confirm that you are using current git head from >> http://ffmpeg.org/download.html and please provide backtrace etc. >> as explained on http://ffmpeg.org/bugreports.html >> >> Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user From mbradshaw at sorensonmedia.com Tue Jun 26 23:38:47 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Tue, 26 Jun 2012 15:38:47 -0600 Subject: [Libav-user] Crash/access violation when flushing when encoding audio In-Reply-To: References: Message-ID: On Tue, Jun 26, 2012 at 2:16 PM, Michael Bradshaw wrote: > Hi, > > I'm encoding an AMR-NB stream, and I see that the libopen-core-amrnb > encoder has the CODEC_CAP_DELAY capability set. If I call > avcodec_encode_audio2() with a NULL frame (like the docs say to when > flushing the stream) more than once, I get an access violation and a > crash (it works the first time though). I have to call > av_init_packet() on the packet I pass to avcodec_encode_audio2() in > order to avoid the crash (despite the fact that the docs say > avcodec_encode_audio2() will call av_init_packet() for me (and I am > setting the data and size fields of the packet to my own buffer, if > that matters)). Is this behavior expected and lacking documentation, > or is it likely a bug? I can, of course, provide greater details if it > looks like a bug. I've dug around and it looks like avcodec_encode_audio2() is failing (which is fine, since there aren't any more buffered frames queued up), so it tries to call avpkt->destruct since the data is user-supplied by me. I was assuming av_init_packet() would be called _before_ any of this, but it does not look like it is (which I suppose makes sense, since it would overwrite avpkt->destruct (but it overwrites this anyway later, which seems weird to me)). Anyway, I guess this is just a misunderstanding of the documentation, and not necessarily a real lack thereof or a bug. --Michael From x.morion.x at gmail.com Wed Jun 27 02:44:01 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Wed, 27 Jun 2012 11:44:01 +1100 Subject: [Libav-user] avcodec_encode_video hangs Message-ID: I'm using libav to encode video with x264 encoder. Typically everything works good but sometime it just hangs in avcodec_encode_video and never returns. It usually happens after few minutes of encoding but not each time and I don't see any regularity. Does anyone have an idea what could cause that? From pkoshevoy at gmail.com Wed Jun 27 05:26:20 2012 From: pkoshevoy at gmail.com (Pavel Koshevoy) Date: Tue, 26 Jun 2012 21:26:20 -0600 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: <4FEA7D5C.9020407@gmail.com> On 06/26/2012 01:11 PM, Simon Daniels wrote: > Hi Michael -- after reading into things a bit more, I agree that it's risky > what I'm doing. However, I only need about 3 frames per second so maybe > waiting for a key frame isn't the end of the world... > > Is there a safer way? The decoding is extremely expensive so I only want to do > it when I absolutely need to. > You can avoid decoding some frames by setting AVStream.codec->skip_frame flag. Pavel. From cehoyos at ag.or.at Wed Jun 27 07:45:38 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 27 Jun 2012 05:45:38 +0000 (UTC) Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe References: Message-ID: Simon Daniels writes: > I've confirmed this does seem to be a regression. > I ran the same code with the same video on ffmpeg 0.8.3 > and 0.11.1 and you can see the thumbnails generated are > not the same. #281 in 0.11.1 lines up with #221 in 0.8.3. Please provide the input file. Carl Eugen From michaelni at gmx.at Wed Jun 27 11:37:37 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 27 Jun 2012 11:37:37 +0200 Subject: [Libav-user] Crash/access violation when flushing when encoding audio In-Reply-To: References: Message-ID: <20120627093737.GA29207@kiste2> On Tue, Jun 26, 2012 at 03:38:47PM -0600, Michael Bradshaw wrote: > On Tue, Jun 26, 2012 at 2:16 PM, Michael Bradshaw > wrote: > > Hi, > > > > I'm encoding an AMR-NB stream, and I see that the libopen-core-amrnb > > encoder has the CODEC_CAP_DELAY capability set. If I call > > avcodec_encode_audio2() with a NULL frame (like the docs say to when > > flushing the stream) more than once, I get an access violation and a > > crash (it works the first time though). I have to call > > av_init_packet() on the packet I pass to avcodec_encode_audio2() in > > order to avoid the crash (despite the fact that the docs say > > avcodec_encode_audio2() will call av_init_packet() for me (and I am > > setting the data and size fields of the packet to my own buffer, if > > that matters)). Is this behavior expected and lacking documentation, > > or is it likely a bug? I can, of course, provide greater details if it > > looks like a bug. > > I've dug around and it looks like avcodec_encode_audio2() is failing > (which is fine, since there aren't any more buffered frames queued > up), so it tries to call avpkt->destruct since the data is > user-supplied by me. I was assuming av_init_packet() would be called > _before_ any of this, but it does not look like it is (which I suppose > makes sense, since it would overwrite avpkt->destruct (but it > overwrites this anyway later, which seems weird to me)). where is avpkt->destruct overwritten ? there should be code to restore it after av_init_packet > > Anyway, I guess this is just a misunderstanding of the documentation, > and not necessarily a real lack thereof or a bug. yes, i think so too, a patch that documents that ->destruct has to be set is welcome thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB You can kill me, but you cannot change the truth. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From jelofsson at gmail.com Wed Jun 27 14:19:59 2012 From: jelofsson at gmail.com (Jonas Elofsson) Date: Wed, 27 Jun 2012 14:19:59 +0200 Subject: [Libav-user] display_picture_number Message-ID: Hi, I'm currently working on using FFMpeg in Qt, and so far it works good. However, when I decode a frame, the value display_picture_number seems not updated. It always reads zero. How can this be made to work? And if it can't, what is the recommended (most stable) way to get the decoded frame number? Thankful for any input! Best regards, Jonas -------------- next part -------------- An HTML attachment was scrubbed... URL: From radford.parker at gmail.com Wed Jun 27 16:39:09 2012 From: radford.parker at gmail.com (Radford Parker) Date: Wed, 27 Jun 2012 07:39:09 -0700 (PDT) Subject: [Libav-user] video question In-Reply-To: References: Message-ID: <1340807949610-4655316.post@n4.nabble.com> Neil, I had a similar problem with mpegts over UDP and recompiling libav/ffmpeg with --disable-pthreads did the trick. I am still receiving errors and the frames are all pixelated and corrupted, but no segfaulting. Did you have any luck getting this working end to end? -- View this message in context: http://libav-users.943685.n4.nabble.com/video-question-tp2250821p4655316.html Sent from the libav-users mailing list archive at Nabble.com. From nhmenne42 at students.tntech.edu Wed Jun 27 17:26:01 2012 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Wed, 27 Jun 2012 11:26:01 -0400 Subject: [Libav-user] video question In-Reply-To: <1340807949610-4655316.post@n4.nabble.com> References: <1340807949610-4655316.post@n4.nabble.com> Message-ID: For my specific problem, I was able to disable pthreads and everything was ok. For the transport stream itself, i had to parse it and then resend it via UDP. I never had a pixelation issue, but it was a couple ffmpeg versions ago. On Wed, Jun 27, 2012 at 10:39 AM, Radford Parker wrote: > Neil, > > I had a similar problem with mpegts over UDP and recompiling libav/ffmpeg > with --disable-pthreads did the trick. I am still receiving errors and the > frames are all pixelated and corrupted, but no segfaulting. Did you have > any > luck getting this working end to end? > > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/video-question-tp2250821p4655316.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 simondaniels23 at gmail.com Wed Jun 27 18:43:19 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Wed, 27 Jun 2012 09:43:19 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Input file: https://dl.dropbox.com/u/28441949/sample%20video.MP4 On Tue, Jun 26, 2012 at 10:45 PM, Carl Eugen Hoyos wrote: > Simon Daniels writes: > > > I've confirmed this does seem to be a regression. > > > I ran the same code with the same video on ffmpeg 0.8.3 > > and 0.11.1 and you can see the thumbnails generated are > > not the same. #281 in 0.11.1 lines up with #221 in 0.8.3. > > Please provide the input file. > > 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 simondaniels23 at gmail.com Wed Jun 27 18:43:34 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Wed, 27 Jun 2012 09:43:34 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: <4FEA7D5C.9020407@gmail.com> References: <4FEA7D5C.9020407@gmail.com> Message-ID: Thanks Pavel but it doesn't look like I can use the ->skip_frame flag to specify a particular number of frames to skip. From: http://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#g352363bce7d3ed82c101b3bc001d1c16 *AVDISCARD_NONE* discard nothing*AVDISCARD_DEFAULT* discard useless packets like 0 size packets in avi*AVDISCARD_NONREF* discard all non reference* AVDISCARD_BIDIR* discard all bidirectional frames*AVDISCARD_NONKEY* discard all frames except keyframes*AVDISCARD_ALL* discard all On Tue, Jun 26, 2012 at 8:26 PM, Pavel Koshevoy wrote: > On 06/26/2012 01:11 PM, Simon Daniels wrote: > >> Hi Michael -- after reading into things a bit more, I agree that it's >> risky what I'm doing. However, I only need about 3 frames per second so >> maybe waiting for a key frame isn't the end of the world... >> >> Is there a safer way? The decoding is extremely expensive so I only want >> to do it when I absolutely need to. >> >> > You can avoid decoding some frames by setting AVStream.codec->skip_frame > flag. > > Pavel. > > > ______________________________**_________________ > 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 mbradshaw at sorensonmedia.com Wed Jun 27 19:50:48 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 27 Jun 2012 11:50:48 -0600 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: On Tue, Jun 26, 2012 at 1:11 PM, Simon Daniels wrote: > Hi Michael -- after reading into things a bit more, I agree that it's risky > what I'm doing. However, I only need about 3 frames per second so maybe > waiting for a key frame isn't the end of the world... > > Is there a safer way? The decoding is extremely expensive so I only want to > do it when I absolutely need to. I'm not the most knowledgable about this, so someone correct me if I'm wrong/if there's a better way... You've got an H264 stream. H264 streams can have P and B-frames, and both P and B-frames depend on the previous frame to be properly decoded. If you're just skipping frames without decoding them, it's possible (and I'd say quite likely) you'll try and decode a P or B-frame after skipping the previous frame that this frame depended on. The only way I know of to "skip" every X frames is to: decode all the frames, and only use the ones you need, or only decode keyframes (but it's possible there can be a few seconds between two keyframes). AVPacket.flag can be used to know if the packet has a keyframe (check for AV_PKT_FLAG_KEY). From mbradshaw at sorensonmedia.com Wed Jun 27 20:11:53 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 27 Jun 2012 12:11:53 -0600 Subject: [Libav-user] Crash/access violation when flushing when encoding audio In-Reply-To: <20120627093737.GA29207@kiste2> References: <20120627093737.GA29207@kiste2> Message-ID: On Wed, Jun 27, 2012 at 3:37 AM, Michael Niedermayer wrote: > On Tue, Jun 26, 2012 at 03:38:47PM -0600, Michael Bradshaw wrote: >> On Tue, Jun 26, 2012 at 2:16 PM, Michael Bradshaw >> wrote: >> > Hi, >> > >> > I'm encoding an AMR-NB stream, and I see that the libopen-core-amrnb >> > encoder has the CODEC_CAP_DELAY capability set. If I call >> > avcodec_encode_audio2() with a NULL frame (like the docs say to when >> > flushing the stream) more than once, I get an access violation and a >> > crash (it works the first time though). I have to call >> > av_init_packet() on the packet I pass to avcodec_encode_audio2() in >> > order to avoid the crash (despite the fact that the docs say >> > avcodec_encode_audio2() will call av_init_packet() for me (and I am >> > setting the data and size fields of the packet to my own buffer, if >> > that matters)). Is this behavior expected and lacking documentation, >> > or is it likely a bug? I can, of course, provide greater details if it >> > looks like a bug. >> >> I've dug around and it looks like avcodec_encode_audio2() is failing >> (which is fine, since there aren't any more buffered frames queued >> up), so it tries to call avpkt->destruct since the data is >> user-supplied by me. I was assuming av_init_packet() would be called >> _before_ any of this, but it does not look like it is (which I suppose >> makes sense, since it would overwrite avpkt->destruct (but it >> overwrites this anyway later, which seems weird to me)). > > where is avpkt->destruct overwritten ? > there should be code to restore it after av_init_packet Turns out it's not overwritten. I just thought it would be because of how the documentation is worded. >> Anyway, I guess this is just a misunderstanding of the documentation, >> and not necessarily a real lack thereof or a bug. > > yes, i think so too, a patch that documents that ->destruct has to be > set is welcome Okay, I'll work on one. Thanks, --Michael From radford.parker at gmail.com Wed Jun 27 20:16:22 2012 From: radford.parker at gmail.com (Radford Parker) Date: Wed, 27 Jun 2012 11:16:22 -0700 (PDT) Subject: [Libav-user] video question In-Reply-To: References: <1340807949610-4655316.post@n4.nabble.com> Message-ID: <1340820982090-4655322.post@n4.nabble.com> Thanks for the info. What did you do to parse it a resend it? Were you just running an ffmpeg command or did you do it in the code? Would you mind sharing your code for opening the connection and getting frames? Thanks for your help. -- View this message in context: http://libav-users.943685.n4.nabble.com/video-question-tp2250821p4655322.html Sent from the libav-users mailing list archive at Nabble.com. From noah at highlighthunter.com Wed Jun 27 18:03:57 2012 From: noah at highlighthunter.com (Noah Spitzer-Williams) Date: Wed, 27 Jun 2012 09:03:57 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Input file: https://dl.dropbox.com/u/28441949/sample%20video.MP4 On Tue, Jun 26, 2012 at 10:45 PM, Carl Eugen Hoyos wrote: > Simon Daniels writes: > > > I've confirmed this does seem to be a regression. > > > I ran the same code with the same video on ffmpeg 0.8.3 > > and 0.11.1 and you can see the thumbnails generated are > > not the same. #281 in 0.11.1 lines up with #221 in 0.8.3. > > Please provide the input file. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Noah Spitzer-Williams CEO, Highlight Hunter voice: 607-398-0460 web: www.highlighthunter.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From noah at highlighthunter.com Wed Jun 27 18:15:32 2012 From: noah at highlighthunter.com (Noah Spitzer-Williams) Date: Wed, 27 Jun 2012 09:15:32 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: <4FEA7D5C.9020407@gmail.com> References: <4FEA7D5C.9020407@gmail.com> Message-ID: Thanks Pavel but it doesn't look like I can use the ->skip_frame flag to specify a particular number of frames to skip. From: http://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#g352363bce7d3ed82c101b3bc001d1c16 *AVDISCARD_NONE* discard nothing*AVDISCARD_DEFAULT* discard useless packets like 0 size packets in avi*AVDISCARD_NONREF* discard all non reference* AVDISCARD_BIDIR* discard all bidirectional frames*AVDISCARD_NONKEY* discard all frames except keyframes*AVDISCARD_ALL* discard all On Tue, Jun 26, 2012 at 8:26 PM, Pavel Koshevoy wrote: > On 06/26/2012 01:11 PM, Simon Daniels wrote: > >> Hi Michael -- after reading into things a bit more, I agree that it's >> risky what I'm doing. However, I only need about 3 frames per second so >> maybe waiting for a key frame isn't the end of the world... >> >> Is there a safer way? The decoding is extremely expensive so I only want >> to do it when I absolutely need to. >> >> > You can avoid decoding some frames by setting AVStream.codec->skip_frame > flag. > > Pavel. > > > ______________________________**_________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/**listinfo/libav-user > -- Noah Spitzer-Williams CEO, Highlight Hunter voice: 607-398-0460 web: www.highlighthunter.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From nhmenne42 at students.tntech.edu Wed Jun 27 21:16:38 2012 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Wed, 27 Jun 2012 15:16:38 -0400 Subject: [Libav-user] video question In-Reply-To: <1340820982090-4655322.post@n4.nabble.com> References: <1340807949610-4655316.post@n4.nabble.com> <1340820982090-4655322.post@n4.nabble.com> Message-ID: It was just a UDP receive using some generic udp socket in qt. I then sent it via udp send and just had ffmpeg listening to the rebroadcast port On Jun 27, 2012 2:36 PM, "Radford Parker" wrote: > Thanks for the info. What did you do to parse it a resend it? Were you just > running an ffmpeg command or did you do it in the code? Would you mind > sharing your code for opening the connection and getting frames? Thanks for > your help. > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/video-question-tp2250821p4655322.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 tapitman11 at gmail.com Wed Jun 27 21:59:48 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Wed, 27 Jun 2012 12:59:48 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: After continued debugging I've narrowed things down somewhat. after getting a picture from avcodec_decode_video2, I pass the data from the picture to glTexImage2D, which is what seems to be crashing. When I backtrace with gdb it says the the address stored in picture->data[0] is out of bounds. So I'm guessing that the unref error coming from libavcodec isn't what's actually crashing, but it's related. Any ideas? Can someone provide more info about what normally causes unref short errors? Thanks, Tim On Tue, Jun 26, 2012 at 1:57 PM, Tim Pitman wrote: > After using gdb to run a backtrace it looks like my problem may be in > my OpenGL rendering. Sorry about that. > > However, I still have one general question: When it comes to error > detection in situations like this, is dropping corrupted data at the > NALU level a good way to go, or is there a better way? Would I get > much advantage from encapsulating in RTP packets? > > Thanks, > Tim > > On Tue, Jun 26, 2012 at 1:51 PM, Tim Pitman wrote: >> Ok, I did some more testing, and the problem is not reproducible with >> either ffmpeg or ffplay. I created a dump of the corrupted video >> stream. When I play it back through my player it crashes but ffplay >> just throws some new errors and then stops and the end of the video. >> >> Any ideas? >> >> On Tue, Jun 26, 2012 at 12:35 PM, Carl Eugen Hoyos wrote: >>> Tim Pitman writes: >>> >>>> There are lots of errors but mostly they just result in >>>> artifacts, which is exactly what I want to happen. However, >>>> when the channel is bad libav segfaults with: >>>> >>>> mmco: unref short failure >>> >>> (Crashes are always important bugs) >>> Can you reproduce the bug with ffmpeg (instead of using your application)? >>> Please confirm that you are using current git head from >>> http://ffmpeg.org/download.html and please provide backtrace etc. >>> as explained on http://ffmpeg.org/bugreports.html >>> >>> Carl Eugen >>> >>> _______________________________________________ >>> Libav-user mailing list >>> Libav-user at ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/libav-user From tapitman11 at gmail.com Thu Jun 28 01:58:57 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Wed, 27 Jun 2012 16:58:57 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: Alrighty, I was relying on the return value from avcodec_decode_video2. Basically I assumed that if it was > 0 then the picture was valid. However, I was curious about what got_picture was for so if changed: if (ret > 0) to if (ret > 0 && got_picture) It no longer crashes, but instead seems to freeze for a few seconds, which is definitely a big step in the right direction. What is the difference between the return value and got_picture? Thanks, Tim On Wed, Jun 27, 2012 at 12:59 PM, Tim Pitman wrote: > After continued debugging I've narrowed things down somewhat. after > getting a picture from avcodec_decode_video2, I pass the data from the > picture to glTexImage2D, which is what > seems to be crashing. When I backtrace with gdb it says the the > address stored in picture->data[0] > is out of bounds. So I'm guessing that the unref error coming from > libavcodec isn't what's actually crashing, > but it's related. Any ideas? Can someone provide more info about what > normally causes unref short errors? > > Thanks, > Tim > > On Tue, Jun 26, 2012 at 1:57 PM, Tim Pitman wrote: >> After using gdb to run a backtrace it looks like my problem may be in >> my OpenGL rendering. Sorry about that. >> >> However, I still have one general question: When it comes to error >> detection in situations like this, is dropping corrupted data at the >> NALU level a good way to go, or is there a better way? Would I get >> much advantage from encapsulating in RTP packets? >> >> Thanks, >> Tim >> >> On Tue, Jun 26, 2012 at 1:51 PM, Tim Pitman wrote: >>> Ok, I did some more testing, and the problem is not reproducible with >>> either ffmpeg or ffplay. I created a dump of the corrupted video >>> stream. When I play it back through my player it crashes but ffplay >>> just throws some new errors and then stops and the end of the video. >>> >>> Any ideas? >>> >>> On Tue, Jun 26, 2012 at 12:35 PM, Carl Eugen Hoyos wrote: >>>> Tim Pitman writes: >>>> >>>>> There are lots of errors but mostly they just result in >>>>> artifacts, which is exactly what I want to happen. However, >>>>> when the channel is bad libav segfaults with: >>>>> >>>>> mmco: unref short failure >>>> >>>> (Crashes are always important bugs) >>>> Can you reproduce the bug with ffmpeg (instead of using your application)? >>>> Please confirm that you are using current git head from >>>> http://ffmpeg.org/download.html and please provide backtrace etc. >>>> as explained on http://ffmpeg.org/bugreports.html >>>> >>>> Carl Eugen >>>> >>>> _______________________________________________ >>>> Libav-user mailing list >>>> Libav-user at ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/libav-user From mbradshaw at sorensonmedia.com Thu Jun 28 02:13:38 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 27 Jun 2012 18:13:38 -0600 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: On Wed, Jun 27, 2012 at 5:58 PM, Tim Pitman wrote: > Alrighty, > > I was relying on the return value from avcodec_decode_video2. > Basically I assumed that if it was > 0 then the picture was valid. > However, I was curious about what got_picture was for so if changed: > > if (ret > 0) > > to > > if (ret > 0 && got_picture) > > It no longer crashes, but instead seems to freeze for a few seconds, > which is definitely a big step in the right direction. > > What is the difference between the return value and got_picture? Some codecs require you to decode several frames before you can start getting usable pictures. For example, if you look at http://en.wikipedia.org/wiki/Video_compression_picture_types you will see that in the sample picture the frame sequence goes I-P-B-I. You won't get a usable picture from the B-frame until you decode the last I-frame, so in this example that B-frame would ret > 0 (because it was successful) but got_picture == 0 (because it's buffering the picture and has to wait for the next frame before you can get a usable frame out). This is also why you have to flush some codecs. Look at what the docs say about avcodec_decode_video2 for codecs that have CODEC_CAP_DELAY capability set. That "freeze" for a few seconds is your app just decoding the first several frames until it finally has enough information decoded that you start getting usable frames out. --Michael From tapitman11 at gmail.com Thu Jun 28 02:26:43 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Wed, 27 Jun 2012 17:26:43 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: Interesting. However, I'm using x264 with --intra-refresh and --tune zerolatency (no b frames). On Wed, Jun 27, 2012 at 5:13 PM, Michael Bradshaw wrote: > On Wed, Jun 27, 2012 at 5:58 PM, Tim Pitman wrote: >> Alrighty, >> >> I was relying on the return value from avcodec_decode_video2. >> Basically I assumed that if it was > 0 then the picture was valid. >> However, I was curious about what got_picture was for so if changed: >> >> if (ret > 0) >> >> to >> >> if (ret > 0 && got_picture) >> >> It no longer crashes, but instead seems to freeze for a few seconds, >> which is definitely a big step in the right direction. >> >> What is the difference between the return value and got_picture? > > Some codecs require you to decode several frames before you can start > getting usable pictures. For example, if you look at > http://en.wikipedia.org/wiki/Video_compression_picture_types you will > see that in the sample picture the frame sequence goes I-P-B-I. You > won't get a usable picture from the B-frame until you decode the last > I-frame, so in this example that B-frame would ret > 0 (because it was > successful) but got_picture == 0 (because it's buffering the picture > and has to wait for the next frame before you can get a usable frame > out). > > This is also why you have to flush some codecs. Look at what the docs > say about avcodec_decode_video2 for codecs that have CODEC_CAP_DELAY > capability set. > > That "freeze" for a few seconds is your app just decoding the first > several frames until it finally has enough information decoded that > you start getting usable frames out. > > --Michael > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From mbradshaw at sorensonmedia.com Thu Jun 28 03:17:16 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 27 Jun 2012 19:17:16 -0600 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: On Wed, Jun 27, 2012 at 6:26 PM, Tim Pitman wrote: > Interesting. However, I'm using x264 with --intra-refresh and --tune > zerolatency (no b frames). Sorry, I missed that part. From alexcohn at netvision.net.il Thu Jun 28 08:16:56 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Thu, 28 Jun 2012 09:16:56 +0300 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: On Thu, Jun 28, 2012 at 4:17 AM, Michael Bradshaw wrote: > > On Wed, Jun 27, 2012 at 6:26 PM, Tim Pitman wrote: > > Interesting. However, I'm using x264 with --intra-refresh and --tune > > zerolatency (no b frames). > > Sorry, I missed that part. At any rate, it seems that in some cases of corrupted input, the decoder simply decides to stop producing got_pictue. On Wed, Jun 27, 2012 at 5:58 PM, Tim Pitman wrote: > It no longer crashes, but instead seems to freeze for a few seconds, > which is definitely a big step in the right direction. Do I understand correctly that this happens not at the beginning of the stream (which would be a result of non-zero latency in the source), but after packet loss? Alex From jelofsson at gmail.com Thu Jun 28 10:09:50 2012 From: jelofsson at gmail.com (Jonas Elofsson) Date: Thu, 28 Jun 2012 10:09:50 +0200 Subject: [Libav-user] Frame number Message-ID: Hi, Resending this, it seems my first post never got through... I'm taking the first, trembling steps to use FFMpeg in Qt, primary for a video editing SW. So far it is working good, I can decode frames to a QImage in Qt and display them on a label. Even video playback works good on a QLabel up to 200 frames/s or so. But, what I cannot find is a way to see what frame (displayed framenumber) I just decoded. Coded framenumber I can see, but they are (of course) not useable directly, and also are not available for all formats. Displayed framenumber is not working, either always 0, 0x80000000... or other none-telling values. What I need is a good, solid way to always be able to identify the current frame number. If you have a solution or just an idea, please let me know! Best regards, Jonas -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.george at normalesup.org Thu Jun 28 10:52:46 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Thu, 28 Jun 2012 10:52:46 +0200 Subject: [Libav-user] Frame number In-Reply-To: References: Message-ID: <20120628085246.GA16221@phare.normalesup.org> Le primidi 11 messidor, an CCXX, Jonas Elofsson a ?crit?: > But, what I cannot find is a way to see what frame (displayed framenumber) > I just decoded. Coded framenumber I can see, but they are (of course) not > useable directly, and also are not available for all formats. Displayed > framenumber is not working, either always 0, 0x80000000... or other > none-telling values. Please trim your code to the shortest possible example showing your problem and post it here. > What I need is a good, solid way to always be able to identify the current > frame number. Note that for most modern formats, "frame number" is an irrelevant information. You need to look at the timestamps. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From mark.kenna at sureviewsystems.com Thu Jun 28 12:28:33 2012 From: mark.kenna at sureviewsystems.com (Mark Kenna) Date: Thu, 28 Jun 2012 11:28:33 +0100 Subject: [Libav-user] av_read_frame blocking Message-ID: <4FEC31D1.8080502@sureviewsystems.com> Hi All I am trying to implement a way of cancelling the call to av_read_frame(..) which seems to block indefinitely. I have added the interrupt callback to the formatcontext but this callback only gets fired on the call to avformat_open_input(..) not the call to av_read_frame(...). I have also tried setting AVFMT_FLAG_NONBLOCK but this doesn't work either. The problem does not seem to happen when using UDP though..? Anyone have any suggestions? Thanks, Mark. From goocreations at gmail.com Thu Jun 28 14:18:22 2012 From: goocreations at gmail.com (GOO Creations) Date: Thu, 28 Jun 2012 14:18:22 +0200 Subject: [Libav-user] Encoding FLAC - no duration Message-ID: <4FEC4B8E.9090703@gmail.com> Hi, I'm using the AVCodec API as a basis for encoding audio. I managed to successfully create a WAV file. When I encode a FLAC file the encoding succeeds, but when I open the file, the sound plays, but no media player can detect the length of the FLAC file. When I use the ffmpeg command line tool, I get the following info on the file: /[flac @ 0x94e8380] max_analyze_duration 5000000 reached at 5015510/ /[flac @ 0x94e8380] Estimating duration from bitrate, this may be inaccurate/ /Input #0, flac, from '00001.flac':/ / Metadata:/ / ENCODER : Lavf54.3.100/ / Duration: N/A, bitrate: N/A/ / Stream #0:0: Audio: flac, 44100 Hz, stereo, s16/ So here it also seems that the duration cannot be retrieved. I'm writing all headers and trailers ( /avformat_write_header(formatContext, NULL)/ and /av_write_trailer(formatContext)/ ). Does anyone know what I might be missing? Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: From tapitman11 at gmail.com Thu Jun 28 19:24:30 2012 From: tapitman11 at gmail.com (Tim Pitman) Date: Thu, 28 Jun 2012 10:24:30 -0700 Subject: [Libav-user] Segfault on corrupted video In-Reply-To: References: Message-ID: I'm not sure exactly what you mean, but yes as near as I can tell it only freezes after packet loss. It was hard to tell when it was freezing because there wasn't a lot of motion in the video but I'm going to play with it some more today and try to identify more solid patterns. On Wed, Jun 27, 2012 at 11:16 PM, Alex Cohn wrote: > On Thu, Jun 28, 2012 at 4:17 AM, Michael Bradshaw > wrote: >> >> On Wed, Jun 27, 2012 at 6:26 PM, Tim Pitman wrote: >> > Interesting. However, I'm using x264 with --intra-refresh and --tune >> > zerolatency (no b frames). >> >> Sorry, I missed that part. > > At any rate, it seems that in some cases of corrupted input, the > decoder simply decides to stop producing got_pictue. > > On Wed, Jun 27, 2012 at 5:58 PM, Tim Pitman wrote: >> It no longer crashes, but instead seems to freeze for a few seconds, >> which is definitely a big step in the right direction. > > Do I understand correctly that this happens not at the beginning of > the stream (which would be a result of non-zero latency in the > source), but after packet loss? > > Alex > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From halonso at vpod.tv Thu Jun 28 10:46:09 2012 From: halonso at vpod.tv (Hector Alonso) Date: Thu, 28 Jun 2012 10:46:09 +0200 Subject: [Libav-user] Frame number In-Reply-To: References: Message-ID: Hi, you have to use the decoding or presentation timestamp and calculate it from the frame rate (time base of the stream). On Thu, Jun 28, 2012 at 10:09 AM, Jonas Elofsson wrote: > Hi, > > Resending this, it seems my first post never got through... > > I'm taking the first, trembling steps to use FFMpeg in Qt, primary for a > video editing SW. So far it is working good, I can decode frames to a > QImage in Qt and display them on a label. Even video playback works good on > a QLabel up to 200 frames/s or so. > > But, what I cannot find is a way to see what frame (displayed framenumber) > I just decoded. Coded framenumber I can see, but they are (of course) not > useable directly, and also are not available for all formats. Displayed > framenumber is not working, either always 0, 0x80000000... or other > none-telling values. > > What I need is a good, solid way to always be able to identify the current > frame number. > > If you have a solution or just an idea, please let me know! > > Best regards, Jonas > > > > _______________________________________________ > 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 amir.rouhi at rmit.edu.au Fri Jun 29 04:51:00 2012 From: amir.rouhi at rmit.edu.au (Rouhi Amirhossein2) Date: Fri, 29 Jun 2012 12:51:00 +1000 Subject: [Libav-user] Extracting I-Frame intra-prediction modes In-Reply-To: References: Message-ID: Unfortunately -debug does not serve my purpose . i need intra-predictions and i should add some lins in ffmpeg coding like fprint () function to save them in a text file. On 26 June 2012 20:51, Alex Cohn wrote: > On Tue, Jun 26, 2012 at 12:21 PM, Rouhi Amirhossein2 > wrote: > > Hi Misha > > Thanks for prompt reply. That would be a very useful code for extracting > key > > frame images. but actually need to extract the intra-prediction modes in > > each key frame of an input video stream. Can you help me to achieve this? > > the input of the program would be an h264 raw video file and the output > > would be a text file that stores intra-prediction modes with related MB > > address and i-frame id. > > > > > > On 26 June 2012 19:12, Misha Penkov wrote: > >> > >> On 26 June 2012 18:05, Rouhi Amirhossein2 > wrote: > >> > > >> > Hi > >> > You know that in h264, a methos is used for compression which is > called > >> > intra prediction method. totally we have 9 intra prediction modes > which > >> > showing different direction of top and left side pixels of 4x4 > blocks. I > >> > want to extract such modes in any frame that uses intra prediction > such > >> > as > >> > I-Frames and IDR,s. Do you know how can i achive this purpose? > >> > In JM software i did the same in decoder, do you think it should be > done > >> > in > >> > FFplay as a decoder or it can be done by FFmpeg? > >> > >> AFAIK, H.264 I-frames and keyframes are the same thing. Once you have > >> an AVFrame, you can check its key_frame member. It will be non-zero > >> if it's a keyframe (I-frame). > >> > >> For full code, have a look here: > >> > >> https://github.com/mpenkov/sandpit/blob/master/ffmpeg/keyframes.c > >> > >> Provided that you're using MP4 as the container, you can confirm that > >> the keyframes extracted are indeed I-frames by using the mp4videoinfo > >> utility (http://mpeg4ip.sourceforge.net/documentation/index.php). > >> > >> > Thanks for your expert advice. > >> > Amir > >> > > > -- > > Amir H. Rouhi > > PhD Student/ CSIT RMIT University > > Room: 14-09-04 > > http://raws.adc.rmit.edu.au/~s3288736/blog2/ > > Check ffmpeg -debug options, especially pict and mv: > > -debug EDVAS print specific debug info > pict .DV.. picture info > mb_type .DV.. macroblock (MB) type > mv .DV.. motion vector > > Regards, > Alex Cohn > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Amir H. Rouhi PhD Student/ CSIT RMIT University Room: 14-09-04 http://raws.adc.rmit.edu.au/~s3288736/blog2/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From jelofsson at gmail.com Fri Jun 29 10:00:24 2012 From: jelofsson at gmail.com (Jonas Elofsson) Date: Fri, 29 Jun 2012 10:00:24 +0200 Subject: [Libav-user] Frame number In-Reply-To: References: Message-ID: Hi, Thanks. I guess this means "pts"? I have no time to check again at the moment, but I did some tests with this as well. The video I tested with reported 25 frames per second and the timebase 1/25. Shouldn't this give me the pts 1,2,3,4... etc for each frame? Instead i got (if my memory serves me right) 1200, 2400 etc (step of 1200 for each frame). Is there some documentation describing the FFMpeg timebase system? Best regards, Jonas On Thu, Jun 28, 2012 at 10:46 AM, Hector Alonso wrote: > Hi, you have to use the decoding or presentation timestamp and calculate > it from the frame rate (time base of the stream). > > On Thu, Jun 28, 2012 at 10:09 AM, Jonas Elofsson wrote: > >> Hi, >> >> Resending this, it seems my first post never got through... >> >> I'm taking the first, trembling steps to use FFMpeg in Qt, primary for a >> video editing SW. So far it is working good, I can decode frames to a >> QImage in Qt and display them on a label. Even video playback works good on >> a QLabel up to 200 frames/s or so. >> >> But, what I cannot find is a way to see what frame (displayed >> framenumber) I just decoded. Coded framenumber I can see, but they are (of >> course) not useable directly, and also are not available for all formats. >> Displayed framenumber is not working, either always 0, 0x80000000... or >> other none-telling values. >> >> What I need is a good, solid way to always be able to identify the >> current frame number. >> >> If you have a solution or just an idea, please let me know! >> >> Best regards, Jonas >> >> >> >> _______________________________________________ >> 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 kalileo at universalx.net Fri Jun 29 12:11:47 2012 From: kalileo at universalx.net (Kalileo) Date: Fri, 29 Jun 2012 17:11:47 +0700 Subject: [Libav-user] Frame number In-Reply-To: References: Message-ID: <5B9B0242-39FB-4DF2-A6D9-A838C25311F5@universalx.net> On Jun 29, 2012, at 15:00 , Jonas Elofsson wrote: > Hi, > > Thanks. I guess this means "pts"? > > I have no time to check again at the moment, but I did some tests with this as well. > > The video I tested with reported 25 frames per second and the timebase 1/25. Shouldn't this give me the pts 1,2,3,4... etc for each frame? No. > Instead i got (if my memory serves me right) 1200, 2400 etc (step of 1200 for each frame). Is there some documentation describing the FFMpeg timebase system? Have a look at the famous Dranger player example, there is a nice explanation how its is calculated. From simondaniels23 at gmail.com Fri Jun 29 19:37:00 2012 From: simondaniels23 at gmail.com (Simon Daniels) Date: Fri, 29 Jun 2012 10:37:00 -0700 Subject: [Libav-user] Frames are not visually lining up between my code and ffmpeg.exe In-Reply-To: References: Message-ID: Hi Carl -- any luck digging into that video? Thanks! On Wed, Jun 27, 2012 at 9:03 AM, Noah Spitzer-Williams < noah at highlighthunter.com> wrote: > Input file: https://dl.dropbox.com/u/28441949/sample%20video.MP4 > > > On Tue, Jun 26, 2012 at 10:45 PM, Carl Eugen Hoyos wrote: > >> Simon Daniels writes: >> >> > I've confirmed this does seem to be a regression. >> >> > I ran the same code with the same video on ffmpeg 0.8.3 >> > and 0.11.1 and you can see the thumbnails generated are >> > not the same. #281 in 0.11.1 lines up with #221 in 0.8.3. >> >> Please provide the input file. >> >> Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > > > -- > Noah Spitzer-Williams > CEO, Highlight Hunter > voice: 607-398-0460 > web: www.highlighthunter.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 halonso at vpod.tv Fri Jun 29 14:21:53 2012 From: halonso at vpod.tv (Hector Alonso) Date: Fri, 29 Jun 2012 14:21:53 +0200 Subject: [Libav-user] Frame number In-Reply-To: <5B9B0242-39FB-4DF2-A6D9-A838C25311F5@universalx.net> References: <5B9B0242-39FB-4DF2-A6D9-A838C25311F5@universalx.net> Message-ID: Hi, I've made myself one LibAvUtils class with this two functions implemented like this: int64_t LibAvUtils::frameNumberToPts(uint uiFrameNum, float fFps) { if (fFps <= 0) return 0; return (int64_t)uiFrameNum * (int64_t)(((float)AV_TIME_BASE) / fFps); } //----------------------------------------------------------------------------- uint LibAvUtils::ptsToFrameNumber(int64_t iPts, float fFps) { if (fFps <= 0) return 0; return (uint)(iPts / (((float)AV_TIME_BASE) / fFps)); } You will have to get a good calculation of the FPS by using the time_base from each stream, as they will probably have different units. pts = Presentation Time Stamp or the moment this frame (or first sample of the chunk if it is an audio packet) must be presented. dts = Decoding Time Stamp or the moment this frame must be decoded (have a look to Key,P and B frames and you will understand it better) In some audiostreams, these parameters are not filled enterily, so you'd better use the dts. Any way, I think you should study Dranger's tutorial: http://dranger.com/ffmpeg/tutorial01.html On Fri, Jun 29, 2012 at 12:11 PM, Kalileo wrote: > > On Jun 29, 2012, at 15:00 , Jonas Elofsson wrote: > > > Hi, > > > > Thanks. I guess this means "pts"? > > > > I have no time to check again at the moment, but I did some tests with > this as well. > > > > The video I tested with reported 25 frames per second and the timebase > 1/25. Shouldn't this give me the pts 1,2,3,4... etc for each frame? > > No. > > > Instead i got (if my memory serves me right) 1200, 2400 etc (step of > 1200 for each frame). Is there some documentation describing the FFMpeg > timebase system? > > Have a look at the famous Dranger player example, there is a nice > explanation how its is calculated. > > > _______________________________________________ > 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 jgraham at cs.unc.edu Fri Jun 29 23:41:18 2012 From: jgraham at cs.unc.edu (Jeremy Graham) Date: Fri, 29 Jun 2012 17:41:18 -0400 Subject: [Libav-user] Messages from avcodec_decode_video2 and sws_scale In-Reply-To: References: Message-ID: <4FEE20FE.7030609@cs.email.edu> Hello, everyone. I am sure that I am asking very basic questions that you all have hashed over time and time again. However, try as I might, I can't seem to find a source of info out there which clearly and specifically answers my questions. Perhaps someone out out there can help me to understand the following. What do general messages about concealing errors from avcodec_decode_video2 calls mean? Should I be concerned about them? In my program, the function returns values that are greater than 0 yet it also prints out this message every time: [h264 @ 0xb0b00480] concealing 920 DC, 920 AC, 920 MV errors. What does it mean when sws_scale outputs an error message like: [swscaler @ 0xb0b505a0] bad dst image pointers? Is there something very particular about the way that it expects to receive the parameter for the destination? From notzed at gmail.com Sat Jun 30 03:12:14 2012 From: notzed at gmail.com (Michael Zucchi) Date: Sat, 30 Jun 2012 10:42:14 +0930 Subject: [Libav-user] Frame number In-Reply-To: References: <5B9B0242-39FB-4DF2-A6D9-A838C25311F5@universalx.net> Message-ID: <4FEE526E.8060501@gmail.com> I'm pretty sure you shouldn't use approximate numbers (floats or doubles) for this. There's a bunch of AVRational related and exact-precision arithmetic functions in libavutil for this purpose. see libavutil/mathematics.h libavutil/rational.h. On 29/06/12 21:51, Hector Alonso wrote: > Hi, > I've made myself one LibAvUtils class with this two functions > implemented like this: > > > int64_t LibAvUtils::frameNumberToPts(uint uiFrameNum, float fFps) > > { > > if (fFps <= 0) return 0; > > return (int64_t)uiFrameNum * (int64_t)(((float)AV_TIME_BASE) / fFps); > > } > > //----------------------------------------------------------------------------- > > uint LibAvUtils::ptsToFrameNumber(int64_t iPts, float fFps) > > { > > if (fFps <= 0) return 0; > > return (uint)(iPts / (((float)AV_TIME_BASE) / fFps)); > > } From paul_e_roberts at hotmail.com Sat Jun 30 10:32:48 2012 From: paul_e_roberts at hotmail.com (Paul Roberts) Date: Sat, 30 Jun 2012 09:32:48 +0100 Subject: [Libav-user] Video latency and GOP size Message-ID: Hi I am encoding live frames from an IP camera to H.264 but have found that it takes at least as many frames as the GOP size to be passed in before anything actually comes out of the encoder. This is a problem if the camera is streaming slowly because say I have the GOP set to 10, if the camera is sending 1 frame a second it will be 10 seconds before I get any encoded video out which is too long a delay. Is there any way to ensure that the first frame I pass to the encoder is encoded and passed out straight out? (without changing the GOP to 1) Thanks in advance, Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sat Jun 30 22:06:44 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 30 Jun 2012 20:06:44 +0000 (UTC) Subject: [Libav-user] Video latency and GOP size References: Message-ID: Paul Roberts writes: > I am encoding live frames from an IP camera to H.264 > but have found that it takes at least as many frames > as the GOP size to be passed in before anything > comes out of the encoder. Did you already read the following? http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#Encoder_latency Carl Eugen