From susiriss at gmail.com Sun Jul 1 20:11:26 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Sun, 01 Jul 2012 18:11:26 +0000 Subject: [Libav-user] Reading field by field of an interlaced video Message-ID: <4FF092CE.7060706@gmail.com> Hi All, I want to estimate the motion between two fields of an interlaced video. Currently I run a loop of av_read_frame() and avcodec_decode_video2() to read the video. But I guess that when avcodec_decode_video2() finishes reading a frame, it must have been de-interlaced the two fields of a frame to the complete frame. I have no idea how I can read field by field of the video. Please give me some pointers to start with. thanks in advance. -Sampath From cehoyos at ag.or.at Sun Jul 1 16:16:09 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 1 Jul 2012 14:16:09 +0000 (UTC) Subject: [Libav-user] Reading field by field of an interlaced video References: <4FF092CE.7060706@gmail.com> Message-ID: Sampath Subasinghe writes: > But I guess that when avcodec_decode_video2() finishes > reading a frame, it must have been de-interlaced libavcodec does no de-interlacing by default ... > the two fields of a frame to the complete frame. ... but it usually outputs the two fields of interlaced video in one frame. Imo, "interlaced" is a construct that is simply not compatible with the way videos are encoded / decoded by an application in a computer system. (Note that is was invented for analog transmissions and CRT displays.) I suspect your movie player would be quite unhappy if libavcodec would present it with a field on encoding... Afaict (and I will happily stand corrected if I am wrong), codecs (especially MPEG-codecs) will always output frames, fields only exist to optimize encoding if the input is interlaced, fields are often abused when encoding progressive material but imo that only proves my point above. Don't forget that typical DVB streams in PAL-land send movies and soaps field-encoded although the original material was never interlaced. And you can of course take interlaced (live) material and encode it as progressive. Carl Eugen From mark.kenna at sureviewsystems.com Sun Jul 1 16:22:22 2012 From: mark.kenna at sureviewsystems.com (Mark Kenna) Date: Sun, 1 Jul 2012 15:22:22 +0100 Subject: [Libav-user] Video latency and GOP size In-Reply-To: References: Message-ID: <8280811831677000571@unknownmsgid> On 30 Jun 2012, at 21:07, Carl Eugen Hoyos wrote: > 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 > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user I am also experiencing the same issue. The link you posted does not work for me though. Do you have another? Thanks, Mark. From alexcohn at netvision.net.il Sun Jul 1 18:36:01 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Sun, 1 Jul 2012 19:36:01 +0300 Subject: [Libav-user] Video latency and GOP size In-Reply-To: <8280811831677000571@unknownmsgid> References: <8280811831677000571@unknownmsgid> Message-ID: On Sun, Jul 1, 2012 at 5:22 PM, Mark Kenna wrote: > On 30 Jun 2012, at 21:07, Carl Eugen Hoyos wrote: > >> 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 >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user > > I am also experiencing the same issue. The link you posted does not > work for me though. Do you have another? > > Thanks, > Mark. Try the google cache: http://webcache.googleusercontent.com/search?q=cache:ifKd5cOZMQwJ:mewiki.project357.com/wiki/X264_Encoding_Suggestions&strip=1 From susiriss at gmail.com Sun Jul 1 20:08:49 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Sun, 01 Jul 2012 23:38:49 +0530 Subject: [Libav-user] Reading field by field of an interlaced video In-Reply-To: References: <4FF092CE.7060706@gmail.com> Message-ID: <4FF09231.80005@gmail.com> > libavcodec does no de-interlacing by default ... > > ... but it usually outputs the two fields of interlaced > video in one frame. > Thanks Carl for the valuable input. So I see that libavcodec does field combination to make up the full frame. In this case, I can separate the two fields by going through the frame and grouping odd lines (each line is 1-pixel thick ?) and even lines separately. Is this assumption correct ? thanks. From cehoyos at ag.or.at Sun Jul 1 20:22:02 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 1 Jul 2012 18:22:02 +0000 (UTC) Subject: [Libav-user] Video latency and GOP size References: <8280811831677000571@unknownmsgid> Message-ID: Mark Kenna writes: > > Did you already read the following? > > http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#Encoder_latency > I am also experiencing the same issue. The link you posted does not > work for me though. Do you have another? Sorry, I used Google cache when suggesting the site, but I expected the site to be up again later which seems is not the case;-( Please consider trimming your quotes, Carl Eugen From cehoyos at ag.or.at Sun Jul 1 20:23:44 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 1 Jul 2012 18:23:44 +0000 (UTC) Subject: [Libav-user] Reading field by field of an interlaced video References: <4FF092CE.7060706@gmail.com> <4FF09231.80005@gmail.com> Message-ID: Sampath Subasinghe writes: > > libavcodec does no de-interlacing by default ... > > > > ... but it usually outputs the two fields of interlaced > > video in one frame. > > > Thanks Carl for the valuable input. So I see that libavcodec does field > combination to make up the full frame. As said, I suspect every conforming decoder (you did not say which encoding you used, but I guess that is not only true for h264) has to do this. > In this case, I can separate the two fields by going through the frame > and grouping odd lines (each line is 1-pixel thick ?) and even lines > separately. Is this assumption correct ? This should give you rawvideo fields which may be what you want. Carl Eugen From mark.kenna at sureviewsystems.com Sun Jul 1 20:27:57 2012 From: mark.kenna at sureviewsystems.com (Mark Kenna) Date: Sun, 01 Jul 2012 19:27:57 +0100 Subject: [Libav-user] Video latency and GOP size In-Reply-To: References: <8280811831677000571@unknownmsgid> Message-ID: <4FF096AD.9090203@sureviewsystems.com> Hi Carl > Sorry, I used Google cache when suggesting the site, but I expected > the site to be up again later which seems is not the case;-( using "rc_lookahead = 0" solved the issue. > Please consider trimming your quotes, Carl Eugen Will do in future Thanks for your help, Mark. From summerlismile at gmail.com Mon Jul 2 02:19:30 2012 From: summerlismile at gmail.com (Xia Li) Date: Sun, 1 Jul 2012 17:19:30 -0700 Subject: [Libav-user] Convert .264 to .ts using ffmpeg library Message-ID: Hi, I'm currently working on converting h.264 elementary stream (file with postfiix .264) to transport stream (file with postfix .ts). I have finished the conversion successfully using ffmpeg command line "*ffmpeg -i in.264 -an -vcodec copy -f mpegts out.ts*". Now I want to implement this conversion using my own C++ code, by calling ffmpeg's libraries. I have downloaded precompiled ffmpeg libraries (libavcodec, libavformat etc). My input h.264 is prerecorded file, not live stream, and so as my output .ts file. So my question is which functions in the library should I call to implement the conversion? I'm still new for ffmpeg, so please forgive me about the naive questions. Thanks very much. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amir.rouhi at rmit.edu.au Mon Jul 2 07:31:24 2012 From: amir.rouhi at rmit.edu.au (Rouhi Amirhossein2) Date: Mon, 2 Jul 2012 15:31:24 +1000 Subject: [Libav-user] Slow conversion to raw 264 Message-ID: Hi I want to convert a data set , consisting of 10,000 short videos (average 3 mins) in format of .mpg to raw 264 video stream. Every video takes a long time to complete the process (about 1 min on a Core 2 Duo 3.16Ghz CPU). The CPU usage will reach to 100% during the conversion process.The command used is: ffmpeg -i C:\q.mpg -an -vcodec libx264 -threads 0 -f h264 C:\q.264 Do you have any idea to boost up the process speed? Regards Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From halonso at vpod.tv Mon Jul 2 08:03:36 2012 From: halonso at vpod.tv (Hector Alonso) Date: Mon, 2 Jul 2012 08:03:36 +0200 Subject: [Libav-user] Reading field by field of an interlaced video In-Reply-To: References: <4FF092CE.7060706@gmail.com> <4FF09231.80005@gmail.com> Message-ID: Interlaced frames are decoded by libav into the same way a capture card would do. I supose, you're not using CRTs anymore, so you can use "avpicture_deinterlace" (from avcodec) as first approach, the YADIF filter (wich is included into ffmpeg libraries) or a shader into the GPU (I think this should be the best option) to do the transformation. Be aware that avpicture_deinterlace doesn't work with every pixel format! I use PIX_FMT_YUV422P for using this function. On Sun, Jul 1, 2012 at 8:23 PM, Carl Eugen Hoyos wrote: > Sampath Subasinghe writes: > > > > libavcodec does no de-interlacing by default ... > > > > > > ... but it usually outputs the two fields of interlaced > > > video in one frame. > > > > > Thanks Carl for the valuable input. So I see that libavcodec does field > > combination to make up the full frame. > > As said, I suspect every conforming decoder (you did not say > which encoding you used, but I guess that is not only true for > h264) has to do this. > > > In this case, I can separate the two fields by going through the frame > > and grouping odd lines (each line is 1-pixel thick ?) and even lines > > separately. Is this assumption correct ? > > This should give you rawvideo fields which may be what you want. > > 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 paul_e_roberts at hotmail.com Mon Jul 2 19:22:46 2012 From: paul_e_roberts at hotmail.com (Paul Roberts) Date: Mon, 2 Jul 2012 18:22:46 +0100 Subject: [Libav-user] Video latency and GOP size In-Reply-To: References: Message-ID: That page helped brilliantly, thank you very much Carl Eugen. Paul From igorols at gmail.com Mon Jul 2 22:53:03 2012 From: igorols at gmail.com (Igor Oliveira) Date: Mon, 2 Jul 2012 13:53:03 -0700 (PDT) Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: Message-ID: <1341262383590-4655359.post@n4.nabble.com> Hi, I'm having the same problem. I downloaded this project: https://github.com/havlenapetr/FFMpeg I've made some changes and I don't need the jniaudio and jnivideo libs. I just need to call the "main" method from class ffmpeg.c and I made some changes to the file com_media_ffmpeg_FFMpeg.c to look like ffmpeg.c. I can only make one call to the method "native_av_parse_options". If call another time the aplication crashes and logcat prints "Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)". After a short time the aplication is restarted automatically. Rui Lu?s, I would like to know how do you solve this problem. Thanks in advance. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-FFMPEG-JNI-ANDROID-tp4655206p4655359.html Sent from the libav-users mailing list archive at Nabble.com. From amir.rouhi at rmit.edu.au Tue Jul 3 03:54:04 2012 From: amir.rouhi at rmit.edu.au (Rouhi Amirhossein2) Date: Tue, 3 Jul 2012 11:54:04 +1000 Subject: [Libav-user] Using FFMPEG source codes in windows Message-ID: Hi I want to use some functions of FFMPEG which are used for Intra-Predictions in my c program under windows platform. when i open the folder of the software, i will encounter many headers and .c files in different folders. Firstly i dont know that which folders contains my desired .c files and headers. Is there any instruction for using the programs? Do you know which folder (Libavecodec,LibavDevice,LibavFilter,....) is related to the programs of intra predictions? Second thing which i need your help is that the files are designed for using under linux, if i want to use them in windows, we usually need to combine them in form of a project file. They are not in form of a project and i dont know how can i combine them together and recompile them in code::blocks in windows. Have you encountered in such problem and do you have any idea? Regards -- Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From jelofsson at gmail.com Tue Jul 3 11:53:54 2012 From: jelofsson at gmail.com (Jonas Elofsson) Date: Tue, 3 Jul 2012 11:53:54 +0200 Subject: [Libav-user] Frame number In-Reply-To: <4FEE526E.8060501@gmail.com> References: <5B9B0242-39FB-4DF2-A6D9-A838C25311F5@universalx.net> <4FEE526E.8060501@gmail.com> Message-ID: Hi, This is most helpful, thanks a lot! I whish I had more time for this project... Best regards, Jonas On Sat, Jun 30, 2012 at 3:12 AM, Michael Zucchi wrote: > > 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)); >> >> } >> > ______________________________**_________________ > 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 rui.luis at gmail.com Tue Jul 3 12:07:50 2012 From: rui.luis at gmail.com (=?ISO-8859-1?Q?Rui_Lu=EDs?=) Date: Tue, 3 Jul 2012 11:07:50 +0100 Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: <1341262383590-4655359.post@n4.nabble.com> References: <1341262383590-4655359.post@n4.nabble.com> Message-ID: Hi. in my case, and probably in yours is that when the "application" exits is not cleaning all the allocated memory during the running process. so, when you make a second call there is not enough space and the application gives a memory error. Check in your code to see when the application exits for the first time if it does all of the av_free and free .. for each malloc you do .. there must be one free.. its very annoying to pin point it because there is no debug process for jni and android.. printf and pencil is the option.. ------ 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, Jul 2, 2012 at 9:53 PM, Igor Oliveira wrote: > Hi, I'm having the same problem. I downloaded this project: > https://github.com/havlenapetr/FFMpeg > > I've made some changes and I don't need the jniaudio and jnivideo libs. > > I just need to call the "main" method from class ffmpeg.c and I made some > changes to the file com_media_ffmpeg_FFMpeg.c to look like ffmpeg.c. > > I can only make one call to the method "native_av_parse_options". If call > another time the aplication crashes and logcat prints "Fatal signal 11 > (SIGSEGV) at 0xdeadbaad (code=1)". After a short time the aplication is > restarted automatically. > > Rui Lu?s, I would like to know how do you solve this problem. > > Thanks in advance. > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/Libav-user-FFMPEG-JNI-ANDROID-tp4655206p4655359.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 dan.from at gmail.com Tue Jul 3 21:49:28 2012 From: dan.from at gmail.com (Dan From) Date: Tue, 3 Jul 2012 21:49:28 +0200 Subject: [Libav-user] The use of FFmpeg on a web server in the background Message-ID: Hey. I am having an idea for a webpage, that would use the FFmpeg library in the background, and therefore not directly let the user use it. Without given to much details, the final product would be something ala Youtube, where the user also cant see whats going on behind the scenes. Would i be able to use the LGPL version for that, without given the source code for the whole project? If yes, what should i do if the project get aired. Can i just include part nine of "License Compliance Checklist" on this page http://ffmpeg.org/legal.html in the footer on every page? Or is there something more i should do? / Dan From -------------- next part -------------- An HTML attachment was scrubbed... URL: From flaviocapaccio at gmail.com Tue Jul 3 10:13:25 2012 From: flaviocapaccio at gmail.com (flaviocapaccio) Date: Tue, 3 Jul 2012 01:13:25 -0700 (PDT) Subject: [Libav-user] Stream 3GP format over HTTP In-Reply-To: References: <20100702085619200.00000003972@marvin> <4C2DE24B.60507@gmail.com> Message-ID: <1341303205563-4655361.post@n4.nabble.com> Hi I'm following this topic and I'm having the same problems. Are there any news? I'm trying to hinting file using MP4Box or mp4creator but I think I should find an option to hint the file for http. Thanks for help. Regards. Flavio Capaccio. -- View this message in context: http://libav-users.943685.n4.nabble.com/Stream-3GP-format-over-HTTP-tp2276019p4655361.html Sent from the libav-users mailing list archive at Nabble.com. From y11022053 at gmail.com Wed Jul 4 09:41:51 2012 From: y11022053 at gmail.com (=?GB2312?B?1LDUrA==?=) Date: Wed, 4 Jul 2012 15:41:51 +0800 Subject: [Libav-user] how to use libs of ffmpeg to demux mpegts stream from a buffer??? Message-ID: how to use libs of ffmpeg to demux mpegts stream from a buffer ??? forgive my poor expression. I already have a series of DVB-APIs that could get a ts packet once we call it. how can I use libs of ffmepg to resolve this problem thank u all of u. -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco at bltitalia.com Wed Jul 4 16:56:20 2012 From: francesco at bltitalia.com (francesco at bltitalia.com) Date: Wed, 4 Jul 2012 16:56:20 +0200 (added by postmaster@virgilio.it) Subject: [Libav-user] MPEG2 picture header question Message-ID: <4FE0AD0601C6B4B6@vsmtp14.tin.it> (added by postmaster@virgilio.it) Hi to all I am compressing in MPEG2 4:2:2 format long GOP (gop_size=11) and closed GOP. I noted that each time that avcodec_encode_video returns a value different from zero (always 250000 when bit_rate is 50000000) in the data there are more than one picture header (identified by mark "00 00 01 00"), and not always the data starts with a picture header (excluding I frame obviously). The question is : there is a way to have a single picture header for each data block, and this picture header aligned ? That is the data should start with the picture header (00 00 01 00) ? From naresh at vizexperts.com Thu Jul 5 01:08:56 2012 From: naresh at vizexperts.com (Naresh Sankapelly) Date: Thu, 5 Jul 2012 04:38:56 +0530 Subject: [Libav-user] RTSP Client Message-ID: <000001cd5a39$fda35d30$f8ea1790$@com> Hi Everyone, I've an IP Camera which gives RTSP stream on rtsp://192.168.1.90/MediaInput/Mpeg4. I want to archive the video and audio of this stream using libavcodec. I've the following code sample. This code creates a video file. But, time_base.den/time_base.num value(which is frame rate?) comes out to be 30000. I tried to set the value of time_base.num to 1000 to get frame rate as 30. I get one hour duration video for 100 frames. int main(int argc, char** argv) { AVFormatContext* context = avformat_alloc_context(); int video_stream_index; int audio_stream_index; av_register_all(); avcodec_register_all(); avformat_network_init(); //open rtsp avformat_open_input(&context, "rtsp://192.168.1.90/MediaInput/Mpeg4",NULL,NULL); avformat_find_stream_info(context,NULL); //search video stream for(int i =0;inb_streams;i++) { if(context->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { video_stream_index = i; } else if(context->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { audio_stream_index = i; } } AVPacket packet; av_init_packet(&packet); //open output file AVOutputFormat* fmt = av_guess_format(NULL,"test2.avi",NULL); AVFormatContext* oc = avformat_alloc_context(); oc->oformat = fmt; avio_open2(&oc->pb, "test.avi", AVIO_FLAG_WRITE,NULL,NULL); AVStream* stream=NULL; int cnt = 0; AVCodec *videoCodec; AVCodecContext *videoCodecCtx; // Get a pointer to the codec context for the video stream videoCodecCtx=context->streams[video_stream_index]->codec; // Find the decoder for the video stream videoCodec=avcodec_find_decoder(videoCodecCtx->codec_id); // Open codec avcodec_open(videoCodecCtx, videoCodec); if(videoCodec->capabilities & CODEC_CAP_TRUNCATED) videoCodecCtx->flags |= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */ if ((videoCodecCtx->time_base.den / videoCodecCtx->time_base.num) > 1000 && videoCodecCtx->time_base.num == 1) { videoCodecCtx->time_base.num = 1000; } av_read_play(context);//play RTSP while(av_read_frame(context,&packet)>=0 && cnt <100){//read 100 frames if(packet.stream_index == video_stream_index){//packet is video if(stream == NULL){//create stream in file stream = avformat_new_stream(oc,context->streams[video_stream_index]->codec->codec); avcodec_copy_context(stream->codec,context->streams[video_stream_index]->cod ec); stream->sample_aspect_ratio = context->streams[video_stream_index]->codec->sample_aspect_ratio; avformat_write_header(oc,NULL); } packet.stream_index = stream->id; av_write_frame(oc,&packet); cnt++; } else if(packet.stream_index == audio_stream_index)//packet is audio { //std::cout<<"Audio packet"<pb); avformat_free_context(oc); return (EXIT_SUCCESS); } Thanks Naresh Ph. 8884199804 -------------- next part -------------- An HTML attachment was scrubbed... URL: From drabner at zoobe.com Thu Jul 5 14:28:43 2012 From: drabner at zoobe.com (Drabner) Date: Thu, 5 Jul 2012 05:28:43 -0700 (PDT) Subject: [Libav-user] Wrong frame order/frame hickup in output video Message-ID: <1341491323110-4655370.post@n4.nabble.com> It seems like the first post didn't work, so I post on the mailing list again, sry if that causes spam! Hey, I am encoding frames from a 3D engine to an mp4 video with sound. Usually, the video (and input image) size is 640x360. With that size, there is no problem. But when I want to encode a 320x180 video (from input of 320x180), the resulting videos are sometimes(!!) stuttering, jumping back and forth in their frame order. For encoding, I followed this tutorial, so the vital parts for encoding in my functions look like that: http://dranger.com/ffmpeg/tutorial01.html As I said, this only happens in the small video size, never in the big one. I also made sure that the frames from the engine always come in in the correct order and are always encoded in the correct order. The ffmpeg encoding takes place in its own thread, but that shouldn't matter (as it works with bigger video). If I insert a Sleep(10) before encoding each frame, the problem does not appear any more (or very, very rare). Any ideas what could cause this? -- View this message in context: http://libav-users.943685.n4.nabble.com/Wrong-frame-order-frame-hickup-in-output-video-tp4655370.html Sent from the libav-users mailing list archive at Nabble.com. From drabner at zoobe.com Thu Jul 5 13:56:10 2012 From: drabner at zoobe.com (Drabner) Date: Thu, 5 Jul 2012 04:56:10 -0700 (PDT) Subject: [Libav-user] Wrong frame order/frame hickup in output video Message-ID: <1341489370919-4655369.post@n4.nabble.com> Hey, I am encoding frames from a 3D engine to an mp4 video with sound. Usually, the video (and input image) size is 640x360. With that size, there is no problem. But when I want to encode a 320x180 video (from input of 320x180), the resulting videos are sometimes(!!) stuttering, jumping back and forth in their frame order. For encoding, I followed this tutorial, so the vital parts for encoding in my functions look like that: http://dranger.com/ffmpeg/tutorial01.html As I said, this only happens in the small video size, never in the big one. I also made sure that the frames from the engine always come in in the correct order and are always encoded in the correct order. The ffmpeg encoding takes place in its own thread, but that shouldn't matter (as it works with bigger video). If I insert a Sleep(10) before encoding each frame, the problem does not appear any more (or very, very rare). Any ideas what could cause this? -- View this message in context: http://libav-users.943685.n4.nabble.com/Wrong-frame-order-frame-hickup-in-output-video-tp4655369.html Sent from the libav-users mailing list archive at Nabble.com. From rafael.b.biz at gmail.com Thu Jul 5 15:46:13 2012 From: rafael.b.biz at gmail.com (Rafael Biz) Date: Thu, 5 Jul 2012 10:46:13 -0300 Subject: [Libav-user] variable length buffer Message-ID: Hi everyone, I was wondering if ffmpeg can really read frames from a variable-length buffer because AVIOContext seems to be designed to work just with static-length buffers. Is that true? If not, which is the set of functions that handle it? I have successfully used the ffmpeg libraries (DLLs) for decoding videos files, however, I can't do it on a network context because the buffer of AVIOContext needs to be increased and consumed continuously. As a workaround, I found out that it is possible by allocating a new AVIOContext every time that the application receives data from network, however, this solution has poor performance and causes memory fragmentation. As a solution, I would like to be able to manipulate the buffer's size and position properly, if possible. Do you have any idea or suggestion that could help me? Many thanks, Rafael Bernstorff Biz From drabner at zoobe.com Thu Jul 5 15:26:30 2012 From: drabner at zoobe.com (Drabner) Date: Thu, 5 Jul 2012 06:26:30 -0700 (PDT) Subject: [Libav-user] Wrong frame order/frame hickup in output video In-Reply-To: <1341491323110-4655370.post@n4.nabble.com> References: <1341491323110-4655370.post@n4.nabble.com> Message-ID: <1341494790543-4655371.post@n4.nabble.com> Additional info: I just tried encoding to mpg instead of mp4, and the same thing happened. -- View this message in context: http://libav-users.943685.n4.nabble.com/Wrong-frame-order-frame-hickup-in-output-video-tp4655370p4655371.html Sent from the libav-users mailing list archive at Nabble.com. From nguyenle.it at gmail.com Thu Jul 5 15:46:39 2012 From: nguyenle.it at gmail.com (clarkkent) Date: Thu, 5 Jul 2012 06:46:39 -0700 (PDT) Subject: [Libav-user] join file with ffmpeg on Android Message-ID: <1341495999768-4655373.post@n4.nabble.com> Hello every one I'm a newbie with ffmpeg, but i can port it to Android. I have a problem with join file command on android. After port the ffmpeg to Android, i use this command to join two video files become one video: /ffmpeg -i concat:"/mnt/sdcard/file1.avi|/mnt/sdcard/file2.avi" -c copy /mnt/sdcard/joinfile.avi/ But it tell that the *concat:"..." is not such a file or directory*. Could anybody help me with this? tell me how to fix this one please? Thanks Clark -- View this message in context: http://libav-users.943685.n4.nabble.com/join-file-with-ffmpeg-on-Android-tp4655373.html Sent from the libav-users mailing list archive at Nabble.com. From wagner.patriota at gmail.com Thu Jul 5 19:00:37 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Thu, 5 Jul 2012 14:00:37 -0300 Subject: [Libav-user] weard behavior of bash script for configure ffmpeg Message-ID: does anybody understand what happens here? when my script reachs the *./configure* line... it gets the error: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc is unable to create an executable file. C compiler test failed. but if I type "*echo*" before ./configure, I see this big command line here: ./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 --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 --target-os=darwin --enable-nonfree --enable-gpl --disable-armv5te --disable-swscale-alpha --disable-doc --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-asm --disable-debug If I copy/paste this big line in my shell and execute, the configure *works pretty perfect*. But why it *doesn't work on the script*? What is the difference between these 2 scenarios? #!/bin/bash parameters="--enable-cross-compile \ --target-os=darwin \ --enable-nonfree \ --enable-gpl \ --disable-armv5te \ --disable-swscale-alpha \ --disable-doc \ --disable-ffmpeg \ --disable-ffplay \ --disable-ffprobe \ --disable-ffserver \ --disable-asm \ --disable-debug" archs="armv6 armv7 i386" libs=( libavcodec libavdevice libavformat libavutil libswresample libswresample libpostproc libswscale libavfilter ) declare -a lipo for (( i = 0; i < ${#libs[@]}; i++ )); do lipo[i]="lipo -output ./compiled/fat/lib/${libs[${i}]}.a -create" done for arch in $( echo $archs ); do echo "Configuring for $arch..." if [ $arch = "i386" ]; then arch_base="i386" platform="iPhoneSimulator" cpu="i386" elif [ $arch = "armv6" ]; then arch_base="arm" platform="iPhoneOS" cpu="arm1176jzf-s" elif [ $arch = "armv7" ]; then arch_base="arm" platform="iPhoneOS" cpu="cortex-a8" fi * ./configure \* * --cc="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/usr/bin/gcc" \* * --as="'/usr/local/bin/gas-preprocessor.pl/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/usr/bin/gcc'" \* * --sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}5.1.sdk" \* * --arch="${arch_base}" \* * --cpu="${cpu}" \* * --extra-cflags="'-arch ${arch}'" \* * --extra-ldflags="'-arch ${arch} -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}5.1.sdk'" \* * --prefix="compiled/${arch}" \* * $parameters* make clean make && make install for (( i = 0; i < ${#libs[@]}; i++ )); do lipo[i]="${lipo[${i}]} -arch $arch ./compiled/$arch/lib/${libs[${i}]}.a" done done for (( i = 0; i < ${#libs[@]}; i++ )); do echo `${lipo[i]}` done -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbradshaw at sorensonmedia.com Thu Jul 5 19:38:25 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 5 Jul 2012 11:38:25 -0600 Subject: [Libav-user] weard behavior of bash script for configure ffmpeg In-Reply-To: References: Message-ID: On Thu, Jul 5, 2012 at 11:00 AM, Wagner Patriota wrote: > does anybody understand what happens here? > when my script reachs the ./configure line... it gets the error: > /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc > is unable to create an executable file. > C compiler test failed. What's in config.log? It should contain some details. From drabner at zoobe.com Thu Jul 5 13:41:36 2012 From: drabner at zoobe.com (Drabner) Date: Thu, 5 Jul 2012 04:41:36 -0700 (PDT) Subject: [Libav-user] Wrong frame order in output video Message-ID: <1341488496889-4655368.post@n4.nabble.com> Hey, I am encoding frames from a 3D engine to an mp4 video with sound. Usually, the video (and input image) size is 640x360. With that size, there is no problem. But when I want to encode a 320x180 video (from input of 320x180), the resulting videos are sometimes(!!) stuttering, jumping back and forth in their frame order. For encoding, I followed this tutorial, so the vital parts for encoding in my functions look like that: http://dranger.com/ffmpeg/tutorial01.html As I said, this only happens in the small video size, never in the big one. I also made sure that the frames from the engine always come in in the correct order and are always encoded in the correct order. The ffmpeg encoding takes place in its own thread, but that shouldn't matter (as it works with bigger video). If I insert a Sleep(10) before encoding each frame, the problem does not appear any more (or very, very rare). Any ideas what could cause this? -- View this message in context: http://libav-users.943685.n4.nabble.com/Wrong-frame-order-in-output-video-tp4655368.html Sent from the libav-users mailing list archive at Nabble.com. From lichih at daiseki.com.tw Thu Jul 5 06:27:39 2012 From: lichih at daiseki.com.tw (=?UTF-8?B?5ZCz56uL5b+X?=) Date: Thu, 5 Jul 2012 12:27:39 +0800 Subject: [Libav-user] ffmpeg static library linking issue Message-ID: > Hi All, > I compiled the ffmpeg source to generate the static(.a foramt) libraries in linux. > When i am linking the static libraries with my application, > i am getting undefined reference for many functions. > Even i tried with pkg-config. > Here command , what i tried I have encountered the same problem, I solved this problem but I don't know why it works. old test.c: #include #include int main() { av_register_all(); return 0; } new test.c: #include #include int main() { avcodec_register_all(); av_register_all(); return 0; } From y11022053 at gmail.com Fri Jul 6 08:56:53 2012 From: y11022053 at gmail.com (=?GB2312?B?1LDUrA==?=) Date: Fri, 6 Jul 2012 14:56:53 +0800 Subject: [Libav-user] ffmpeg static library linking issue In-Reply-To: References: Message-ID: I encounterd this problem too, but I fix with below command. "gcc xxx.c -o xxx -lavformat -lavcodec etc..." if you get "undefined reference" error, you should use "grep" to find which xx.a file contains the implement of that function, then plus the command "-lxxx.a" in gcc. hope this help u. 2012/7/5 ?????? > > Hi All, > > I compiled the ffmpeg source to generate the static(.a foramt) libraries > in linux. > > When i am linking the static libraries with my application, > > i am getting undefined reference for many functions. > > Even i tried with pkg-config. > > Here command , what i tried > > I have encountered the same problem, I solved this problem but I don't > know why it works. > > old test.c: > > #include > #include > > int main() > { > av_register_all(); > return 0; > } > > > new test.c: > > #include > #include > > int main() > { > avcodec_register_all(); > av_register_all(); > return 0; > } > _______________________________________________ > 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 Sun Jul 8 08:10:55 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 8 Jul 2012 06:10:55 +0000 (UTC) Subject: [Libav-user] join file with ffmpeg on Android References: <1341495999768-4655373.post@n4.nabble.com> Message-ID: clarkkent writes: > /ffmpeg -i concat:"/mnt/sdcard/file1.avi|/mnt/sdcard/file2.avi" -c copy > /mnt/sdcard/joinfile.avi/ > > But it tell that the *concat:"..." is not such a file or directory*. Complete, uncut console output missing. Carl Eugen From krueger at lesspain.de Sun Jul 8 13:04:17 2012 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Sun, 8 Jul 2012 13:04:17 +0200 Subject: [Libav-user] sws_setColorspaceDetails parameters for colorspace conversions Message-ID: Hi, I'm trying to do a colorspace conversion using libswscale. The documentation for sws_setColorspaceDetails doesn't have all params documented: /** * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x] * @return -1 if not supported */ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation); Would it be correct for a conversion e.g. from YUV Material encoded using ITU-R 601 to YUV encoded using ITU-R 709 to set the SwsContext using ff_yuv2rgb_coeffs[SWS_CS_ITU601] for inv_table and ff_yuv2rgb_coeffs[SWS_CS_ITU709] for table? Thanks in advance, Robert P.S.: I know of the existence of the colormatrix filter but I'm looking for an LGPL solution and using swscale seems simpler for my use case From mridulsmile at gmail.com Mon Jul 9 09:22:22 2012 From: mridulsmile at gmail.com (MANISH............) Date: Mon, 9 Jul 2012 12:52:22 +0530 Subject: [Libav-user] retrieving of information about h.264 files Message-ID: i want to extract the different information like motion vector magnitudes and position, coefficient values, type of macroblock, e.t.c from the encoded file which i am streaming from from an ip based camera. can anybody help me to get theses information from the ffmpeg library modificatio while decoding. manish kumar mridulsmile at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From avsn9849625263 at hotmail.com Mon Jul 9 11:48:07 2012 From: avsn9849625263 at hotmail.com (Murthy avsn) Date: Mon, 9 Jul 2012 15:18:07 +0530 Subject: [Libav-user] missing frames while decoding Message-ID: Hi a l ,thanks for you support.I have problem with decoding frames. I am trying to save frames in a h264 stream to .PPM file.I am trying to decode a 00:00:02.08 sec video with "24fps" . Problem: problem is that I could only decode 46 frames from the video .I wounder where are those 2 frames missing.Here is the snapshot of the code while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStream) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); // Did we get a video frame? if (frameFinished) { // Save the frame to disk SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, ++framecount); } } // Free the packet that was allocated by av_read_frame av_free_packet(&packet); } Here is the complete code :http://pastebin.com/3qsGrrCU Can some one please help me in this aspect . Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.george at normalesup.org Mon Jul 9 12:14:44 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 9 Jul 2012 12:14:44 +0200 Subject: [Libav-user] missing frames while decoding In-Reply-To: References: Message-ID: <20120709101444.GA20286@phare.normalesup.org> Le duodi 22 messidor, an CCXX, Murthy avsn a ?crit?: > Hi a l ,thanks for you support.I have problem with decoding frames. I am > trying to save frames in a h264 stream to .PPM file.I am trying to decode > a 00:00:02.08 sec video with "24fps" . Problem: problem is that I could > only decode 46 frames from the video .I wounder where are those 2 frames > missing.Here is the snapshot of the code > while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStream) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); > // Did we get a video frame? if (frameFinished) { // Save the frame to disk SaveFrame(pFrameRGB, pCodecCtx->width, pCodecCtx->height, ++framecount); } } > // Free the packet that was allocated by av_read_frame av_free_packet(&packet); } That is unreadable. You should consider getting a more code-friendly mail client if you intend to post on this kind of mailing list. Regarding your problem, it seems you are not flushing the decoder. After the input is finished, you have to feed empty packets to the decoder so that it returns the frames that were delayed by previous B-frames. 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 avsn9849625263 at hotmail.com Mon Jul 9 12:33:37 2012 From: avsn9849625263 at hotmail.com (Murthy avsn) Date: Mon, 9 Jul 2012 16:03:37 +0530 Subject: [Libav-user] missing frames while decoding In-Reply-To: <20120709101444.GA20286@phare.normalesup.org> References: , <20120709101444.GA20286@phare.normalesup.org> Message-ID: Date: Mon, 9 Jul 2012 12:14:44 +0200 From: nicolas.george at normalesup.org To: libav-user at ffmpeg.org Subject: Re: [Libav-user] missing frames while decoding Le duodi 22 messidor, an CCXX, Murthy avsn a ?crit : > Hi a l ,thanks for you support.I have problem with decoding frames. I am > trying to save frames in a h264 stream to .PPM file.I am trying to decode \eoStream) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); > That is unreadable. You should consider getting a more code-friendly mail>client if you intend to post on this kind of mailing list. >Regarding your problem, it seems you are not flushing the decoder. After the >input is finished, you have to feed empty packets to the decoder so that it >returns the frames that were delayed by previous B-frames. Sorry for not being clear in my previous mail.Here is the code.http://pastebin.com/3qsGrrCUCan you please link me to any example regarding flushing the decoder.Thank you for your support. -------------- next part -------------- An HTML attachment was scrubbed... URL: From igorols at gmail.com Mon Jul 9 14:21:07 2012 From: igorols at gmail.com (Igor Oliveira) Date: Mon, 9 Jul 2012 05:21:07 -0700 (PDT) Subject: [Libav-user] FFMPEG+JNI+ANDROID In-Reply-To: References: <1341262383590-4655359.post@n4.nabble.com> Message-ID: <1341836467844-4655385.post@n4.nabble.com> Thanks Rui, but I solve my problem using this approach: https://github.com/jhotovy/android-ffmpeg There is a comment about the problem of calling the API more than once and the work around works! And the project above is based on this one: https://github.com/halfninja/android-ffmpeg-x264 I made a merge of the 2 projects and I solve my problem :). My only doubt is how can I activate the x264 codec, I'm still working on it.... The 2 projects have the x264 lib, but the ffmpeg's configuration options isn't working in my case (I need to generate videos from images and audio files, and when I force the libx264 vcodec usage, the ffmpeg prints a error "Unknown codec"). -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-FFMPEG-JNI-ANDROID-tp4655206p4655385.html Sent from the libav-users mailing list archive at Nabble.com. From fabio.europe at gmail.com Mon Jul 9 16:34:56 2012 From: fabio.europe at gmail.com (Fabio Tiriticco) Date: Mon, 9 Jul 2012 16:34:56 +0200 Subject: [Libav-user] trim video C code help Message-ID: Hi all, I am asking this question as I could find no useful information in hours of searching. I would like to use ffmpeg in its C library code form to write a program that can trim a video, extract a portion, possibly mix it with other portions and re-encode the final result. I really can't find any documentation, maybe it's my fault. But any hint on this would be immensely appreciated. Cheers Fabio -- http://famsterdamlife.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From krueger at lesspain.de Mon Jul 9 17:02:01 2012 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Mon, 9 Jul 2012 17:02:01 +0200 Subject: [Libav-user] trim video C code help In-Reply-To: References: Message-ID: Hi, On Mon, Jul 9, 2012 at 4:34 PM, Fabio Tiriticco wrote: > Hi all, > > I am asking this question as I could find no useful information in hours of > searching. I would like to use ffmpeg in its C library code form to write a > program that can trim a video, extract a portion, possibly mix it with other > portions and re-encode the final result. > > I really can't find any documentation, maybe it's my fault. But any hint on > this would be immensely appreciated. > > Cheers > Fabio > look at the examples in the ffmpeg/doc/examples directory to get started. Other than that, reading API docs (which are by far not complete but improving continously) and looking at code examples (e.g. in existing filters, look for all the "vf_.c" files or in some cases ffmpeg.c and ffplay.c themselves) is your best bet. Depending on how much experience you have in this area, this will require quite sometime and endurance on your part but it's doable. Hope this helps a bit. Cheers, Robert. From nono.samson at gmail.com Mon Jul 9 17:15:23 2012 From: nono.samson at gmail.com (arnaud samson) Date: Mon, 9 Jul 2012 17:15:23 +0200 Subject: [Libav-user] question about SDL_ffmpeg Message-ID: Hi I'm trying to make a program for split a video frame by frame for apply an image traitment on each frame. I found a library based on ffmpeg (SDL_ffmpeg) but this library use a lot of deprecated stuff of ffmpeg. You know a library that do the same as SDL_ffmpeg based on ffmpeg ? Or you now a simple methode to split a video frame by frame using ffmpeg? Thanks for help ****************************************** * SAMSON Arnaud * Etudiant ? l'ISEN-Toulon * DSI ? junior isen-toulon * nono.samson at gmail.com * Twitter : @_Naviss ******************************************* -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jul 9 17:28:08 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 9 Jul 2012 15:28:08 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?question_about_SDL=5Fffmpeg?= References: Message-ID: arnaud samson writes: > Or you now a simple methode to split a video > frame by frame using ffmpeg? $ ffmpeg -i input -vcodec copy -f image2 out%5d $ ffmpeg -i input out%5d.png But maybe I misunderstand your question? Carl Eugen From nono.samson at gmail.com Mon Jul 9 17:32:18 2012 From: nono.samson at gmail.com (arnaud samson) Date: Mon, 9 Jul 2012 17:32:18 +0200 Subject: [Libav-user] question about SDL_ffmpeg In-Reply-To: References: Message-ID: I'm sorry i think i'm not very cleare but i have to use C API of ffmpeg ****************************************** * SAMSON Arnaud * Etudiant ? l'ISEN-Toulon * DSI ? junior isen-toulon * nono.samson at gmail.com * Twitter : @_Naviss * Skype : naviss2 ******************************************* 2012/7/9 Carl Eugen Hoyos > arnaud samson writes: > > > Or you now a simple methode to split a video > > frame by frame using ffmpeg? > > $ ffmpeg -i input -vcodec copy -f image2 out%5d > $ ffmpeg -i input out%5d.png > > But maybe I misunderstand your question? > > 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 prunkdump at gmail.com Mon Jul 9 17:48:50 2012 From: prunkdump at gmail.com (Prunk Dump) Date: Mon, 9 Jul 2012 17:48:50 +0200 Subject: [Libav-user] WAAVE library announcement ! In-Reply-To: References: Message-ID: Hello ! I have writed an audio/video library based on FFmpeg and SDL. Perhaps it will be usefull for some developers. If you are interested visit http://waave.sourceforge.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From onlineweinies at bluewin.ch Tue Jul 10 16:22:05 2012 From: onlineweinies at bluewin.ch (Beni Weine) Date: Tue, 10 Jul 2012 14:22:05 +0000 (GMT) Subject: [Libav-user] mov demuxer: avformat_seek_file with AVSEEK_FLAG_BYTE Message-ID: <8458400.75301341930125631.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 nono.samson at gmail.com Tue Jul 10 16:49:22 2012 From: nono.samson at gmail.com (arnaud samson) Date: Tue, 10 Jul 2012 16:49:22 +0200 Subject: [Libav-user] replace hold AVCodecContext::hurry_up Message-ID: hi I'm trying to port an old library based on an old version of ffmpeg and i dont know what i have to put instead of : AVCodecContext::hurry_up = 0 and AVCodecContext::hurry_up = 1 Can you help me ? ****************************************** * SAMSON Arnaud * Etudiant ? l'ISEN-Toulon * DSI ? junior isen-toulon * nono.samson at gmail.com * Twitter : @_Naviss * Skype : naviss2 ******************************************* From david.codesido at gmail.com Wed Jul 11 21:14:34 2012 From: david.codesido at gmail.com (cognos) Date: Wed, 11 Jul 2012 12:14:34 -0700 (PDT) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) Message-ID: <1342034074931-4655394.post@n4.nabble.com> Hi there, I'm trying to get the PAT/PMT from a mpegts. I need both the binary and the information contained inside these sections. Looking through the API and the codeI found nothing public about getting this info but some private classes that seem to work with this information (mpegts.c). Also I found some previous posts talking about the possibility of using pat_cb and pmt_cb for doing ad hoc stuff that is exactly what I need (http://lists.libav.org/pipermail/libav-user/2008-September/001249.html). The point is, these functions are private (theire not even in the mpegts.h), so: Is there any way for me to use these functions? I mean, even if I include the whole libav directory where I dowloaded and compiled the library I won't get access to these functions. If there isn't any, what could I do? Maybe you can think on another way for getting this info that I'm not seeing. Thanks in advance for your precious time. -- View this message in context: http://libav-users.943685.n4.nabble.com/Public-way-of-accessing-PAT-PMT-for-a-mpegts-both-binary-and-the-contents-tp4655394.html Sent from the libav-users mailing list archive at Nabble.com. From noahzarc at hotmail.co.uk Wed Jul 11 20:22:16 2012 From: noahzarc at hotmail.co.uk (Noah Arc) Date: Wed, 11 Jul 2012 14:22:16 -0400 Subject: [Libav-user] Using LibX264 with ffmpeg libraries Message-ID: Hi all; I've just switched to the newer ffmpeg versions (I always used ffmpeg 0.6), it is a big jump for me and I'm trying to figure out how to implement some of the changes. In the past, libx264 variables such as crf was a part of AVCodecContext. However, looks like in version 0.11 it has been deprecated and was moved to libx264.c as a private variable. But for my project, I'm used to just assign a value to crf (of a ptr of type AVCodecContext). Could someone please give me a hint on how I could implement the API changes? Thank you very much!Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: From x.morion.x at gmail.com Thu Jul 12 02:36:25 2012 From: x.morion.x at gmail.com (Aleksey Shubin) Date: Thu, 12 Jul 2012 11:36:25 +1100 Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: References: Message-ID: Hi Noah, char *crfString = new char[50]; sprintf_s(crfString, 50, "%f", crf); av_opt_set(codecContext->priv_data, "crf", crfString, 0); Don't sure if it is the best way (to convert to string first) but I didn't find a variant of av_opt_set for floating point values, and at least it works. 2012/7/12 Noah Arc : > Hi all; > > I've just switched to the newer ffmpeg versions (I always used ffmpeg > 0.6), > it is a big jump for me and I'm trying to figure out how to implement some > of the changes. > > In the past, libx264 variables such as crf was a part of AVCodecContext. > However, looks like in version 0.11 it has been deprecated and was moved > to > libx264.c as a private variable. But for my project, I'm used to just > assign > a value to crf (of a ptr of type AVCodecContext). Could someone please > give > me a hint on how I could implement the API changes? > > Thank you very much! > Cheers > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Thu Jul 12 10:37:30 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 12 Jul 2012 08:37:30 +0000 (UTC) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) References: <1342034074931-4655394.post@n4.nabble.com> Message-ID: cognos writes: > The point is, these functions are private (theire not > even in the mpegts.h), so: Is there any way for me to > use these functions? If you could explain why you believe accessing these functions makes sense, they could maybe be made public. Consider sending a patch that includes the explanation. Carl Eugen From david.codesido at gmail.com Thu Jul 12 10:53:32 2012 From: david.codesido at gmail.com (cognos) Date: Thu, 12 Jul 2012 01:53:32 -0700 (PDT) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) In-Reply-To: References: <1342034074931-4655394.post@n4.nabble.com> Message-ID: The idea is to access information related to the language for each stream, subtitling and laguages, CAS. And be able to print al the related information. I'm looking right now to avprobe that seems to print all these information but, if you have a cryptographic chipset it may require to provide the binary for the PAT/PMT in order to configure itself. Thats the main idea behind what I'm trying to do and that's why I'm asking if maybe there is another way that I'm not able to find. 2012/7/12 Carl Eugen Hoyos [via libav-users] : > cognos writes: > >> The point is, these functions are private (theire not >> even in the mpegts.h), so: Is there any way for me to >> use these functions? > > If you could explain why you believe accessing these > functions makes sense, they could maybe be made public. > Consider sending a patch that includes the explanation. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > [hidden email] > http://ffmpeg.org/mailman/listinfo/libav-user > > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > http://libav-users.943685.n4.nabble.com/Public-way-of-accessing-PAT-PMT-for-a-mpegts-both-binary-and-the-contents-tp4655394p4655397.html > To unsubscribe from Public way of accessing PAT/PMT for a mpegts (both > binary and the contents), click here. > NAML -- Nosce Te Ipsum -- View this message in context: http://libav-users.943685.n4.nabble.com/Public-way-of-accessing-PAT-PMT-for-a-mpegts-both-binary-and-the-contents-tp4655394p4655398.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Jul 12 13:13:02 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 12 Jul 2012 11:13:02 +0000 (UTC) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) References: <1342034074931-4655394.post@n4.nabble.com> Message-ID: cognos writes: > The idea is to access information related to the language for each > stream, subtitling and laguages They are all provided through the API (ffprobe would not be able to display them if not), metadata iirc. > I'm looking right now to avprobe Please understand that avprobe and friends contain several hundred regressions, some of them security relevant, we therefore cannot support them here, please look at http://ffmpeg.org/download.html for supported versions, current git head is always recommended. > if you have a cryptographic chipset it may require to provide > the binary for the PAT/PMT in order to configure itself. You should probably try to prepare a patch (against current git head, see above) and post it to ffmpeg-devel (or describe in more detail what is needed, perhaps PAT/PMT should be exported as metadata). Please do not top-post here, Carl Eugen From david.codesido at gmail.com Thu Jul 12 13:34:47 2012 From: david.codesido at gmail.com (cognos) Date: Thu, 12 Jul 2012 04:34:47 -0700 (PDT) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) In-Reply-To: References: <1342034074931-4655394.post@n4.nabble.com> Message-ID: > > Please understand that avprobe and friends contain several hundred > regressions, some of them security relevant, we therefore cannot > support them here, please look at http://ffmpeg.org/download.html > for supported versions, current git head is always recommended. > What I meant is that I was looking what libav functions avprobe calls in order to find the metada. Actually, right now I think that my problem with the information about the descriptors, languages etc is solved with the metadata field on the AVFormatContext components. Just a matter of iterate over all of them. > You should probably try to prepare a patch (against current git > head, see above) and post it to ffmpeg-devel (or describe in > more detail what is needed, perhaps PAT/PMT should be exported > as metadata). > After getting the information for the PMT I'll give it a look to understand exactly what and where can be obtained from the transport and if possible try to propose a patch. > Please do not top-post here, Carl Eugen > Sorry! Thanks for your time. -- View this message in context: http://libav-users.943685.n4.nabble.com/Public-way-of-accessing-PAT-PMT-for-a-mpegts-both-binary-and-the-contents-tp4655394p4655400.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Jul 12 14:53:10 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 12 Jul 2012 12:53:10 +0000 (UTC) Subject: [Libav-user] Public way of accessing PAT/PMT for a mpegts (both binary and the contents) References: <1342034074931-4655394.post@n4.nabble.com> Message-ID: cognos writes: > > Please understand that avprobe and friends contain several hundred > > regressions, some of them security relevant, we therefore cannot > > support them here, please look at http://ffmpeg.org/download.html > > for supported versions, current git head is always recommended. > > > What I meant is that I was looking what libav functions avprobe calls > in order to find the metada. What I meant is that you are using functions from a fork of FFmpeg that is known to be badly maintained and therefore buggy. Carl Eugen From amillett at matrox.com Thu Jul 12 17:29:38 2012 From: amillett at matrox.com (Alexandre Millette) Date: Thu, 12 Jul 2012 11:29:38 -0400 Subject: [Libav-user] sws_scale has weird behavior when not resizing Message-ID: <4FFEED62.8020408@matrox.com> Hello all. I'm working on a C++ video player using libav. Upon testing with various video formats and files, I've encountered a problem with a small MPEG4/mp4v file (190x240). The issue is that a small green band (6 px in width) will appear on the right side of the frames. This is what I've gathered so far: - The YUV420 frame read in the stream is ok. - The RGB32 frame output by sws_scale (there is no resize, the function is used only for conversion purpose) has the green band, so the problem comes from sws_scale. - The green color comes from the original allocation of the YUV frame (data to 0 equals to a green shade). - If sws_scale is used also as a resizing device (say converting YUV420 190x240 to RGB32 191x240), there is no colored band, but the frame is of course 1 pixel wider than intended (frame accuracy is an important feature of the project, so this is not acceptable). - When trying a sws_scale resize&convert on only the first frame, the other frames will still have a band to the right, but it will be the pixels from the first frame, not green. I can only assume that it is because the RGB32 frame is not entirely overwritten by the function. After all this exposition, my question: Why is sws_scale behavior different when not resizing? What should be changed in order to produce the same result but without the resizing? As a precision, resizing up and down each frame is not a viable solution since performance is an issue (besides it would seem wrong). Here's some very simplified code to help: AVCodecContext* mpCodecCtx; AVFrame* lpFrame; AVFrame* lpFrameRGB; static struct SwsContext* img_convert_ctx = 0; // ... // mpCodecCtx is opened normally // lpFrame is allocated and returned by avcodec_decode_video2 // lpFrameRGB is allocated and filled by avpicture_fill int w = mpCodecCtx->width; int h = mpCodecCtx->height; img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P, w, h, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL); int ret = sws_scale(img_convert_ctx, lpFrame->data, lpFrame->linesize, 0, h, lpFrameRGB->data, lpFrameRGB->linesize); // Here lpFrameRGB contains the green bar // This can be prevented by changing the fourth // parameter of sws_getContext to w+1 Thank you, Alex M From cehoyos at ag.or.at Thu Jul 12 19:09:36 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 12 Jul 2012 17:09:36 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?sws=5Fscale_has_weird_behavior_when_not_re?= =?utf-8?q?sizing?= References: <4FFEED62.8020408@matrox.com> Message-ID: Alexandre Millette writes: > Upon testing with various video formats and files, I've encountered a > problem with a small MPEG4/mp4v file (190x240). > The issue is that a small green band (6 px in width) will appear on the > right side of the frames. Can you reproduce this with ffmpeg (the command line tool)? If yes, please provide command line together with complete, uncut console output. Carl Eugen From alexcohn at netvision.net.il Thu Jul 12 20:18:15 2012 From: alexcohn at netvision.net.il (Alex Cohn) Date: Thu, 12 Jul 2012 21:18:15 +0300 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: <4FFEED62.8020408@matrox.com> References: <4FFEED62.8020408@matrox.com> Message-ID: On Jul 12, 2012 6:30 PM, "Alexandre Millette" wrote: > > Hello all. > > I'm working on a C++ video player using libav. > Upon testing with various video formats and files, I've encountered a problem with a small MPEG4/mp4v file (190x240). > The issue is that a small green band (6 px in width) will appear on the right side of the frames. > > This is what I've gathered so far: > - The YUV420 frame read in the stream is ok. > - The RGB32 frame output by sws_scale (there is no resize, the function is used only for conversion purpose) has the green band, so the problem comes from sws_scale. > - The green color comes from the original allocation of the YUV frame (data to 0 equals to a green shade). > - If sws_scale is used also as a resizing device (say converting YUV420 190x240 to RGB32 191x240), there is no colored band, but the frame is of course 1 pixel wider than intended (frame accuracy is an important feature of the project, so this is not acceptable). I believe your problem could be rooted in bicubic transform. It makes n9 sense when source and target sizes are the same. Try to set linear. > img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P, > w, h, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL); > > Thank you, > Alex M I hope this helps. Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From amillett at matrox.com Thu Jul 12 21:00:43 2012 From: amillett at matrox.com (Alexandre Millette) Date: Thu, 12 Jul 2012 15:00:43 -0400 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: References: <4FFEED62.8020408@matrox.com> Message-ID: <4FFF1EDB.4030107@matrox.com> Thanks for replying. > I believe your problem could be rooted in bicubic transform. > It makes n9 sense when source and target sizes are the same. > Try to set linear. I tried both SWS_FAST_BILINEAR and SWS_BILINEAR (as well as a few others) and there is no change. From what I understand of the sws_scale source code, when the source size equals the destination size, the scaling operations are entirely skipped, which makes sense for optimization. It also makes sense since sws_scale's behavior is different if there's a resize or not. > Can you reproduce this with ffmpeg (the command line tool)? > If yes, please provide command line together with complete, > uncut console output. Forgot to tell that in my first email: I cannot reproduce this behavior, be it with ffmpeg, ffplay or VLC. I am currently trying different options with ffmpeg, but as of now the issue seems to be only in my project. Also I've been thinking about the unusual size of the frames... 190 is not a factor of 8, while most standard resolutions are. And since 6 pixels are lost, there's only 184 pixels per line in a frame, which IS a factor of 8. I will be trying multiple resolutions, but I'm starting to think that sws_scale has troubles handling width that can't be divided by 8. Any thoughts on this? Alex P.S.: I'm not sure how this maillist is handled, so there's a chance this message will show up on the wrong level in the web archive. Please let me know if I should be doing something special. From susiriss at gmail.com Fri Jul 13 02:57:53 2012 From: susiriss at gmail.com (Sampath Subasinghe) Date: Fri, 13 Jul 2012 06:27:53 +0530 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: <4FFEED62.8020408@matrox.com> References: <4FFEED62.8020408@matrox.com> Message-ID: <4FFF7291.8030807@gmail.com> On 07/12/2012 08:59 PM, Alexandre Millette wrote: > > Upon testing with various video formats and files, I've encountered a > problem with a small MPEG4/mp4v file (190x240). > The issue is that a small green band (6 px in width) will appear on > the right side of the frames. > I also have encountered this "right band" issue when converting from YUV to RGB. However, I noticed that issue doesn't appear when your frame width is a multiple of 8. I assumed you mentioned HeightxWidth, not widthxheight and, thus frame width is 240, which is a multiple of 8. In that case this issue should not appear to my knowledge. I have post on this in the same mailing list. -Sampath From amillett at matrox.com Fri Jul 13 14:43:28 2012 From: amillett at matrox.com (Alexandre Millette) Date: Fri, 13 Jul 2012 08:43:28 -0400 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: <4FFF7291.8030807@gmail.com> References: <4FFEED62.8020408@matrox.com> <4FFF7291.8030807@gmail.com> Message-ID: <500017F0.8070802@matrox.com> > I also have encountered this "right band" issue when converting from > YUV to RGB. However, I noticed that issue doesn't appear when your > frame width is a multiple of 8. I assumed you mentioned HeightxWidth, > not widthxheight and, thus frame width is 240, which is a multiple of > 8. In that case this issue should not appear to my knowledge. I have > post on this in the same mailing list. Thank you for pointing me to your previous post ( http://ffmpeg.org/pipermail/libav-user/2012-June/002166.html ): my issue seems quite similar. But I am using the WidthxHeight standard, which means that my frame width is 190 pixels. I have tried a few things since my last post: I added a padding to the video using ffmpeg, making it 192x240 (so a multiple of 8) and then the video was shown without the green band, proving that there is an alignment problem. I tried to trick the converter into thinking that the image was wider with this line : > int w = mpCodecCtx->width+2; That way the converter assumes a width of 192 pixels. Yet it does absolutely no difference. However, if I were to use : > int w = mpCodecCtx->width+3; Making the width 193 pixels, the right band disappears and the frame is shown correctly. I can also use any integer greater than 2, as long as the resulting width doesn't bust the line size. I am not surprised to see that using larger width solves the alignment issue, but I really don't get why stipulating a width of 192 does not work. After all, 192 is a multiple of 8 and a video that is already 192x240 shows no issue... Also I am not sure what would be the proper way to handle this situation. Sure I can round the width of the frame to the nearest greater multiple of 8 and add one to it, but I'm afraid that in some situation it may bust the line size and cause an exception. Plus it doesn't seem right to use such magic numbers... Alex M From nowget at qq.com Fri Jul 13 13:32:47 2012 From: nowget at qq.com (=?gbk?B?s8HErLXEtPO24Mr9?=) Date: Fri, 13 Jul 2012 19:32:47 +0800 Subject: [Libav-user] sws_scale has weird behavior when not resizing Message-ID: ???????? ------ ???? ------ From:"Alex Cohn"; Date:2012?7?13?(???) ??2:18 To:"This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject:Re: [Libav-user] sws_scale has weird behavior when not resizing On Jul 12, 2012 6:30 PM, "Alexandre Millette" wrote: > > Hello all. > > I'm working on a C++ video player using libav. > Upon testing with various video formats and files, I've encountered a problem with a small MPEG4/mp4v file (190x240). > The issue is that a small green band (6 px in width) will appear on the right side of the frames. > > This is what I've gathered so far: > - The YUV420 frame read in the stream is ok. > - The RGB32 frame output by sws_scale (there is no resize, the function is used only for conversion purpose) has the green band, so the problem comes from sws_scale. > - The green color comes from the original allocation of the YUV frame (data to 0 equals to a green shade). > - If sws_scale is used also as a resizing device (say converting YUV420 190x240 to RGB32 191x240), there is no colored band, but the frame is of course 1 pixel wider than intended (frame accuracy is an important feature of the project, so this is not acceptable). I believe your problem could be rooted in bicubic transform. It makes n9 sense when source and target sizes are the same. Try to set linear. > img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P, > ? w, h, PIX_FMT_RGB32, SWS_BICUBIC, NULL, NULL, NULL); > > Thank you, > Alex M I hope this helps. Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabio.europe at gmail.com Sat Jul 14 13:34:52 2012 From: fabio.europe at gmail.com (Fabio Tiriticco) Date: Sat, 14 Jul 2012 13:34:52 +0200 Subject: [Libav-user] use AVPacket.pts with av_seek_frame() Message-ID: hi all, I wrote last week asking for help implementing a video timmer using C. I am able to scan packets and find frames (av_read_frame() and av_decode_video2()). Every time a read a packet I can see its position in the timeframe with AVPacket.pts. Now I am struggling with the seek functionality. How can I use the AVPacket.pts information with av_seek_frame()? I tried to use it "raw": av_seek_frame(pFormatCtx, videoStream, pts, backwardFlag) but I am afraid that I'm doing something wrong as it doesn't work. And I read about conversions that I'm probably missing. Any help will be greatly appreciated! :-) cheers Fabio -- http://famsterdamlife.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From amillett at matrox.com Mon Jul 16 15:45:25 2012 From: amillett at matrox.com (Alexandre Millette) Date: Mon, 16 Jul 2012 09:45:25 -0400 Subject: [Libav-user] use AVPacket.pts with av_seek_frame() In-Reply-To: References: Message-ID: <50041AF5.30108@matrox.com> Hi Fabio. I can't say I have much experience with av_seek_frame(), but since no one else answered you, I might as well try to help. > Every time a read a packet I can see its position > in the timeframe with AVPacket.pts. > Now I am struggling with the seek functionality. So you are first reading the entire video and storing the pts value for later use? Because if you have the AVPacket, then you have the encoded frame. The only use of av_seek_frame with pts would be to go back to a packet that you previously read but have since lost. > av_seek_frame(pFormatCtx, videoStream, pts, backwardFlag) What exactly do you mean when you say that it doesn't work? Does an exception occur? Does the current frame change at all? av_seek_frame will only move the position of the file reader, meaning that you have to read the packet again and the decode it. Also be careful with pts... the doc specifies that it is a timestamp in AVStream->time_base units, but some tutorials (like http://dranger.com/ffmpeg/tutorial07.html ) suggest that this timestamp should be multiplied by AV_TIME_BASE. I guess a bit more code would be better if you wish for more help. Alex M From fzanelli at tecnosens.it Mon Jul 16 16:50:45 2012 From: fzanelli at tecnosens.it (Zanelli Franco) Date: Mon, 16 Jul 2012 16:50:45 +0200 Subject: [Libav-user] avresample vs swresample Message-ID: Hi All, what is the difference between avresample.dll we can find in libav builds and swresample.dll in ffmpeg builds? What they are used for? thank you From amillett at matrox.com Mon Jul 16 18:15:06 2012 From: amillett at matrox.com (Alexandre Millette) Date: Mon, 16 Jul 2012 12:15:06 -0400 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: <500017F0.8070802@matrox.com> References: <4FFEED62.8020408@matrox.com> <4FFF7291.8030807@gmail.com> <500017F0.8070802@matrox.com> Message-ID: <50043E0A.70908@matrox.com> Hi again. TL;DR: use the SWS_ACCURATE_RND flag. I have solve my issue (or rather found a workaround) and thought it might help some people: > Also I am not sure what would be the proper way to handle this situation. > Sure I can round the width of the frame to the nearest greater multiple of > 8 and add one to it, but I'm afraid that in some situation it may bust the > line size and cause an exception. Plus it doesn't seem right to use such > magic numbers.. The problem only occurs when sws_scale does no resizing, that is when the source and destination sizes are the same. By looking at the sws_getContext source code, I have found that one flag, SWS_ACCURATE_RND, among other things, force the function to not use it's no-resizing algorithm. So we can prevent the issue by setting this flag. I am not quite sure of the exact usage of this flag, but I know VLC used to have it set for quality issues (that could be related to my own issue) but have since removed it from some builds (like their android's) because of performance problems. I have personally seen no difference in performance with the flag, but I have still decided to use it only when need be, that is when the width and height are not multiples of 8. Here's a glimpse of my code now: AVCodecContext* mpCodecCtx; AVFrame* lpFrame; AVFrame* lpFrameRGB; static struct SwsContext* img_convert_ctx = 0; // ... // mpCodecCtx is opened normally // lpFrame is allocated and returned by avcodec_decode_video2 // lpFrameRGB is allocated and filled by avpicture_fill int w = mpCodecCtx->width; int h = mpCodecCtx->height; int SwsFlags = SWS_FAST_BILINEAR; if ((w & 0x7) || (h & 0x7)) SwsFlags |= SWS_ACCURATE_RND; img_convert_ctx = sws_getContext(w, h, PIX_FMT_YUV420P, w, h, PIX_FMT_RGB32, SwsFlags, NULL, NULL, NULL); int ret = sws_scale(img_convert_ctx, lpFrame->data, lpFrame->linesize, 0, h, lpFrameRGB->data, lpFrameRGB->linesize); On a somewhat related note, can the sws_scale behavior that I was seeing be considered a bug? If so, how should I open a ticket for it to be fix? Alex M From harrison.declan at gmail.com Mon Jul 16 18:34:21 2012 From: harrison.declan at gmail.com (declan harrison) Date: Mon, 16 Jul 2012 17:34:21 +0100 Subject: [Libav-user] How do I specify a bitstream filter using the ffmpeg API Message-ID: Hi Guys I have a problem creating MPEG2-TS files when using the ffmpeg API. I get the following error thrown by ffmpeg "H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)". On the CLI interface I can easily specify the bitstream filter using the following : ffmpeg -i INFILE.mp4 -f mpegts -codec copy -bsf:v h264_mp4toannexb OUTFILE.ts, and this works well for me on the command line only. However I cant find away to set the "bsf:v" using the API as this option isnt a libav* option that can be passed in via the API. Is there a way of specify a bitstream filter from the API. Im running RHEL 6.2, Im using the latest version of ffmpeg libavutil 51. 42.100 / 51. 42.100 libavcodec 54. 10.100 / 54. 10.100 libavformat 54. 2.100 / 54. 2.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 64.101 / 2. 64.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 7.100 / 0. 7.100 libpostproc 52. 0.100 / 52. 0.100 Thanks From mbradshaw at sorensonmedia.com Mon Jul 16 19:30:30 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Mon, 16 Jul 2012 11:30:30 -0600 Subject: [Libav-user] sws_scale has weird behavior when not resizing In-Reply-To: <50043E0A.70908@matrox.com> References: <4FFEED62.8020408@matrox.com> <4FFF7291.8030807@gmail.com> <500017F0.8070802@matrox.com> <50043E0A.70908@matrox.com> Message-ID: On Mon, Jul 16, 2012 at 10:15 AM, Alexandre Millette wrote: > On a somewhat related note, can the sws_scale behavior that I was seeing be > considered a bug? Yes. It's either a bug in your code or in sws_scale. The fact that ffmpeg doesn't reproduce it makes me lean towards it being a bug in your code, but that doesn't necessarily mean it is. Or it's an undocumented "feature" that needs to be documented. > If so, how should I open a ticket for it to be fix? You never mentioned which version of sws_scale/libav* you're using. If you can reproduce it with the current git head and your code looks ok (I can't see any immediate red flags from what little I've seen), check out this page (also note the "Bug Tracker" sub section): http://ffmpeg.org/bugreports.html --Michael From mbradshaw at sorensonmedia.com Mon Jul 16 19:38:19 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Mon, 16 Jul 2012 11:38:19 -0600 Subject: [Libav-user] avresample vs swresample In-Reply-To: References: Message-ID: On Mon, Jul 16, 2012 at 8:50 AM, Zanelli Franco wrote: > Hi All, > what is the difference between avresample.dll we can find in libav > builds and swresample.dll in ffmpeg builds? > What they are used for? They are both used for resampling audio. See this thread for more info: http://ffmpeg.org/pipermail/ffmpeg-devel/2012-April/123746.html --Michael From fzanelli at tecnosens.it Tue Jul 17 09:39:02 2012 From: fzanelli at tecnosens.it (Zanelli Franco) Date: Tue, 17 Jul 2012 09:39:02 +0200 Subject: [Libav-user] avresample vs swresample In-Reply-To: References: Message-ID: Il 16/07/2012 19:38, Michael Bradshaw ha scritto: > On Mon, Jul 16, 2012 at 8:50 AM, Zanelli Franco wrote: >> Hi All, >> what is the difference between avresample.dll we can find in libav >> builds and swresample.dll in ffmpeg builds? >> What they are used for? > They are both used for resampling audio. See this thread for more > info: http://ffmpeg.org/pipermail/ffmpeg-devel/2012-April/123746.html > > --Michael > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user Thank you very much From fabio.europe at gmail.com Tue Jul 17 10:12:10 2012 From: fabio.europe at gmail.com (Fabio Tiriticco) Date: Tue, 17 Jul 2012 10:12:10 +0200 Subject: [Libav-user] use AVPacket.pts with av_seek_frame() In-Reply-To: <50041AF5.30108@matrox.com> References: <50041AF5.30108@matrox.com> Message-ID: Hi Alexandre, thanks for your reply and apologies for the delayed reaction. As an experiment, I am first reading through all the packets, so that I know that I have an X number of packets. Each packet has a pts value, from 1 to X. Later on I would like the user to be able to jump to any packet, and then I need av_seek_frame() to move the header to the right timestamp. My reasoning to move it to packet Y has been: const int64_t pti = pFormatContext.duration / (int64_t)X; // duration of a packet const int64_t packetTimestamp = Y * pti; av_seek_frame(pFormatCtx, videoStream, packetTimestamp * AV_TIME_BASE, backwardFlag). to test it, I do this in a loop and try to extract the first ten packets and use the avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet); after this I check which packet has been extracted from packet.pts. At this point, when I do ten times in a row the av_seek_frame() call with X going from 1 to 10, the avcodec_decode_video2() call, the packet.pts that I extract is always the same number (250) and indeed if I print the frame on screen it is always the same frame. I will keep trying. At the moment I am trying to build this in a JNI environment but I think I'll go to a simple C program to play around with. Thank you very much for your attention and help, Fabio On Mon, Jul 16, 2012 at 3:45 PM, Alexandre Millette wrote: > Hi Fabio. > I can't say I have much experience with av_seek_frame(), but since no one > else answered you, I might as well try to help. > > > > Every time a read a packet I can see its position > > in the timeframe with AVPacket.pts. > > Now I am struggling with the seek functionality. > > So you are first reading the entire video and storing the pts value for > later use? > Because if you have the AVPacket, then you have the encoded frame. The > only use of av_seek_frame with pts would be to go back to a packet that you > previously read but have since lost. > > > av_seek_frame(pFormatCtx, videoStream, pts, backwardFlag) > > What exactly do you mean when you say that it doesn't work? Does an > exception occur? Does the current frame change at all? > av_seek_frame will only move the position of the file reader, meaning that > you have to read the packet again and the decode it. > > Also be careful with pts... the doc specifies that it is a timestamp in > AVStream->time_base units, but some tutorials (like > http://dranger.com/ffmpeg/**tutorial07.html) suggest that this timestamp should be multiplied by AV_TIME_BASE. > > I guess a bit more code would be better if you wish for more help. > > Alex M > ______________________________**_________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/**listinfo/libav-user > -- http://famsterdamlife.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From amillett at matrox.com Tue Jul 17 15:16:25 2012 From: amillett at matrox.com (Alexandre Millette) Date: Tue, 17 Jul 2012 09:16:25 -0400 Subject: [Libav-user] use AVPacket.pts with av_seek_frame() In-Reply-To: References: <50041AF5.30108@matrox.com> Message-ID: <500565A9.10308@matrox.com> Hello again. > As an experiment, I am first reading through all the packets, so that > I know that I have an X number of packets. Each packet has a pts > value, from 1 to X. Be careful with this. It is not expected for a video to have it's packet in increments of 1. I just checked a sample mp4 (h264) file with my code and the packets were output with this sequence of pts: 0, 24, 48, 72, etc. In this case, AVPacket->duration == 24. > const int64_t pti = pFormatContext.duration / (int64_t)X; // duration > of a packet This is the same as AVPacket->duration, is it not? In this case there may be a problem if you try opening a file that has frames with variable duration. > const int64_t packetTimestamp = Y * pti; > av_seek_frame(pFormatCtx, videoStream, packetTimestamp * AV_TIME_BASE, > backwardFlag). Okay, so we're back to what seems like AVStream->time_base units and this is what we want. Have you tried removing the AV_TIME_BASE ? The best way to debug would be to go in debug mode and to check the flow of the code line by line to see if packetTimestamp has the value of the targeted AVPacket's pts (since you already read all the packets, you can easily see the this value). Speaking of which, I do believe you should not try to make up pts with formulas, but rather store them on the first read-up and use them later. The way I would do it would be like this : - Loop all the packets with av_read_frame(). - Use avcodec_decode_video2() for each packet. When a frame is returned, store the pts in ptsArray[i] and then increment i (starting from 0). Since avcodec_decode_video2 will always return the frames in their presentation order, you know that ptsArray[Y] will be the the pts value of the packet you want to show the frame Y. - When you want to go to the frame Y: av_seek_frame(pFormatCtx, videoStream, ptsArray[Y], backwardFlag) (maybe with the *AV_TIME_BASE, but I would guess not). - av_read_frame() and avcodec_decode_video2(). You could test it easily by just storing one pts value (hardcoding it if you have to) and then checking if you can access the frame. Also I don't believe you said you were using av_read_frame() after using av_seek_frame()... could it be that you are calling avcodec_decode_video2() with the last packet you read in the first loop? Hope this helps you... Alex M From harrison.declan at gmail.com Tue Jul 17 17:27:16 2012 From: harrison.declan at gmail.com (declan harrison) Date: Tue, 17 Jul 2012 16:27:16 +0100 Subject: [Libav-user] API support for on the fly re-configuration of video encoders Message-ID: Hi Some encoders provide the ability to reconfigure the encoders mid-stream, most notably libx264 has this ability (over 2 years now) via the call to x264_encoder_reconfig. See http://x264dev.multimedia.cx/archives/286. I think it would be useful if the ffmpeg API supported this ability to do this. So for encoder that dont support this, then a call would be a no-op. Do you gusy think this would be a useful feature? Declan From oleg.zhuravel at gmail.com Wed Jul 18 01:59:48 2012 From: oleg.zhuravel at gmail.com (Oleg Zhuravel) Date: Wed, 18 Jul 2012 02:59:48 +0300 Subject: [Libav-user] Dramaticaly increased latency of avcodec_encode_video with x264 switching from avcodec-52.dll to avcodec-53.dll Message-ID: Hello. Need help as I am stuck. As is said in subject I have updated the version of ffmpeg in my application from dated around 2009-01 to the version dated around 2011-10 . But avcodec_encode_video (avcodec_encode_video2) started to give a huge latency. It outputs any data after like more than 100 frames fed. And before that it was only 1 frame. I have tried all the options like "tune zerolatency" but nothing helps. Tried the latest version as of today but still the same huge latency. Here is the code I use: CodecOutContexts[i] = avcodec_alloc_context(); CodecOutPictures[i] = avcodec_alloc_frame(); /* frames per second */ CodecOutContexts[i]->time_base.num = 1; CodecOutContexts[i]->time_base.den = 25; /* resolution must be a multiple of two */ CodecOutContexts[i]->width = DevsOut[nCurDevOut].Width; if (i < ThreadCount - 1) CodecOutContexts[i]->height = DevsOut[nCurDevOut].Height / ThreadCount; else CodecOutContexts[i]->height = DevsOut[nCurDevOut].Height / ThreadCount + DevsOut[nCurDevOut].Height % ThreadCount; CodecOutContexts[i]->gop_size = 25; /* emit one intra frame every ten frames */ CodecOutContexts[i]->max_b_frames = 0; CodecOutContexts[i]->pix_fmt = PIX_FMT_YUV420P; CodecOutContexts[i]->qmin = 15; CodecOutContexts[i]->qmax = 31; CodecOutContexts[i]->bit_rate = 2000000 / ThreadCount ; CodecOutContexts[i]->bit_rate_tolerance = 1000000 / ThreadCount; /* open it */ if (avcodec_open(CodecOutContexts[i], CodecOut) < 0) { _ASSERT(FALSE); WriteToLog(LOGSCREEN,"Could not open codec"); } Thank you. From drabner at zoobe.com Wed Jul 18 11:20:16 2012 From: drabner at zoobe.com (Drabner) Date: Wed, 18 Jul 2012 02:20:16 -0700 (PDT) Subject: [Libav-user] c++ API h264 encoded video does not play on all platforms Message-ID: <1342603216144-4655422.post@n4.nabble.com> This is a copy of my question on stackoverflow (thought it would be a good idea to post it here, too): http://stackoverflow.com/questions/11537830/ffmpeg-api-h264-encoded-video-does-not-play-on-all-platforms I am using the C++ API to create a mp4 video in C++. I want the resulting video to be of the profile "Constrained Baseline", so that the resulting video can be played on as much platforms as possible, especially mobile, but I get "Main" profile every time, even though I hard coded the codec profile to be *FF_PROFILE_H264_CONSTRAINED_BASELINE*. As a result, the video does not play on all our testing platforms. This is what "ffprobe video.mp4 -show_streams" tells about my video streams: //--------------------------------------------------------- Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 creation_time : 1970-01-01 00:00:00 encoder : Lavf53.5.0 Duration: 00:00:13.20, start: 0.000000, bitrate: 553 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 320x180, 424 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc Metadata: creation_time : 1970-01-01 00:00:00 handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 12 kb/s Metadata: creation_time : 1970-01-01 00:00:00 handler_name : SoundHandler -------VIDEO STREAM-------- [STREAM] index=0 codec_name=h264 codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 profile=Main <-- This should be "Constrained Baseline" codec_type=video codec_time_base=1/30 codec_tag_string=avc1 codec_tag=0x31637661 width=320 height=180 has_b_frames=0 sample_aspect_ratio=N/A display_aspect_ratio=N/A pix_fmt=yuv420p level=30 timecode=N/A is_avc=1 nal_length_size=4 id=N/A r_frame_rate=15/1 avg_frame_rate=15/1 time_base=1/15 start_time=0.000000 duration=13.200000 bit_rate=424252 nb_frames=198 nb_read_frames=N/A nb_read_packets=N/A TAG:creation_time=1970-01-01 00:00:00 TAG:language=und TAG:handler_name=VideoHandler [/STREAM] -------AUDIO STREAM-------- [STREAM] index=1 codec_name=aac codec_long_name=Advanced Audio Coding profile=unknown codec_type=audio codec_time_base=1/44100 codec_tag_string=mp4a codec_tag=0x6134706d sample_fmt=s16 sample_rate=44100 channels=2 bits_per_sample=0 id=N/A r_frame_rate=0/0 avg_frame_rate=0/0 time_base=1/44100 start_time=0.000000 duration=13.165714 bit_rate=125301 nb_frames=567 nb_read_frames=N/A nb_read_packets=N/A TAG:creation_time=1970-01-01 00:00:00 TAG:language=und TAG:handler_name=SoundHandler [/STREAM] //--------------------------------------------------------- This is the function I use to add a video stream. All the values that come from ptr-> are defined from outside, do those values have to be specific values to get the correct profile?: //--------------------------------------------------------- static AVStream *add_video_stream( Cffmpeg_dll * ptr, AVFormatContext *oc, enum CodecID codec_id ) { AVCodecContext *c; AVStream *st; st = av_new_stream(oc, 0); if (!st) { av_log(NULL, AV_LOG_ERROR, "%s","Could not alloc stream\n"); exit(1); } c = st->codec; c->codec_id = CODEC_ID_H264; c->codec_type = AVMEDIA_TYPE_VIDEO; /* put parameters */ c->bit_rate = ptr->video_bit_rate; c->qmin = ptr->qmin; c->qmax = ptr->qmax; c->me_method = ptr->me_method; c->me_subpel_quality = ptr->me_subpel_quality; c->i_quant_factor = ptr->i_quant_factor; c->qcompress = ptr->qcompress; c->max_qdiff = ptr->max_qdiff; c->level = 30; c->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE; c->width = ptr->dstWidth; c->height = ptr->dstHeight; c->time_base.den = ptr->fps; c->time_base.num = 1; c->gop_size = 30; c->pix_fmt = PIX_FMT_YUV420P; if(oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; return st; } //--------------------------------------------------------- *Additional info:* As a reference video, I use the gizmo.mp4 that Mozilla serves as an example that plays on every platform/browser. It definitely has the "Constrained Baseline" profile, and definitely works on all our testing smartphones. You can download it here: http://www.808.dk/pics/video/gizmo.mp4 Our self-created video doesn't work on all platforms and I'm convinced this is because of the profile. I am also using *qt-faststart.exe* to move the headers to the start of the file after creating the mp4, as this cannot be done in a good way in C++ directly. Could that be the problem? Obviously, I am doing /something/ wrong, but I don't know what it could be. I'd be thankful for every hint ;) -- View this message in context: http://libav-users.943685.n4.nabble.com/c-API-h264-encoded-video-does-not-play-on-all-platforms-tp4655422.html Sent from the libav-users mailing list archive at Nabble.com. From dtimms at iinet.net.au Wed Jul 18 13:37:18 2012 From: dtimms at iinet.net.au (David Timms) Date: Wed, 18 Jul 2012 21:37:18 +1000 Subject: [Libav-user] updating an to use libav 0.11.1 that currently uses 0.8.12 Message-ID: <50069FEE.1070002@iinet.net.au> Hi, I've been trying to find some pointers / a summary of changes libav users need to make to work with 0.11.1 but been unsuccessful. With Audacity, the errors start with: ---- FFmpeg.h:355:4: error: 'SampleFormat' does not name a type In file included from AudacityApp.cpp:70:0: FFmpeg.h:584:12: error: use of enum 'SampleFormat' without previous declaration In file included from AudacityApp.cpp:70:0: FFmpeg.h:621:92: error: 'AVFormatParameters' has not been declared FFmpeg.h:621:235: error: 'AVFormatParameters' has not been declared In file included from AudacityApp.cpp:70:0: FFmpeg.h:638:7: warning: 'av_register_protocol_fp' initialized and declared 'extern' [enabled by default] FFmpeg.h:638:7: error: 'URLProtocol' was not declared in this scope FFmpeg.h:638:20: error: 'protocol' was not declared in this scope FFmpeg.h:638:64: error: 'av_register_protocol' declared as an 'inline' variable FFmpeg.h:638:64: error: 'URLProtocol' was not declared in this scope FFmpeg.h:638:77: error: 'protocol' was not declared in this scope FFmpeg.h:638:87: error: expected ',' or ';' before '{' token In file included from AudacityApp.cpp:70:0: FFmpeg.h:691:27: error: 'AVFormatParameters' has not been declared ---- Is there some summary info like change X to Y and add parameter Z style document available ? From cehoyos at ag.or.at Wed Jul 18 13:51:31 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 18 Jul 2012 11:51:31 +0000 (UTC) Subject: [Libav-user] updating an to use libav 0.11.1 that currently uses 0.8.12 References: <50069FEE.1070002@iinet.net.au> Message-ID: David Timms writes: > Hi, I've been trying to find some pointers / a summary of changes libav > users need to make to work with 0.11.1 but been unsuccessful. You could try 0.10 which should be API compatible iirc. Carl Eugen From dtimms at iinet.net.au Wed Jul 18 14:28:47 2012 From: dtimms at iinet.net.au (David Timms) Date: Wed, 18 Jul 2012 22:28:47 +1000 Subject: [Libav-user] updating an to use libav 0.11.1 that currently uses 0.8.12 In-Reply-To: References: <50069FEE.1070002@iinet.net.au> Message-ID: <5006ABFF.2080202@iinet.net.au> On 18/07/12 21:51, Carl Eugen Hoyos wrote: > David Timms writes: > >> Hi, I've been trying to find some pointers / a summary of changes libav >> users need to make to work with 0.11.1 but been unsuccessful. > > You could try 0.10 which should be API compatible iirc. Thanks Carl, I understand what you said is correct, however, moving with the latest changes and getting prepared for an October release of Fedora is what I'm hoping to achieve, including the ffmpeg 0.11.1 (minimum) that is packaged there (rpmfusion). Any other particular list posts or web pages, or source doco that can provide the info I'm after ? From amillett at matrox.com Wed Jul 18 14:42:46 2012 From: amillett at matrox.com (Alexandre Millette) Date: Wed, 18 Jul 2012 08:42:46 -0400 Subject: [Libav-user] Dramaticaly increased latency of avcodec_encode_video with x264 switching from avcodec-52.dll to avcodec-53.dll In-Reply-To: References: Message-ID: <5006AF46.2090401@matrox.com> Hi. > switching from avcodec-52.dll to avcodec-53.dll > It probably won't solve the issue, but maybe you could try using avcodec-54.dll since it's the latest release? Or is there a reason why you need the older one? > > It outputs any data after like more than 100 > frames fed. And before that it was only 1 frame. The same video that could be played with 1 frame latency now has a 100+ frames latency? Have you tried other h264 files? Other formats? If it's specific to a file or to a set of files coming form the same encoder, maybe it's because of a header value that isn't standard: I would then recommend checking the patch notes between the 2 releases to know what could have changed. Also, are all the frames returned, simply really late? I'm wondering if you're maybe missing a lot of frames and it isn't a latency issue at all. Hope it helps a bit, Alex M From cehoyos at ag.or.at Wed Jul 18 15:15:13 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 18 Jul 2012 13:15:13 +0000 (UTC) Subject: [Libav-user] updating an to use libav 0.11.1 that currently uses 0.8.12 References: <50069FEE.1070002@iinet.net.au> <5006ABFF.2080202@iinet.net.au> Message-ID: David Timms writes: > Any other particular list posts or web pages, or source doco > that can provide the info I'm after ? You can look at doc/APIchanges, but I don't know if it is complete, you should probably start porting are post questions here. (The output you posted did not look as if someone would know where to start.) Carl Eugen From oleg.zhuravel at gmail.com Wed Jul 18 16:53:17 2012 From: oleg.zhuravel at gmail.com (Oleg Zhuravel) Date: Wed, 18 Jul 2012 17:53:17 +0300 Subject: [Libav-user] Dramaticaly increased latency of avcodec_encode_video with x264 switching from avcodec-52.dll to avcodec-53.dll In-Reply-To: <5006AF46.2090401@matrox.com> References: <5006AF46.2090401@matrox.com> Message-ID: Hello. Hello. Yes, I have switched to the most recent version, of course. I would prefer the latest. But the result is exactly the same. I am not working with files. My app captures screenshots, encodes it, sends over the network, decodes it, and shows on another PC. So I am totally contained in my own app. So what was working very well stopped working. Well, not stopped, but that huge latency give me about 5-6 seconds of delay. So it is like 40 - 50 frames in my app. Also I have seen, that it is encoder functions which is the problem. Thank you for your response. On Wed, Jul 18, 2012 at 3:42 PM, Alexandre Millette wrote: > Hi. > >> switching from avcodec-52.dll to avcodec-53.dll >> > > > It probably won't solve the issue, but maybe you could try using > avcodec-54.dll since it's the latest release? Or is there a reason why you > need the older one? > > >> >> It outputs any data after like more than 100 >> frames fed. And before that it was only 1 frame. > > > The same video that could be played with 1 frame latency now has a 100+ > frames latency? > Have you tried other h264 files? Other formats? > If it's specific to a file or to a set of files coming form the same > encoder, maybe it's because of a header value that isn't standard: I would > then recommend checking the patch notes between the 2 releases to know what > could have changed. > > Also, are all the frames returned, simply really late? I'm wondering if > you're maybe missing a lot of frames and it isn't a latency issue at all. > > Hope it helps a bit, > Alex M > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From michaelni at gmx.at Wed Jul 18 21:30:55 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 18 Jul 2012 21:30:55 +0200 Subject: [Libav-user] sws_setColorspaceDetails parameters for colorspace conversions In-Reply-To: References: Message-ID: <20120718193055.GA490@kiste2> On Sun, Jul 08, 2012 at 01:04:17PM +0200, Robert Kr?ger wrote: > Hi, > > I'm trying to do a colorspace conversion using libswscale. The > documentation for sws_setColorspaceDetails doesn't have all params > documented: added docs for the rest, but note converting between different types of YUV material is not fully implemented (patches welcome for that ...) just the API exists since a long time to specify such convertions [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From mbradshaw at sorensonmedia.com Thu Jul 19 01:05:33 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Wed, 18 Jul 2012 17:05:33 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? Message-ID: TL;DR: does av_seek_frame() not seek all streams to a keyframe before the requested timestamp (in either dts or pts)? That is, can I expect each stream to get a keyframe after seeking when I start decoding *before* I reach the time I requested to seek to? (in pts or dts; whatever the demuxer seeks by) Or is there a way (i.e. some flag) that will make this happen when seeking? I have a mpg container with an mpeg2video stream in it (there are also 2 ac3 audio streams, but I'm not focusing on these at the moment), and I'm trying to seek in it. Essentially, my goal is to seek to a time T (or as close to time T as possible without passing it, seeking to keyframes, and then decode myself up to time T). But when I seek, the first packet returned out of the demuxer is not a keyframe packet, and I have to read several (~45ish) packets until I encounter a keyframe. Here's some numbers, some more relevant than others: formatContext.start_time == 87673749689 formatContext.duration == 2526544311 stream.start_time == 7890637472 stream.duration == 227358632 stream.time_base == 1/90000 targetTimestamp == 87712027067 (in AV_TIME_BASE) (I've already added formatContext.start_time to it; without formatContext.start_time, the target time stamp is 38277378 (~38.2 seconds)) (in stream.time_base, this is the equivalent of 7894082436) Seeking command: av_seek_frame(formatContext, -1, targetTimestamp , AVSEEK_FLAG_BACKWARD); (returns as successful; and yes, I'm flushing my codec's buffers before seeking) The first packet retrieved after the seek belongs to the video stream, and has the following info: packet.pts == 7894091248 packet.dts == 7894082239 packet.flags == 0 The first fully decoded frame (after feeding in several frames to the decoder) has the following info: frame.pkt_pts == 7894226383 frame.pkt_dts == 7894226383 frame.best_effort_timestamp == 7894226383 As you can see, the first packet has flags == 0 (not a keyframe), and the first decoded frame and the first packet have a difference of 135135 (in pts; ~1.5 seconds) (dts difference is 144144). I've probed the file, and the closest keyframe packet that has a dts before the requested timestamp has pts == 7894037194 and dts == 7894028185. Is there some way to make sure that I seek to a keyframe that's *before* my requested timestamp instead of after (for all streams)? Thanks, Michael From stefasab at gmail.com Thu Jul 19 01:39:43 2012 From: stefasab at gmail.com (Stefano Sabatini) Date: Thu, 19 Jul 2012 01:39:43 +0200 Subject: [Libav-user] [ANNOUNCE] SOCIS 2012 - Request for students Message-ID: <20120718233943.GB3387@arborea> We're glad to announce that FFmpeg application to SOCIS (Summer Of Code In Space) has been accepted and we've been allocated a slot for a student: http://sophia.estec.esa.int/socis2012/ The selected student will be sponsored to work on one of the tasks listed on this page: http://wiki.multimedia.cx/index.php?title=FFmpeg_Summer_Of_Code_In_Space_2012 but the student is allowed to propose a different task in case he/she has a different proposal (but we can't guarantee the task qualification only in case we'll be able to couple him/her with a mentor). Students' application timeline is on Friday July 27: http://sophia.estec.esa.int/socis2012/?q=timeline If you are a student and you want to partecipate to the program, you're invited to check more information from the SOCIS web site, in particular to read the pages: - http://sophia.estec.esa.int/socis2012/?q=faq - http://sophia.estec.esa.int/socis2012/?q=tos - http://sophia.estec.esa.int/socis2012/?q=student_agreement and get in touch as soon as possible with the FFmpeg administrators (Stefano Sabatini and Michael Niedermayer) and/or with one of the mentors. Good luck! From h.leppkes at gmail.com Thu Jul 19 07:50:31 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 19 Jul 2012 07:50:31 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 1:05 AM, Michael Bradshaw < mbradshaw at sorensonmedia.com> wrote: > > Is there some way to make sure that I seek to a keyframe that's > *before* my requested timestamp instead of after (for all streams)? > > There is not, at least not with containers without an index, like mpg. Improved seeking APIs have been on the GSOC project list for years, i believe it was once started but nothing ever came of it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jul 19 08:18:54 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 19 Jul 2012 06:18:54 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: Message-ID: Michael Bradshaw writes: > But when I seek, the first packet returned out of the demuxer is > not a keyframe packet, and I have to read several (~45ish) packets > until I encounter a keyframe. Could you provide a sample that does not seek to a keyframe with ffmpeg -ss x -i input out.png (I tested this yesterday on random mpeg2video samples and afaict, it did work.) Carl Eugen From h.leppkes at gmail.com Thu Jul 19 08:25:10 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 19 Jul 2012 08:25:10 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 8:18 AM, Carl Eugen Hoyos wrote: > Michael Bradshaw writes: > > > But when I seek, the first packet returned out of the demuxer is > > not a keyframe packet, and I have to read several (~45ish) packets > > until I encounter a keyframe. > > Could you provide a sample that does not seek to a keyframe with > ffmpeg -ss x -i input out.png > (I tested this yesterday on random mpeg2video samples and afaict, > it did work.) > > This test is somewhat meaningless because it'll skip non-keyframes in the decoder until it finds one. But the idea is to ensure that you can decode as of time X, which means you need to seek to the last keyframe *before* time X, which is something that is not supported currently. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jul 19 08:31:35 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 19 Jul 2012 06:31:35 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: Message-ID: Hendrik Leppkes writes: > On Thu, Jul 19, 2012 at 8:18 AM, Carl Eugen Hoyos wrote: > Michael Bradshaw ...> writes: > > But when I seek, the first packet returned out of the demuxer is > > not a keyframe packet, and I have to read several (~45ish) packets > > until I encounter a keyframe. > > Could you provide a sample that does not seek to a keyframe with > ffmpeg -ss x -i input out.png > (I tested this yesterday on random mpeg2video samples and afaict, > it did work.) > > This test is somewhat meaningless because it'll skip > non-keyframes in the decoder until it finds one. Isn't this necessary for some codecs / at least for H264? Wouldn't the API do exactly the same? > But the idea is to ensure that you can decode as of time X, > which means you need to seek to the last keyframe *before* > time X, which is something that is not supported currently. I see. (But am I wrong to assume that this is not generally possible, assuming large GOPs?) Carl Eugen From h.leppkes at gmail.com Thu Jul 19 09:10:52 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 19 Jul 2012 09:10:52 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 8:31 AM, Carl Eugen Hoyos wrote: > > Isn't this necessary for some codecs / at least for H264? Wouldn't > the API do exactly the same? > Sure, if you end up seeking to a non-keyframe, it should not decode garbage frames. The point here is that we would want to actually end up on a proper keyframe. > > > But the idea is to ensure that you can decode as of time X, > > which means you need to seek to the last keyframe *before* > > time X, which is something that is not supported currently. > > I see. > (But am I wrong to assume that this is not generally possible, > assuming large GOPs?) > > Even a large GOP has a start somewhere. Granted seeking might take a bit longer because reading data backwards to find the keyframe is not as ideal as going forward, but it should be possible. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Jul 19 09:25:02 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 19 Jul 2012 07:25:02 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: Message-ID: Hendrik Leppkes writes: > On Thu, Jul 19, 2012 at 8:31 AM, Carl Eugen Hoyos wrote: > Isn't this necessary for some codecs / at least for H264? > Wouldn't the API do exactly the same? > > Sure, if you end up seeking to a non-keyframe, it should not > decode garbage frames. > The point here is that we would want to > actually end up on a proper keyframe. I thought that valid H264 streams do not necessarily contain key-frames. (FFmpeg is supposed to seek correctly in such files.) > > But the idea is to ensure that you can decode as of time X, > > which means you need to seek to the last keyframe *before* > > time X, which is something that is not supported currently. > I see. > (But am I wrong to assume that this is not generally possible, > assuming large GOPs?) > > Even a large GOP has a start somewhere. Granted seeking might > take a bit longer because reading data backwards to find the > keyframe is not as ideal as going forward, but it should be > possible. So if the file is ~2GB and (as a user) I seek approximately to the middle of the video and decide to seek back then, the video should be decoded from the beginning to find the keyframe before the position I want to seek to? (I am just trying to find out if I am correct in my believe that it is not generally possible / useful to seek to the latest keyframe before the requested position, but that the only realistic approach is to seek to the nearest keyframe at or later than requested.) Carl Eugen From h.leppkes at gmail.com Thu Jul 19 09:34:03 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 19 Jul 2012 09:34:03 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 9:25 AM, Carl Eugen Hoyos wrote: > So if the file is ~2GB and (as a user) I seek approximately to > the middle of the video and decide to seek back then, the > video should be decoded from the beginning to find the keyframe > before the position I want to seek to? > (I am just trying to find out if I am correct in my believe that > it is not generally possible / useful to seek to the latest > keyframe before the requested position, but that the only > realistic approach is to seek to the nearest keyframe at or later > than requested.) > You don't need to decode to find keyframes, this is what the codec parsers are meant to determine. You also don't need to start from the beginning of the file, you can jump a pre-determined amount before time X and look for a keyframe, if none is found jump back a bit more, etc. Ignoring the special case of intra-refresh H264 streams which do not have real key-frames (and maybe other formats with similar mechanics), this should work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stebbins at jetheaddev.com Thu Jul 19 10:54:35 2012 From: stebbins at jetheaddev.com (John Stebbins) Date: Thu, 19 Jul 2012 10:54:35 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: <5007CB4B.1010902@jetheaddev.com> On 07/19/2012 09:25 AM, Carl Eugen Hoyos wrote: > Hendrik Leppkes writes: > >> On Thu, Jul 19, 2012 at 8:31 AM, Carl Eugen Hoyos wrote: >> Isn't this necessary for some codecs / at least for H264? >> Wouldn't the API do exactly the same? >> >> Sure, if you end up seeking to a non-keyframe, it should not >> decode garbage frames. >> The point here is that we would want to >> actually end up on a proper keyframe. > I thought that valid H264 streams do not necessarily contain > key-frames. (FFmpeg is supposed to seek correctly in such > files.) H264 streams are not required to have IDR frames, but they are required to have recovery points. So the equivalent operation would be to seek to the recovery point where recovery pos + recovery_frames <= seek pos. You are guaranteed to have a complete frame after decoding recovery_frames (slight oversimplification). >>> But the idea is to ensure that you can decode as of time X, >>> which means you need to seek to the last keyframe *before* >>> time X, which is something that is not supported currently. >> I see. >> (But am I wrong to assume that this is not generally possible, >> assuming large GOPs?) >> >> Even a large GOP has a start somewhere. Granted seeking might >> take a bit longer because reading data backwards to find the >> keyframe is not as ideal as going forward, but it should be >> possible. > So if the file is ~2GB and (as a user) I seek approximately to > the middle of the video and decide to seek back then, the > video should be decoded from the beginning to find the keyframe > before the position I want to seek to? > (I am just trying to find out if I am correct in my believe that > it is not generally possible / useful to seek to the latest > keyframe before the requested position, but that the only > realistic approach is to seek to the nearest keyframe at or later > than requested.) I almost agree with Carl here, but I think there are alternative conclusions. The "general" case includes worst case scenarios that would result in undesirable behavior. How far before the seek point you search for a keyframe should be an application level decision. So one alternative is the application seeks to a position before the desired position and reads till it reaches the desired position. But in the "typical" case, this can be inefficient. Another alternative is libav supplies a helper function that does this for you. The API for such a helper would have a parameter to set the seek window. The advantage to libav providing a helper function for this is libav has more information than the app in many cases in the form of an index. There may be keyframes closer to the desired seek position than the window limit. libav could seek directly to the closest keyframe to the desired position through the index. The application can not do this and would always have to seek first to the outer limit of it's desired window and then read from that point onward. John From drabner at zoobe.com Thu Jul 19 12:22:31 2012 From: drabner at zoobe.com (Drabner) Date: Thu, 19 Jul 2012 03:22:31 -0700 (PDT) Subject: [Libav-user] c++ API h264 encoded video does not play on all platforms In-Reply-To: <1342603216144-4655422.post@n4.nabble.com> References: <1342603216144-4655422.post@n4.nabble.com> Message-ID: <1342693351576-4655440.post@n4.nabble.com> I found (and posted) the solution to this: http://stackoverflow.com/questions/11537830/ffmpeg-api-h264-encoded-video-does-not-play-on-all-platforms/11558127#11558127 -- View this message in context: http://libav-users.943685.n4.nabble.com/c-API-h264-encoded-video-does-not-play-on-all-platforms-tp4655422p4655440.html Sent from the libav-users mailing list archive at Nabble.com. From mbradshaw at sorensonmedia.com Thu Jul 19 19:13:31 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 19 Jul 2012 11:13:31 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 12:18 AM, Carl Eugen Hoyos wrote: > Michael Bradshaw writes: > >> But when I seek, the first packet returned out of the demuxer is >> not a keyframe packet, and I have to read several (~45ish) packets >> until I encounter a keyframe. > > Could you provide a sample that does not seek to a keyframe with > ffmpeg -ss x -i input out.png > (I tested this yesterday on random mpeg2video samples and afaict, > it did work.) Sure, here's a link to a sample video I'm testing with (sorry, it's 785 MB): https://doc-04-50-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/t0csnri6mmjsd3mqbnb8qdv7b1tiq1e8/1342713600000/11977383638970716307/*/0BxWx_dIBnyRoZDNDeDVud3NNcEE?e=download I modified ffmpeg.c to print out where it sought to and the packet flags whenever av_read_frame() is done (those are the only changes I made). Here's the complete output. Notice that "packet.flags:0 [...] Last message repeated 53 times" before a keyframe is found. This is the latest ffmpeg (updated and built last night), testing on Windows with MinGW shell: $ ./ffmpeg.exe -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg ffmpeg version 0.11.1.git Copyright (c) 2000-2012 the FFmpeg developers built on Jul 18 2012 18:11:46 with gcc 4.6.2 configuration: libavutil 51. 65.100 / 51. 65.100 libavcodec 54. 41.100 / 54. 41.100 libavformat 54. 17.100 / 54. 17.100 libavdevice 54. 1.100 / 54. 1.100 libavfilter 3. 2.100 / 3. 2.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 [mpegts @ 0162c3c0] max_analyze_duration 5000000 reached at 5005000 [mpegts @ 0162c3c0] PES packet size mismatch Last message repeated 6 times sought to position 87711.750 Input #0, mpegts, from '704x480-m2v-ac3.mpg': Duration: 00:42:06.54, start: 87673.749689, bitrate: 2607 kb/s Program 1 Stream #0:0[0x41]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p, 704x480 [SAR 40:33 DAR 16:9], 15000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:1[0x44](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 192 kb/s Stream #0:2[0x45](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, s16, 192 kb/s Output #0, image2, to 'out.jpg': Metadata: encoder : Lavf54.17.100 Stream #0:0: Video: mjpeg, yuvj420p, 704x480 [SAR 40:33 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc Stream mapping: Stream #0:0 -> #0:0 (mpeg2video -> mjpeg) Press [q] to stop, [?] for help packet.flags:0 Last message repeated 53 times packet.flags:1 packet.flags:0 Last message repeated 2 times frame= 1 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.03 bitrate= 0.0kbits/s dup=0 drop=1 video:32kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000% Thanks, Michael From mbradshaw at sorensonmedia.com Thu Jul 19 19:20:23 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 19 Jul 2012 11:20:23 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: <5007CB4B.1010902@jetheaddev.com> References: <5007CB4B.1010902@jetheaddev.com> Message-ID: On Thu, Jul 19, 2012 at 2:54 AM, John Stebbins wrote: > Another alternative is libav supplies a helper function that does this for > you. The API for such a helper would have a parameter to set the seek > window. The advantage to libav providing a helper function for this is > libav has more information than the app in many cases in the form of an > index. There may be keyframes closer to the desired seek position than the > window limit. libav could seek directly to the closest keyframe to the > desired position through the index. The application can not do this and > would always have to seek first to the outer limit of it's desired window > and then read from that point onward. I think a function along those lines would be incredibly useful. --Michael From harrison.declan at gmail.com Mon Jul 16 18:29:06 2012 From: harrison.declan at gmail.com (declan harrison) Date: Mon, 16 Jul 2012 17:29:06 +0100 Subject: [Libav-user] How do I specify a bitstream filter using the ffmpeg API Message-ID: Hi Guys I have a problem creating MPEG2-TS files when using the ffmpeg API. I get the following error thrown by ffmpeg "H.264 bitstream malformed, no startcode found, use the h264_mp4toannexb bitstream filter (-bsf h264_mp4toannexb)". On the CLI interface I can easily specify the bitstream filter using the following : ffmpeg -i INFILE.mp4 -f mpegts -codec copy -bsf:v h264_mp4toannexb OUTFILE.ts, and this works well for me on the command line only. However I cant find away to set the "bsf:v" using the API as this option isnt a libav* option that can be passed in via the API. Is there a way of specify a bitstream filter from the API. Im running RHEL 6.2, Im using the latest version of ffmpeg libavutil 51. 42.100 / 51. 42.100 libavcodec 54. 10.100 / 54. 10.100 libavformat 54. 2.100 / 54. 2.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 64.101 / 2. 64.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 7.100 / 0. 7.100 libpostproc 52. 0.100 / 52. 0.100 Thanks From phiencoltech at gmail.com Mon Jul 16 10:15:29 2012 From: phiencoltech at gmail.com (phienkaka) Date: Mon, 16 Jul 2012 01:15:29 -0700 (PDT) Subject: [Libav-user] Using libav without command line? Message-ID: <1342426529729-4655410.post@n4.nabble.com> Hi everyone! I using this command bellow for converting file "./avconv -i inputFile -vcodec libx264 -trellis 2 -crf 23 -tune psnr -vf crop='trunc(iw/2)*2:trunc(ih/2)*2' -y outputFile" But, I don't want to using this command, I want to make a function like convert(char *inputFile, char *outputFile). (The option of my function like option in command line) And then I will call it from my main function for example int main(){ convert(in01, out01); convert(in02, out02); convert(in03, out03); return 0; } Could anyone tell me how to solve this problem? I have google many time but do not find the solution. Thank you so much. -- View this message in context: http://libav-users.943685.n4.nabble.com/Using-libav-without-command-line-tp4655410.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Jul 19 20:42:50 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 19 Jul 2012 18:42:50 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: Message-ID: Michael Bradshaw writes: > >> But when I seek, the first packet returned out of the demuxer is > >> not a keyframe packet, and I have to read several (~45ish) packets > >> until I encounter a keyframe. > > > > Could you provide a sample that does not seek to a keyframe with > > ffmpeg -ss x -i input out.png > > (I tested this yesterday on random mpeg2video samples and afaict, > > it did work.) > > Sure, here's a link to a sample video I'm testing with Thank you! I tested the following (while still downloading): ffmpeg -ss x -i 704x480-m2v-ac3.mpg.part out.png I tested many values for x and always received a recognisable frame. That does afaict mean that seeking only reaches keyframes for this stream, because if you test with older (or known broken) versions of FFmpeg you will get grey frames (as you do for mpeg4 asp content). Please note that the current behaviour (while iiuc it is what you ask for and many users asked for before) is not uncontroversial amongst FFmpeg developers: Afair, Reimar believes the seek function should not try hard to find a keyframe because seeking faster is more important. I honestly cannot comment on the flags-value, I can only confirm that FFmpeg only seeks to keyframes for your sample here. Carl Eugen From donmoir at comcast.net Thu Jul 19 21:16:34 2012 From: donmoir at comcast.net (Don Moir) Date: Thu, 19 Jul 2012 15:16:34 -0400 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? References: Message-ID: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> ----- Original Message ----- From: "Michael Bradshaw" To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." Sent: Thursday, July 19, 2012 1:13 PM Subject: Re: [Libav-user] Why does av_seek_frame() not seek to a keyframe? > On Thu, Jul 19, 2012 at 12:18 AM, Carl Eugen Hoyos > wrote: >> Michael Bradshaw writes: >> >>> But when I seek, the first packet returned out of the demuxer is >>> not a keyframe packet, and I have to read several (~45ish) packets >>> until I encounter a keyframe. >> >> Could you provide a sample that does not seek to a keyframe with >> ffmpeg -ss x -i input out.png >> (I tested this yesterday on random mpeg2video samples and afaict, >> it did work.) > > Sure, here's a link to a sample video I'm testing with (sorry, it's > 785 MB): > https://doc-04-50-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/t0csnri6mmjsd3mqbnb8qdv7b1tiq1e8/1342713600000/11977383638970716307/*/0BxWx_dIBnyRoZDNDeDVud3NNcEE?e=download > I did some visual inspection seeking here and there with my own app and the above file does not seem to be a problem. When I get a chance I will look at the numbers to check the accuracy. Just doing the visual inspection may not be enough. From mbradshaw at sorensonmedia.com Thu Jul 19 21:47:29 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 19 Jul 2012 13:47:29 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 12:42 PM, Carl Eugen Hoyos wrote: > [...] > Afair, Reimar believes the seek function should not try hard to find > a keyframe because seeking faster is more important. I think the current functionality is OK, provided it's documented well. Though to be honest I'd like an a flag/function that provided additional seeking ability, but like Hendrik said that's been an unfinished GSOC project for awhile so I'm not expecting it anytime soon. > I honestly cannot comment on the flags-value, I can only confirm > that FFmpeg only seeks to keyframes for your sample here. What's the expected behavior of avcodec_decode_video2() and seeking? I understand that things like P and B frames require lavc to do some frame buffering, but if ffmpeg seeks to a keyframe, can I expect the first call to avcodec_decode_video2() to return a fully decoded frame? (and then after that possibly make several calls before getting a full frame out if there are P or B frames after this keyframe) The first 54 packets out of av_read_frame() have .flags=0 (checked with -dump and -loglevel debug). Could they be wrong if ffmpeg is indeed seeking to a keyframe? Visually, things look ok (aside from the frame being ~1.5 seconds after the requested time), but I think that's because ffmpeg just keeps reading and decoding until it gets a full frame out, and it won't do that until it hits a keyframe, and that it's disguising the fact that it's not seeking to a keyframe (or maybe that a packet's .flags value is lying). But I could be misunderstanding something. Thanks, Michael From h.leppkes at gmail.com Thu Jul 19 21:54:56 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Thu, 19 Jul 2012 21:54:56 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 9:47 PM, Michael Bradshaw < mbradshaw at sorensonmedia.com> wrote: > > > Visually, things look ok (aside from the frame being ~1.5 seconds > after the requested time), but I think that's because ffmpeg just > keeps reading and decoding until it gets a full frame out, and it > won't do that until it hits a keyframe, and that it's disguising the > fact that it's not seeking to a keyframe (or maybe that a packet's > .flags value is lying). But I could be misunderstanding something. > > Thats the whole problem here. The seek code is horrible, and the decoders have to pick up the slack and ensure they only recover from a keyframe. Sadly people around here will usually say "but it works when i use the ffmpeg application", but thats not the only place avformat and avcodec are used. :p If you want to do accurate seeks with only avformat, you have to add a lot of boilerplate on top of it right now - or if you want to do accurate seeks even with ffmpeg. Sure, if you tell it to seek, it'll output an image, but it won't be the image at the time you specified, it'll very likely be at a later point in time. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mbradshaw at sorensonmedia.com Thu Jul 19 22:01:55 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 19 Jul 2012 14:01:55 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: On Thu, Jul 19, 2012 at 1:16 PM, Don Moir wrote: >[...] > I did some visual inspection seeking here and there with my own app and the > above file does not seem to be a problem. When I get a chance I will look at > the numbers to check the accuracy. Just doing the visual inspection may not > be enough. I guess we should define what would be considered "erroneous" seeking to make sure I'm on the same page as everyone, as it's possible I'm not. Would these be considered "problematic:" 1) Seek is performed, first packet out of av_read_frame() has .flags=0 (meaning not a keyframe) 2) Seek is performed, avcodec_decode_video2() must be fed several packets (57 in my test with ffmpeg command line, with #55 being the only one with .flags=1 (keyframe)) before it gets a full frame out I think those are the primary points that I want to make sure I'm expecting the right behavior on. Thanks, Michael From mbradshaw at sorensonmedia.com Thu Jul 19 22:11:08 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Thu, 19 Jul 2012 14:11:08 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: Message-ID: On Thu, Jul 19, 2012 at 1:54 PM, Hendrik Leppkes wrote: >[...] > If you want to do accurate seeks with only avformat, you have to add a lot > of boilerplate on top of it right now - or if you want to do accurate seeks > even with ffmpeg. Sure, if you tell it to seek, it'll output an image, but > it won't be the image at the time you specified, it'll very likely be at a > later point in time. It's a bit ugly, yeah. I talked a bit about some seeking issues once and Michael Neidermayer put a AVFMT_SEEK_TO_PTS flag for the demuxers so they can denote whether they seek by PTS or DTS, but to be honest I don't think all the relevant demuxers have it set (nut is the only one I know that has it set that seeks by PTS). Since seeking is done by DTS for most demuxers, yes, lavf users have to use some extra boilerplate code to seek accurately by PTS (probably in the form of multiple seeks where they step back if they've sought too far). It's not very pretty, but I don't think accurate seeking can be done in lavf without seeking being done by PTS, but I think Reimar or someone mentioned that may not be possible in some formats/files. I don't know exactly what can be done about it though... --Michael From noahzarc at hotmail.co.uk Fri Jul 20 21:14:28 2012 From: noahzarc at hotmail.co.uk (noahzarc) Date: Fri, 20 Jul 2012 12:14:28 -0700 (PDT) Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: References: Message-ID: <1342811668937-4655450.post@n4.nabble.com> Hey thanks for your solution! Unfortunately this did not work as for some reason av_opt_set doesn't behave like a global function, as in even if I include the opt.h header file I still get an error saying "'av_opt_set': identifier not found". My project is built under VS2005, and I've cross compiled ffmpeg with MinGW. Are there any other ways to set crf in priv_data? Thanks & cheers Aleksey Shubin wrote > > Hi Noah, > > char *crfString = new char[50]; > sprintf_s(crfString, 50, "%f", crf); > av_opt_set(codecContext->priv_data, "crf", crfString, 0); > > Don't sure if it is the best way (to convert to string first) but I > didn't find a variant of av_opt_set for floating point values, and at > least it works. > > 2012/7/12 Noah Arc <noahzarc at .co>: >> Hi all; >> >> I've just switched to the newer ffmpeg versions (I always used ffmpeg >> 0.6), >> it is a big jump for me and I'm trying to figure out how to implement >> some >> of the changes. >> >> In the past, libx264 variables such as crf was a part of AVCodecContext. >> However, looks like in version 0.11 it has been deprecated and was moved >> to >> libx264.c as a private variable. But for my project, I'm used to just >> assign >> a value to crf (of a ptr of type AVCodecContext). Could someone please >> give >> me a hint on how I could implement the API changes? >> >> Thank you very much! >> Cheers >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user@ >> http://ffmpeg.org/mailman/listinfo/libav-user >> > _______________________________________________ > Libav-user mailing list > Libav-user@ > http://ffmpeg.org/mailman/listinfo/libav-user > -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Using-LibX264-with-ffmpeg-libraries-tp4655395p4655450.html Sent from the libav-users mailing list archive at Nabble.com. From nicolas.george at normalesup.org Fri Jul 20 22:58:57 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Fri, 20 Jul 2012 22:58:57 +0200 Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: References: Message-ID: <20120720205857.GA6985@phare.normalesup.org> Le quartidi 24 messidor, an CCXX, Noah Arc a ?crit?: > In the past, libx264 variables such as crf was a part of AVCodecContext. > However, looks like in version 0.11 it has been deprecated and was moved > to libx264.c as a private variable. But for my project, I'm used to just > assign a value to crf (of a ptr of type AVCodecContext). Could someone > please give me a hint on how I could implement the API changes? You are supposed to pass the options as the third argument to avcodec_open2. There is an example in the documentation of the function. Please refrain from top-posting on this mailing list; and if you did not understand what it means, look it up. 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 donmoir at comcast.net Fri Jul 20 23:35:39 2012 From: donmoir at comcast.net (Don Moir) Date: Fri, 20 Jul 2012 17:35:39 -0400 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? References: Message-ID: <201E7F3F55124AF982908158B3D584D0@MANLAP> > Afair, Reimar believes the seek function should not try hard to find > a keyframe because seeking faster is more important. This most important thing is consistency. In my case (and anyone really), that means when I do a seek, the first returned packet should be a key frame packet and the time of that packet should be less than or equal to my requested seek time. Testing with the sample provided by Michael Bradshaw at (785mb): https://doc-04-50-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/t0csnri6mmjsd3mqbnb8qdv7b1tiq1e8/1342713600000/11977383638970716307/*/0BxWx_dIBnyRoZDNDeDVud3NNcEE?e=download So as Michael and others have stated, seeking on the above file seeks to a non key packet and so there can be a pause before the next frame can be displayed. The following is sort if generalized to make it simpler and assumes you know packet times, display times, and how they relate to your requested seek time. 1) The first thing is to determine is when it going to be a problem. (for what codecs) 2) The next thing would be how far back in time to you have to go to guarantee you are going to get a key packet who's time is less than what you requested. The how far back number seems to be guess work but there may be a way to get an accurate number. 3) after the seek, read and store packets up to your requested seek time (don't decode). Flush the stored packets whenever you hit a key packet. 4) When you are finished reading and storing your packets and if your packet queue contains more than one packet, read the queue and decode packet until you have 1 packet left in queue. For the above file I subtracted 2 seconds from my requested seek time. The main thing is don't start decoding until you know you have the key packet that is closest to your requested time. Reading the extra packets as long as they are not decoded does not impact things very much. The seek is now dead on and quick for the above file. The main unknown is how far back in time you have to go to gaurantee success on a general basis. The above was easy enough for me to do (outside of unknown subtract time) but of course we should not have to do it. The nature of my projects means I need to be as accurate as possible. We all want accuracy but if I don't at lease make it happen to the best of my ability I will get complaints quickly. From jettoblack at gmail.com Sat Jul 21 00:25:47 2012 From: jettoblack at gmail.com (jettoblack) Date: Fri, 20 Jul 2012 15:25:47 -0700 (PDT) Subject: [Libav-user] Setting libx264 bitrate via API Message-ID: <1342823147934-4655453.post@n4.nabble.com> Hello, I'm trying to do the equivalent of this via the API: ffmpeg -i test.m2t -c:v libx264 -b:v 500000 -s 640x360 -ac 2 test.mov This gives a ABR file at 500kbits/sec. I thought setting the video bitrate should be as simple as: out_vcodec->bit_rate = 500000; When using CODEC_ID_MPEG2VIDEO or CODEC_ID_MPEG4, this works fine, and the resulting file has the specified ABR. However with libx264 (CODEC_ID_H264) the bitrate parameter seems to have no effect, even very small values like 50,000 or very large like 50,000,000 (for a 640x360 video) give the same output of around 200kbits/sec. The input video is not a static picture and it's not like 200kbit/sec is giving a lossless result and more bits are unnecessary. I also tried: out_vcodec->bit_rate = 500000; out_vcodec->rc_min_rate = 500000; out_vcodec->rc_max_rate = 500000; out_vcodec->rc_buffer_size = 500000; But still, there is no change in the output bitrate no matter what values I put. So I suspect these values are getting ignored or I'm not passing them into the codec correctly. The only parameter that actually affects the libx264 output bitrate is setting out_vcodec->qmin and out_vcodec->qmax. By playing with qmin and qmax I can at least affect the bitrate, but it doesn't give a predictable ABR or CBR result. Any ideas? Thanks! I initialize the codec like this: AVCodec *vcodec = avcodec_find_encoder(CODEC_ID_H264); // or CODEC_ID_MPEG2VIDEO, etc. AVCodecContext *out_vcodec = avcodec_alloc_context3(vcodec); avcodec_get_context_defaults3(out_vcodec, vcodec); if (vcodec->id == CODEC_ID_H264) { av_opt_set(out_vcodec->priv_data, "profile", "main", 0); } out_vcodec->bit_rate = 500000; out_vcodec->width = 640; out_vcodec->height = 360; out_vcodec->pix_fmt = PIX_FMT_YUV420P; r = avcodec_open2(out_vcodec, vcodec, NULL); Thanks! -- View this message in context: http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-tp4655453.html Sent from the libav-users mailing list archive at Nabble.com. From maxslomoff at gmail.com Sat Jul 21 19:14:36 2012 From: maxslomoff at gmail.com (max slomoff) Date: Sat, 21 Jul 2012 10:14:36 -0700 Subject: [Libav-user] ffmpeg programming job Message-ID: <75793BD3-8EF9-4CA2-BECD-6D6498BC2869@gmail.com> hello, i would like to offer a job: i am looking for a programmer with skills in ffmpeg and sdi video signals i have 5k to get started got some free time this summer? please respond with a little about your background. thanks max maxslomoff at google mail -------------- next part -------------- An HTML attachment was scrubbed... URL: From info at denisgottardello.it Sun Jul 22 09:26:01 2012 From: info at denisgottardello.it (Denis) Date: Sun, 22 Jul 2012 09:26:01 +0200 Subject: [Libav-user] ffmpeg programming job In-Reply-To: <75793BD3-8EF9-4CA2-BECD-6D6498BC2869@gmail.com> References: <75793BD3-8EF9-4CA2-BECD-6D6498BC2869@gmail.com> Message-ID: <201207220926.01681.info@denisgottardello.it> In data sabato 21 luglio 2012 19:14:36, max slomoff ha scritto: > hello, > i would like to offer a job: > i am looking for a programmer with skills in ffmpeg and sdi video signals > i have 5k to get started > got some free time this summer? > please respond with a little about your background. Great! What do you must do with ffmpeg? I have experience with ffmpeg - qt - opencv. -- www.denisgottardello.it Skype: mrdebug Videosurveillance and home automation! http://www.denisgottardello.it/DomusBoss/DomusBossIndice.php From drodrigues at wit-software.com Sun Jul 22 15:01:02 2012 From: drodrigues at wit-software.com (David Rodrigues) Date: Sun, 22 Jul 2012 14:01:02 +0100 Subject: [Libav-user] MOV and custom IO Message-ID: <0181269B-1567-4190-AFCB-62C5AFFB454B@wit-software.com> Hi everyone. I've written some code to change the video container from MOV to MPEG-TS using ffmpeg API successfully. I'm using physical files. Now i have to change my input from file to custom IO. I changed the code for use custom IO with a callback (read_packet_callback) to feed ffmpeg. fmtCtx = avformat_alloc_context(); iformat = av_find_input_format(input_fmt); ibuffer = (unsigned char *) av_malloc(BUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) fmtCtx->pb = avio_alloc_context(ibuffer, BUF_SIZE, 0, read_context, read_packet_callback, NULL, NULL); avformat_open_input(&fmtCtx, "in-memory", iformat, NULL) When i run the code the function avformat_open_input blocks, it reads N chunks of data but don't terminate with or without error. This happens with MOV format. I've tried using MPEG-TS format and this code runs successfully. There's a special trick for MOV format? Has anyone encountered this problem? Thanks! David Rodrigues -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sun Jul 22 15:19:09 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 22 Jul 2012 13:19:09 +0000 (UTC) Subject: [Libav-user] MOV and custom IO References: <0181269B-1567-4190-AFCB-62C5AFFB454B@wit-software.com> Message-ID: David Rodrigues writes: > When i run the code the function avformat_open_input blocks, it > reads N chunks of data but don't terminate with or without error. > This happens with MOV format. I've tried using MPEG-TS format and > this code runs successfully. This may be irrelevant but does your costum protocol support seeking? I suspect this is needed to read mov files (but not for mpeg-ts). Carl Eugen From mbradshaw at sorensonmedia.com Sun Jul 22 17:55:19 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Sun, 22 Jul 2012 09:55:19 -0600 Subject: [Libav-user] ffmpeg programming job In-Reply-To: <75793BD3-8EF9-4CA2-BECD-6D6498BC2869@gmail.com> References: <75793BD3-8EF9-4CA2-BECD-6D6498BC2869@gmail.com> Message-ID: On Sat, Jul 21, 2012 at 11:14 AM, max slomoff wrote: > hello, > i would like to offer a job: > i am looking for a programmer with skills in ffmpeg and sdi video signals > i have 5k to get started > got some free time this summer? > please respond with a little about your background. For what it's worth, there's a consulting page on ffmpeg.org at http://ffmpeg.org/consulting.html It's probably best if you send this to the ffmpeg-devel mailing list, as that's where you're more likely to reach ffmpeg and video professionals. In any case, good luck with your project. --Michael From david.ndh at gmail.com Sun Jul 22 14:22:31 2012 From: david.ndh at gmail.com (David Rodrigues) Date: Sun, 22 Jul 2012 13:22:31 +0100 Subject: [Libav-user] MOV and custom IO Message-ID: Hi everyone. I've written some code to change the video container from MOV to MPEG-TS using ffmpeg API successfully. I'm using physical files. Now i have to change my input from file to custom IO. I changed the code for use custom IO with a callback (read_packet_callback) to feed ffmpeg. fmtCtx = avformat_alloc_context(); iformat = av_find_input_format(input_fmt); ibuffer = (unsigned char *) av_malloc(BUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) fmtCtx->pb = avio_alloc_context(ibuffer, BUF_SIZE, 0, read_context, read_packet_callback, NULL, NULL); avformat_open_input(&fmtCtx, "in-memory", iformat, NULL) When i run the code the function avformat_open_input blocks, it reads N chunks of data but don't terminate with or without error. This happens with MOV format. I've tried using MPEG-TS format and this code runs successfully. There's a special trick for MOV format? Has anyone encountered this problem? Thanks! David Rodrigues -------------- next part -------------- An HTML attachment was scrubbed... URL: From drodrigues at wit-software.com Sun Jul 22 22:14:49 2012 From: drodrigues at wit-software.com (David Rodrigues) Date: Sun, 22 Jul 2012 21:14:49 +0100 Subject: [Libav-user] MOV and custom IO In-Reply-To: References: <0181269B-1567-4190-AFCB-62C5AFFB454B@wit-software.com> Message-ID: <1AD12F35-1F80-4895-AB85-F3ECE2A97563@wit-software.com> Thanks! The problem was on seeking, you are absolutely right MOV files require this capability. David Rodrigues A 22/07/2012, ?s 14:19, Carl Eugen Hoyos escreveu: > David Rodrigues writes: > >> When i run the code the function avformat_open_input blocks, it >> reads N chunks of data but don't terminate with or without error. >> This happens with MOV format. I've tried using MPEG-TS format and >> this code runs successfully. > > This may be irrelevant but does your costum protocol support seeking? > I suspect this is needed to read mov files (but not for mpeg-ts). > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user From rakesh-sg at hcl.com Mon Jul 23 08:17:11 2012 From: rakesh-sg at hcl.com (Rakesh Shivayya Guttedar -ERS, HCL Tech) Date: Mon, 23 Jul 2012 11:47:11 +0530 Subject: [Libav-user] Setting libx264 bitrate via API In-Reply-To: <1342823147934-4655453.post@n4.nabble.com> References: <1342823147934-4655453.post@n4.nabble.com> Message-ID: <0BD925121A830C4DACF7FF9213266ACAB3A981CCB4@CHN-HCLT-EVS09.HCLT.CORP.HCL.IN> Hi, I am also facing a similar issue. When I set the bit rate using out_vcodec->bit_rate = 200000; the quality of the video goes very bad. But when I set qmin and qmax, the bitrate setting is ignored. Only when i set a high value (approx 100MB) for the bit rate, the quality of the video improves. I think there is some bug in ffmpeg or I might be missing something. Can anyone tell whats the problem? Thanks -----Original Message----- From: libav-user-bounces at ffmpeg.org [mailto:libav-user-bounces at ffmpeg.org] On Behalf Of jettoblack Sent: Saturday, July 21, 2012 3:56 AM To: libav-user at ffmpeg.org Subject: [Libav-user] Setting libx264 bitrate via API Hello, I'm trying to do the equivalent of this via the API: ffmpeg -i test.m2t -c:v libx264 -b:v 500000 -s 640x360 -ac 2 test.mov This gives a ABR file at 500kbits/sec. I thought setting the video bitrate should be as simple as: out_vcodec->bit_rate = 500000; When using CODEC_ID_MPEG2VIDEO or CODEC_ID_MPEG4, this works fine, and the resulting file has the specified ABR. However with libx264 (CODEC_ID_H264) the bitrate parameter seems to have no effect, even very small values like 50,000 or very large like 50,000,000 (for a 640x360 video) give the same output of around 200kbits/sec. The input video is not a static picture and it's not like 200kbit/sec is giving a lossless result and more bits are unnecessary. I also tried: out_vcodec->bit_rate = 500000; out_vcodec->rc_min_rate = 500000; out_vcodec->rc_max_rate = 500000; out_vcodec->rc_buffer_size = 500000; But still, there is no change in the output bitrate no matter what values I put. So I suspect these values are getting ignored or I'm not passing them into the codec correctly. The only parameter that actually affects the libx264 output bitrate is setting out_vcodec->qmin and out_vcodec->qmax. By playing with qmin and qmax I can at least affect the bitrate, but it doesn't give a predictable ABR or CBR result. Any ideas? Thanks! I initialize the codec like this: AVCodec *vcodec = avcodec_find_encoder(CODEC_ID_H264); // or CODEC_ID_MPEG2VIDEO, etc. AVCodecContext *out_vcodec = avcodec_alloc_context3(vcodec); avcodec_get_context_defaults3(out_vcodec, vcodec); if (vcodec->id == CODEC_ID_H264) { av_opt_set(out_vcodec->priv_data, "profile", "main", 0); } out_vcodec->bit_rate = 500000; out_vcodec->width = 640; out_vcodec->height = 360; out_vcodec->pix_fmt = PIX_FMT_YUV420P; r = avcodec_open2(out_vcodec, vcodec, NULL); Thanks! -- View this message in context: http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-tp4655453.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 ::DISCLAIMER:: ---------------------------------------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of authorized representative of HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. Before opening any email and/or attachments, please check them for viruses and other defects. ---------------------------------------------------------------------------------------------------------------------------------------------------- From Steffen.Roeber at hella.com Mon Jul 23 08:18:03 2012 From: Steffen.Roeber at hella.com (Steffen.Roeber at hella.com) Date: Mon, 23 Jul 2012 08:18:03 +0200 Subject: [Libav-user] bit rate control Message-ID: Hi, I'm newbie in mpeg coding. Can anybody explain the relationship between the rc_max_rate and the rc_buffer_size. Both change the output file size and bit rate. Hella Aglaia Mobile Vision GmbH Steffen Roeber Firmware & Tools Treskowstr. 14, D-13089 Berlin Amtsgericht Berlin-Charlottenburg HRB 66976 B Gesch?ftsf?hrer: Kay Talmi Fon: +49 30 200 04 29? 412 Fax: +49 30 200 04 29? 109 Mail: Steffen.Roeber at hella.com URL: www.aglaia-gmbh.de URL: www.mobilevision.de Dieses Dokument ist vertraulich zu behandeln. Die Weitergabe sowie Vervielf?ltigung, Verwertung und Mitteilung seines Inhalts ist nur mit unserer ausdr?cklichen Genehmigung gestattet. Alle Rechte vorbehalten, insbesondere f?r den Fall der Schutzrechtsanmeldung. This document has to be treated confidentially. Its contents are not to be passed on, duplicated, exploited or disclosed without our express permission. All rights reserved, especially the right to apply for protective rights. -------------- next part -------------- An HTML attachment was scrubbed... URL: From Steffen.Roeber at hella.com Mon Jul 23 08:18:29 2012 From: Steffen.Roeber at hella.com (Steffen.Roeber at hella.com) Date: Mon, 23 Jul 2012 08:18:29 +0200 Subject: [Libav-user] avcodec_encode_video2 Message-ID: Hi, tried using the avcodec_encode_video2 function. my problem is thhat if I call this function once per frame, the video has a small bitrate and looks bad. If I call this function twice AVCodecContext *c;... c->me_method = ME_EPZS; c->width = img->getWidth(); c->height = img->getHeight(); c->time_base.num = 1; c->time_base.den = 25; c->gop_size = 10; c->max_b_frames = 1; c->pix_fmt = PIX_FMT_YUV420P; c->rc_max_rate = 750000; c->rc_buffer_size = 3000000; c->refs = 1; c->coder_type = FF_CODER_TYPE_VLC; .... avcodec_encode_video2(c, &avpkt, picture, &outbufMaxSize); //outbufMaxSize == 0 avcodec_encode_video2(c, &avpkt, nullptr, &outbufMaxSize); // outbufMaxSize == 1 ++picture->pts; then the video looks as expected. What goes wrong? Hella Aglaia Mobile Vision GmbH Steffen Roeber Firmware & Tools Treskowstr. 14, D-13089 Berlin Amtsgericht Berlin-Charlottenburg HRB 66976 B Gesch?ftsf?hrer: Kay Talmi Fon: +49 30 200 04 29? 412 Fax: +49 30 200 04 29? 109 Mail: Steffen.Roeber at hella.com URL: www.aglaia-gmbh.de URL: www.mobilevision.de Dieses Dokument ist vertraulich zu behandeln. Die Weitergabe sowie Vervielf?ltigung, Verwertung und Mitteilung seines Inhalts ist nur mit unserer ausdr?cklichen Genehmigung gestattet. Alle Rechte vorbehalten, insbesondere f?r den Fall der Schutzrechtsanmeldung. This document has to be treated confidentially. Its contents are not to be passed on, duplicated, exploited or disclosed without our express permission. All rights reserved, especially the right to apply for protective rights. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jul 23 08:50:34 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Jul 2012 06:50:34 +0000 (UTC) Subject: [Libav-user] bit rate control References: Message-ID: writes: > I'm newbie in mpeg coding. Can anybody explain the > relationship between the rc_max_rate and the rc_buffer_size. > Both change the output file size and bit rate. Didn't Michael already answered this question? http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/148128/focus=148149 Carl Eugen From drabner at zoobe.com Mon Jul 23 11:36:15 2012 From: drabner at zoobe.com (Drabner) Date: Mon, 23 Jul 2012 02:36:15 -0700 (PDT) Subject: [Libav-user] sws_scale screws up last pixel row in smaller x264 mp4 encoding Message-ID: <1343036175410-4655465.post@n4.nabble.com> Hey there, When using the C API of ffmpeg, and encoding input image frames to an mp4 video, everything works well when the resolution is 640x360. But with 320x180 input and output, the output image's last pixel row is screwed up. This happens after the sws_scale, so the error must be somewhere around there. See the original stackoverflow question for the code and two example pictures: http://stackoverflow.com/questions/11580559/sws-scale-screws-up-last-pixel-row-in-smaller-x264-mp4-encoding Could it be that is actually a bug in the libraries and not an error on my side? -- View this message in context: http://libav-users.943685.n4.nabble.com/sws-scale-screws-up-last-pixel-row-in-smaller-x264-mp4-encoding-tp4655465.html Sent from the libav-users mailing list archive at Nabble.com. From krueger at lesspain.de Mon Jul 23 15:15:42 2012 From: krueger at lesspain.de (=?UTF-8?Q?Robert_Kr=C3=BCger?=) Date: Mon, 23 Jul 2012 15:15:42 +0200 Subject: [Libav-user] sws_setColorspaceDetails parameters for colorspace conversions In-Reply-To: <20120718193055.GA490@kiste2> References: <20120718193055.GA490@kiste2> Message-ID: On Wed, Jul 18, 2012 at 9:30 PM, Michael Niedermayer wrote: > On Sun, Jul 08, 2012 at 01:04:17PM +0200, Robert Kr?ger wrote: >> Hi, >> >> I'm trying to do a colorspace conversion using libswscale. The >> documentation for sws_setColorspaceDetails doesn't have all params >> documented: > > added docs for the rest, but note converting between different types > of YUV material is not fully implemented (patches welcome for that ...) > just the API exists since a long time to specify such convertions > great, thank you! Should I run into a combination that does not work and we need, would it be OK to just post this as a trac issue and specify a bounty? From mbradshaw at sorensonmedia.com Mon Jul 23 18:49:50 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Mon, 23 Jul 2012 10:49:50 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: On Thu, Jul 19, 2012 at 2:01 PM, Michael Bradshaw wrote: > [...] > I guess we should define what would be considered "erroneous" seeking > to make sure I'm on the same page as everyone, as it's possible I'm > not. Would these be considered "problematic:" > > 1) Seek is performed, first packet out of av_read_frame() has .flags=0 > (meaning not a keyframe) > 2) Seek is performed, avcodec_decode_video2() must be fed several > packets (57 in my test with ffmpeg command line, with #55 being the > only one with .flags=1 (keyframe)) before it gets a full frame out Anyone have any answers on these two things? If the answer to the above would be "yes" can anyone else verify that "ffmpeg -dump -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does not seek to a keyframe? Thanks, Michel From cehoyos at ag.or.at Mon Jul 23 19:12:34 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Jul 2012 17:12:34 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: Michael Bradshaw writes: > Anyone have any answers on these two things? If the answer to the > above would be "yes" can anyone else verify that "ffmpeg -dump > -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does > not seek to a keyframe? As said, afaict it does seek to a keyframe. (But I may of course be wrong.) Carl Eugen From mbradshaw at sorensonmedia.com Mon Jul 23 19:29:04 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Mon, 23 Jul 2012 11:29:04 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: On Mon, Jul 23, 2012 at 11:12 AM, Carl Eugen Hoyos wrote: > Michael Bradshaw writes: > >> Anyone have any answers on these two things? If the answer to the >> above would be "yes" can anyone else verify that "ffmpeg -dump >> -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does >> not seek to a keyframe? > > As said, afaict it does seek to a keyframe. > (But I may of course be wrong.) Yes, and thanks for your help and sorry to keep bugging, but no one's answered these questions: Would these be considered "problematic:" 1) Seek is performed, first packet out of av_read_frame() has .flags=0 (meaning not a keyframe) 2) Seek is performed, avcodec_decode_video2() must be fed several packets (57 in my test with ffmpeg command line, with #55 being the only one with .flags=1 (keyframe)) before it gets a full frame out If the either of those two are "yes, that's problematic/undesired behavior" then I need someone to verify that it's not just me (and afaict that needs to be done with -dump -loglevel debug (which afaict no one has used) in order to show the first 54 packets returned aren't keyframe packets). If the answer to the above two are "no, that's not problematic/undesired behavior," then I guess we need to define and document what "seeking to a keyframe" means because then there's a misunderstanding. Thanks Carl, --Michael From h.leppkes at gmail.com Mon Jul 23 20:28:55 2012 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Mon, 23 Jul 2012 20:28:55 +0200 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: On Mon, Jul 23, 2012 at 7:12 PM, Carl Eugen Hoyos wrote: > Michael Bradshaw writes: > > > Anyone have any answers on these two things? If the answer to the > > above would be "yes" can anyone else verify that "ffmpeg -dump > > -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does > > not seek to a keyframe? > > As said, afaict it does seek to a keyframe. > (But I may of course be wrong.) > > I am quite sure neither MPEG-PS nor MPEG-TS has the ability to seek to a keyframe. Its been a problem for me for a while and i've been over this code many times. All they do is a binary search for the timestamp, and when they arrive close enough, they are done. To compensate for this, decoders like MPEG-2 will simply discard frames until they see a keyframe to start decoding from, so visual corruption is avoided. If you run those codecs with AVCodeContext.flags2 set to CODEC_FLAG2_SHOW_ALL, you'll probably get plenty of corrupted frames before a real frame is shown, however i do not know how to do that via ffmpeg commandline to demonstrate. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Jul 23 20:50:24 2012 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 23 Jul 2012 18:50:24 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Why_does_av=5Fseek=5Fframe=28=29_not_seek_?= =?utf-8?q?to_a_keyframe=3F?= References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: Hendrik Leppkes writes: > > Anyone have any answers on these two things? If the answer to the > > above would be "yes" can anyone else verify that "ffmpeg -dump > > -loglevel debug -ss 38 -i 704x480-m2v-ac3.mpg -vframes 1 out.jpg" does > > not seek to a keyframe? > > As said, afaict it does seek to a keyframe. > (But I may of course be wrong.) > > I am quite sure neither MPEG-PS nor MPEG-TS has the ability to > seek to a keyframe. Its been a problem for me for a while and > i've been over this code many times. > All they do is a binary search for the timestamp, and when > they arrive close enough, they are done. > > To compensate for this, decoders like MPEG-2 will simply discard > frames until they see a keyframe to start decoding from, so > visual corruption is avoided. > If you run those codecs with AVCodeContext.flags2 set to > CODEC_FLAG2_SHOW_ALL, you'll probably get plenty of corrupted > frames before a real frame is shown, however i do not know how > to do that via ffmpeg commandline to demonstrate. (MPlayer should allow that.) You are probably right, I assumed that from a users' perspective, the only relevant question is if above command line returns a gray frame or the next keyframe. Afaiu our discussion, the libraries allow both possibilities, so at least many use cases should be covered. But please don't take my opinion too severe in this case, I just wanted to point out that users did report the gray frames previously, that this has been fixed and that Reimar preferred the previous behaviour (that MPlayer still requests with CODEC_FLAG2_SHOW_ALL iirc). Carl Eugen From noahzarc at hotmail.co.uk Mon Jul 23 15:34:47 2012 From: noahzarc at hotmail.co.uk (noahzarc) Date: Mon, 23 Jul 2012 06:34:47 -0700 (PDT) Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: <20120720205857.GA6985@phare.normalesup.org> References: <20120720205857.GA6985@phare.normalesup.org> Message-ID: <1343050487486-4655467.post@n4.nabble.com> Nicolas George-2 wrote > > Le quartidi 24 messidor, an CCXX, Noah Arc a ?crit?: >> In the past, libx264 variables such as crf was a part of AVCodecContext. >> However, looks like in version 0.11 it has been deprecated and was moved >> to libx264.c as a private variable. But for my project, I'm used to just >> assign a value to crf (of a ptr of type AVCodecContext). Could someone >> please give me a hint on how I could implement the API changes? > > You are supposed to pass the options as the third argument to > avcodec_open2. > There is an example in the documentation of the function. > > Please refrain from top-posting on this mailing list; and if you did not > understand what it means, look it up. > > Regards, > > -- > Nicolas George > > _______________________________________________ > Libav-user mailing list > Libav-user@ > http://ffmpeg.org/mailman/listinfo/libav-user > Apologies for top posting, it's my very first time using a mailing list. If you are talking about the "muxing.c" example under doc, yes I have looked at it and attempted to implement similar format in my code. However as I stated before, I get the "identifier not found" error at compiling time. I have included opt.h and avcodec.h avformat.h at the top of my code, so I'm just wondering if there are anything else I need to include. P.S. when I right click on the function and "jump to definition", it actually jumps to the function deceleration in opt.h. Cheers -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Using-LibX264-with-ffmpeg-libraries-tp4655395p4655467.html Sent from the libav-users mailing list archive at Nabble.com. From noahzarc at hotmail.co.uk Mon Jul 23 20:36:59 2012 From: noahzarc at hotmail.co.uk (noahzarc) Date: Mon, 23 Jul 2012 11:36:59 -0700 (PDT) Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: <20120720205857.GA6985@phare.normalesup.org> References: <20120720205857.GA6985@phare.normalesup.org> Message-ID: <1343068619950-4655472.post@n4.nabble.com> Nicolas George-2 wrote > > Le quartidi 24 messidor, an CCXX, Noah Arc a ?crit?: >> In the past, libx264 variables such as crf was a part of AVCodecContext. >> However, looks like in version 0.11 it has been deprecated and was moved >> to libx264.c as a private variable. But for my project, I'm used to just >> assign a value to crf (of a ptr of type AVCodecContext). Could someone >> please give me a hint on how I could implement the API changes? > > You are supposed to pass the options as the third argument to > avcodec_open2. > There is an example in the documentation of the function. > > Please refrain from top-posting on this mailing list; and if you did not > understand what it means, look it up. > > Regards, > > -- > Nicolas George > > _______________________________________________ > Libav-user mailing list > Libav-user@ > http://ffmpeg.org/mailman/listinfo/libav-user > Apologies, it's my very first time using a mailing list. Would this be the correct way of setting priv_data? AVDictionary *outputDictionary; av_dict_set(&outputDictionary, "crf", "0", AV_DICT_APPEND); avcodec_open2(outputCodecCtx, codec, &outputDictionary); Thanks -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Using-LibX264-with-ffmpeg-libraries-tp4655395p4655472.html Sent from the libav-users mailing list archive at Nabble.com. From mbradshaw at sorensonmedia.com Mon Jul 23 21:10:10 2012 From: mbradshaw at sorensonmedia.com (Michael Bradshaw) Date: Mon, 23 Jul 2012 13:10:10 -0600 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? In-Reply-To: References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: On Mon, Jul 23, 2012 at 12:50 PM, Carl Eugen Hoyos wrote: > [...] > You are probably right, I assumed that from a users' perspective, > the only relevant question is if above command line returns a gray > frame or the next keyframe. Ah, I see. I think that's where the confusion is coming from. I think that that behavior is OK (well, we all want better seeking functionality eventually, but for the time being it's currently OK enough), provided it's clearly documented. The way it is currently documented, I thought av_seek_frame() would seek to an actual keyframe ("Seek to the keyframe at timestamp."). Personally, I think it should at least be stated that it may seek to a non keyframe for some formats/streams. Thoughts? Thanks, Michael From donmoir at comcast.net Mon Jul 23 21:26:37 2012 From: donmoir at comcast.net (Don Moir) Date: Mon, 23 Jul 2012 15:26:37 -0400 Subject: [Libav-user] Why does av_seek_frame() not seek to a keyframe? References: <41E2C8568DB04AC28F17ECB71E54408D@MANLAP> Message-ID: <9ED3EA9BBF9447B8B3B26BB44CC27A3A@MANLAP> ----- Original Message ----- From: "Michael Bradshaw" To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter." Sent: Monday, July 23, 2012 3:10 PM Subject: Re: [Libav-user] Why does av_seek_frame() not seek to a keyframe? > On Mon, Jul 23, 2012 at 12:50 PM, Carl Eugen Hoyos > wrote: >> [...] >> You are probably right, I assumed that from a users' perspective, >> the only relevant question is if above command line returns a gray >> frame or the next keyframe. > > Ah, I see. I think that's where the confusion is coming from. I think > that that behavior is OK (well, we all want better seeking > functionality eventually, but for the time being it's currently OK > enough), provided it's clearly documented. The way it is currently > documented, I thought av_seek_frame() would seek to an actual keyframe > ("Seek to the keyframe at timestamp."). Personally, I think it should > at least be stated that it may seek to a non keyframe for some > formats/streams. > > Thoughts? > Probably bug report should be posted. These are the kind of things that can make using ffmpeg difficult. Mostly ffmpeg works really well, but then you run into these kind of issues. From nicolas.george at normalesup.org Mon Jul 23 22:14:22 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 23 Jul 2012 22:14:22 +0200 Subject: [Libav-user] Using LibX264 with ffmpeg libraries In-Reply-To: <1343068619950-4655472.post@n4.nabble.com> <1343050487486-4655467.post@n4.nabble.com> Message-ID: <20120723201422.GA23339@phare.normalesup.org> Le sextidi 6 thermidor, an CCXX, noahzarc a ?crit?: > Apologies for top posting, it's my very first time using a mailing list. No problem, you fixed it. > Apologies, it's my very first time using a mailing list. Would this be the > correct way of setting priv_data? > > AVDictionary *outputDictionary; > av_dict_set(&outputDictionary, "crf", "0", AV_DICT_APPEND); > avcodec_open2(outputCodecCtx, codec, &outputDictionary); You would probably make sure you init outputDictionary to NULL before doing anything on it. And AV_DICT_APPEND is not necessary here and may be harmful under some circumstances, but yes, this is the gist of it. Regards, -- Nicolas GEorge -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From jettoblack at gmail.com Mon Jul 23 23:12:39 2012 From: jettoblack at gmail.com (jettoblack) Date: Mon, 23 Jul 2012 14:12:39 -0700 (PDT) Subject: [Libav-user] Setting libx264 bitrate via API In-Reply-To: <0BD925121A830C4DACF7FF9213266ACAB3A981CCB4@CHN-HCLT-EVS09.HCLT.CORP.HCL.IN> References: <1342823147934-4655453.post@n4.nabble.com> <0BD925121A830C4DACF7FF9213266ACAB3A981CCB4@CHN-HCLT-EVS09.HCLT.CORP.HCL.IN> Message-ID: <1343077959076-4655479.post@n4.nabble.com> rsg wrote > > Hi, > > I am also facing a similar issue. > When I set the bit rate using > > out_vcodec->bit_rate = 200000; > > the quality of the video goes very bad. But when I set qmin and qmax, the > bitrate setting is ignored. > Only when i set a high value (approx 100MB) for the bit rate, the quality > of the video improves. > > Yes that is the same thing I'm seeing. If qmin/qmax are left at -1 (default), then no matter what bitrate is specified, quality is very bad (and the bitrate is not honored). The upper half/third of the image looks good and the lower area looks really bad. The dividing line also changes every couple of frames. For example see this screenshot: https://dl.dropbox.com/u/7730988/encode_prob.png The only way I found to avoid this problem is to set qmin/qmax but then the resulting video is not ABR/CBR. Here is the same frame compressed with all settings the same as before, except set qmin=1, qmax=31: https://dl.dropbox.com/u/7730988/qminqmax.png Obviously ffmpeg can do it right so I'm sure we are doing something wrong, but I haven't yet found the difference in how ffmpeg is setting the libx264 options such as bitrate differently than what we are doing here. Hope someone else has an idea... Thanks. -- View this message in context: http://libav-users.943685.n4.nabble.com/Setting-libx264-bitrate-via-API-tp4655453p4655479.html Sent from the libav-users mailing list archive at Nabble.com. From ricardohenrylee at gmail.com Tue Jul 24 17:10:30 2012 From: ricardohenrylee at gmail.com (Richard H Lee) Date: Tue, 24 Jul 2012 16:10:30 +0100 Subject: [Libav-user] [libavcodec] requested bitrate is too low, when using VBR qscale Message-ID: <500EBAE6.8040403@gmail.com> (I'm not sure if this post belongs one of the other lists like ffmpeg-users, so please let me know if this is the wrong list.) I'm trying to do basic VBR 2-pass mpeg4 encoding with ffmpeg. The sample file is the 480p Big Buck Bunny trailer http://download.blender.org/peach/trailer/trailer_480p.mov . My ffmpeg is built from git on Ubuntu 32. The command line I use for 1st pass is: ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 1 -an test.mp4 For second pass: ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 2 -an test.mp4 You can see the stdout output at the bottom on this email. The error I get is: requested bitrate is too low This stems from ratecontrol.c: if(all_available_bits < all_const_bits){ av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n"); return -1; } I think all_const_bits is obtained by summing over the rate control data in the log file. all_availiable_bits is calculated using: uint64_t all_available_bits= (uint64_t)(s->bit_rate*(double)rcc->num_entries/fps); I breakpointed at the error message and found that s->bit_rate was the default at 200 . Compare this to bitrate of test.mp4 after the first pass which is ~1700 - 2000 . This is the reason why all_available_bits < all_const_bits . I'm pretty I don't need to set bitrate as I'm doing VBR encoding. But what needs to be done to pass the "correct" bitrate to libavcodec? [This also occurs with divverent's encoding branch mplayer2. Additionally when I try to do 2-pass CBR encoding with ffmpeg, I get a segfault as pict_type is a huge number when it is meant to be 1<4 for the index of an array.] Richard ========== 1st pass stdout: ffmpeg version N-42847-gdc31b84 Copyright (c) 2000-2012 the FFmpeg developers built on Jul 24 2012 01:33:10 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-debug --disable-stripping libavutil 51. 65.100 / 51. 65.100 libavcodec 54. 44.100 / 54. 44.100 libavformat 54. 20.100 / 54. 20.100 libavdevice 54. 2.100 / 54. 2.100 libavfilter 3. 3.100 / 3. 3.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trailer_480p.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 1938-02-11 06:16:36 Duration: 00:00:32.99, start: 0.000000, bitrate: 2681 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 854x480, 2282 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc Metadata: creation_time : 1938-02-11 06:16:36 handler_name : Apple Alias Data Handler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, s16, 428 kb/s Metadata: creation_time : 1938-02-11 06:16:36 handler_name : Apple Alias Data Handler 2nd pass stdout: ffmpeg version N-42847-gdc31b84 Copyright (c) 2000-2012 the FFmpeg developers built on Jul 24 2012 01:33:10 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --enable-debug --disable-stripping libavutil 51. 65.100 / 51. 65.100 libavcodec 54. 44.100 / 54. 44.100 libavformat 54. 20.100 / 54. 20.100 libavdevice 54. 2.100 / 54. 2.100 libavfilter 3. 3.100 / 3. 3.100 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 15.100 / 0. 15.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trailer_480p.mov': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt creation_time : 1938-02-11 06:16:36 Duration: 00:00:32.99, start: 0.000000, bitrate: 2681 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 854x480, 2282 kb/s, 25 fps, 25 tbr, 600 tbn, 1200 tbc Metadata: creation_time : 1938-02-11 06:16:36 handler_name : Apple Alias Data Handler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, s16, 428 kb/s Metadata: creation_time : 1938-02-11 06:16:36 handler_name : Apple Alias Data Handler File 'test.mp4' already exists. Overwrite ? [y/N] y requested bitrate is too low Output #0, mp4, to 'test.mp4': Metadata: major_brand : qt minor_version : 537199360 compatible_brands: qt Stream #0:0(eng): Video: mpeg4, yuv420p, 854x480, q=2-31, pass 2, 200 kb/s, 90k tbn, 25 tbc Metadata: creation_time : 1938-02-11 06:16:36 handler_name : Apple Alias Data Handler Stream mapping: Stream #0:0 -> #0:0 (h264 -> mpeg4) Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height From nicolas.george at normalesup.org Tue Jul 24 17:28:18 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Tue, 24 Jul 2012 17:28:18 +0200 Subject: [Libav-user] [libavcodec] requested bitrate is too low, when using VBR qscale In-Reply-To: <500EBAE6.8040403@gmail.com> References: <500EBAE6.8040403@gmail.com> Message-ID: <20120724152813.GA19009@phare.normalesup.org> Le septidi 7 thermidor, an CCXX, Richard H Lee a ?crit?: > (I'm not sure if this post belongs one of the other lists like > ffmpeg-users, so please let me know if this is the wrong list.) Since you are using the command-line tool and not the API, ffmpeg-user would have been a better choice. But I do not think it is worth changing now that the thread is started. > The command line I use for 1st pass is: > ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 1 -an test.mp4 > > For second pass: > ffmpeg -i trailer_480p.mov -vcodec mpeg4 -q:v 4 -pass 2 -an test.mp4 I do not think that having both -q and -pass options makes sense. Multi-pass encoding is designed to achieve a certain average bitrate, and manage it over the whole file to give more bits to the parts that need more. The -q option sets the quantizer value (which, for any given frame, is directly related to the quality level), and does not let any choice to the encoder to set the bitrate. If you care about the total size of your resulting file, you need to use -b to set the average bitrate and -pass to spend it as efficiently as possible. If not, you set -q and do only a single pass. 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 ricardohenrylee at gmail.com Tue Jul 24 18:11:06 2012 From: ricardohenrylee at gmail.com (Richard H Lee) Date: Tue, 24 Jul 2012 17:11:06 +0100 Subject: [Libav-user] [libavcodec] requested bitrate is too low, when using VBR qscale In-Reply-To: <20120724152813.GA19009@phare.normalesup.org> References: <500EBAE6.8040403@gmail.com> <20120724152813.GA19009@phare.normalesup.org> Message-ID: <500EC91A.5020605@gmail.com> On 24/07/12 16:28, Nicolas George wrote: > Multi-pass encoding is designed to achieve a certain average bitrate, and > manage it over the whole file to give more bits to the parts that need more. > > The -q option sets the quantizer value (which, for any given frame, is > directly related to the quality level), and does not let any choice to the > encoder to set the bitrate. This makes complete sense to me now. From noahzarc at hotmail.co.uk Mon Jul 23 20:43:45 2012 From: noahzarc at hotmail.co.uk (noahzarc) Date: Mon, 23 Jul 2012 11:43:45 -0700 (PDT) Subject: [Libav-user] Setting level within libx264 codec Message-ID: <1343069025767-4655473.post@n4.nabble.com> Hi all: I have a quick question about setting the encoding level for libx254. In ffmpeg 0.10, I was able to set the profile just with the code below outputCodecCtx->level = 52; Of course with outputCodexCtx being of type AVCodecContext. And then I would get the profile: High, level 5.2. However after updating to ffmpeg 0.11, seems like the same code will lead to a different profile: High 4:4:4 Predictive, level 5.2, 4:2:0 8-bit The output can still be generated but the size of the output is about 10 times bigger than the result of ffmpeg 0.10 Any suggestions? p.s. I've also tried to change "52" to "FF_PROFILE_H264_HIGH", but then I get an error saying "level 100 is not defined".. -- View this message in context: http://libav-users.943685.n4.nabble.com/Setting-level-within-libx264-codec-tp4655473.html Sent from the libav-users mailing list archive at Nabble.com. From noahzarc at hotmail.co.uk Tue Jul 24 17:38:12 2012 From: noahzarc at hotmail.co.uk (noahzarc) Date: Tue, 24 Jul 2012 08:38:12 -0700 (PDT) Subject: [Libav-user] Setting level within libx264 codec In-Reply-To: <1343069025767-4655473.post@n4.nabble.com> References: <1343069025767-4655473.post@n4.nabble.com> Message-ID: <1343144292276-4655482.post@n4.nabble.com> noahzarc wrote > > Hi all: > I have a quick question about setting the encoding level for libx254. In > ffmpeg 0.10, I was able to set the profile just with the code below > > outputCodecCtx->level = 52; > > Of course with outputCodexCtx being of type AVCodecContext. And then I > would get the profile: High, level 5.2. However after updating to ffmpeg > 0.11, seems like the same code will lead to a different profile: > > High 4:4:4 Predictive, level 5.2, 4:2:0 8-bit > > The output can still be generated but the size of the output is about 10 > times bigger than the result of ffmpeg 0.10 > > Any suggestions? > p.s. I've also tried to change "52" to "FF_PROFILE_H264_HIGH", but then I > get an error saying "level 100 is not defined".. > Sorry x264, not x254(i doubt if that exists..) -- View this message in context: http://libav-users.943685.n4.nabble.com/Setting-level-within-libx264-codec-tp4655473p4655482.html Sent from the libav-users mailing list archive at Nabble.com. From jacob at peddicord.net Tue Jul 24 18:53:59 2012 From: jacob at peddicord.net (Jacob Peddicord) Date: Tue, 24 Jul 2012 12:53:59 -0400 Subject: [Libav-user] trouble syncing with x264 and RTP Message-ID: Hi, I've been working on some streaming software that takes live feeds from various kinds of cameras and streams over the network using H.264. To accomplish this, I'm using the x264 encoder directly (with the "zerolatency" preset) and feeding NALs as they are available to libavformat to pack into RTP (ultimately RTSP). Ideally, this application should be as real-time as possible. For the most part, this has been working well. Unfortunately, however, there is some sort of synchronization issue: any video playback on clients seems to show a few smooth frames, followed by a short pause, then more frames; repeat. Additionally, there appears to be approximately a 4-second delay. This happens with every video player I've tried: Totem, VLC, and basic gstreamer pipes. I've boiled it all down to a somewhat small test case, which is attached. This test shows black lines on a white background that should move smoothly to the left. It has been written for ffmpeg 0.6.5 (sorry) but appears to work the same on 0.8.3 on Ubuntu. I've taken some shortcuts in error handling to make this example as short as possible while still showing the problem, so please excuse some of the nasty code. I should also note that while an SDP is not used here, I have tried using that already with similar results. The test can be compiled with: gcc -g -std=gnu99 streamtest.c -lswscale -lavformat -lx264 -lm -lpthread -o streamtest It can be played with gtreamer directly: gst-launch udpsrc port=49990 ! application/x-rtp,payload=96,clock-rate=90000 ! rtph264depay ! decodebin ! xvimagesink You should immediately notice the stuttering. One common "fix" I've seen all over the Internet is to add sync=false to the pipeline: gst-launch udpsrc port=49990 ! application/x-rtp,payload=96,clock-rate=90000 ! rtph264depay ! decodebin ! xvimagesink sync=false This causes playback to be smooth (and near-realtime), but is a non-solution and only works with gstreamer. I'd like to fix the problem at the source. I've been able to stream with near-identical parameters using raw ffmpeg and haven't had any issues: ffmpeg -re -i sample.mp4 -vcodec libx264 -vpre ultrafast -vpre baseline -b 400000 -an -f rtp rtp://127.0.0.1:49990 -an So clearly I'm doing something wrong. But what is it? Any assistance would be greatly appreciated. -- Jacob Peddicord http://jacob.peddicord.net/ -------------- next part -------------- A non-text attachment was scrubbed... Name: streamtest.c Type: text/x-csrc Size: 4280 bytes Desc: not available URL: From wagner.patriota at gmail.com Tue Jul 24 20:56:09 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Tue, 24 Jul 2012 15:56:09 -0300 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification Message-ID: Hello, I followed this document http://www.etsi.org/deliver/etsi_en/300700_300799/300743/01.03.01_60/en_300743v010301p.pdf in order to try to create a .sub file by myself. The thing is: I need to convert .SRT files .SUB files... but the bitmaps inside the .SUB file must be 8-bit color. I couldn't find a free ou cheap software for this, so I decided to create it by myself. But FFmpeg still doesn't recognize my .SUB file. Question 1: Is this document really the one I think I need? I mean, I followed every bit of it but FFmpeg doesn't recognize correctly... Question 2: Does anybody know another documentation about the .SUB file? Where? Question 3: Is the another free or cheap (less than 500USD) software that does this job? [convert SRT to .SUB with 8-bit-color] -------------- next part -------------- An HTML attachment was scrubbed... URL: From michaelni at gmx.at Tue Jul 24 22:38:15 2012 From: michaelni at gmx.at (Michael Niedermayer) Date: Tue, 24 Jul 2012 22:38:15 +0200 Subject: [Libav-user] [FFmpeg-devel] MOV and custom IO In-Reply-To: <0181269B-1567-4190-AFCB-62C5AFFB454B@wit-software.com> References: <0181269B-1567-4190-AFCB-62C5AFFB454B@wit-software.com> Message-ID: <20120724203815.GQ25121@kiste2> On Sun, Jul 22, 2012 at 02:01:02PM +0100, David Rodrigues wrote: > Hi everyone. > > I've written some code to change the video container from MOV to MPEG-TS using ffmpeg API successfully. I'm using physical files. > > Now i have to change my input from file to custom IO. I changed the code for use custom IO with a callback (read_packet_callback) to feed ffmpeg. > > fmtCtx = avformat_alloc_context(); > > iformat = av_find_input_format(input_fmt); > > ibuffer = (unsigned char *) av_malloc(BUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE) > > fmtCtx->pb = avio_alloc_context(ibuffer, > BUF_SIZE, > 0, > read_context, > read_packet_callback, > NULL, > NULL); > > avformat_open_input(&fmtCtx, "in-memory", iformat, NULL) > > When i run the code the function avformat_open_input blocks, it reads N chunks of data but don't terminate with or without error. This happens with MOV format. I've tried using MPEG-TS format and this code runs successfully. > > There's a special trick for MOV format? Has anyone encountered this problem? are your mov files streamable ? if not your custom IO needs to support seeking [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From nicolas.george at normalesup.org Wed Jul 25 00:08:41 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Wed, 25 Jul 2012 00:08:41 +0200 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: References: Message-ID: <20120724220841.GA3867@phare.normalesup.org> Le septidi 7 thermidor, an CCXX, Wagner Patriota a ?crit?: > in order to try to create a .sub file by myself. What kind of file are you speaking of exactly? Files with the .sub extension may be MicroDVD files, which are simple text files with frames numbers, or part of a VOBSUB file, but the other half, the index (.idx) is missing. > The thing is: I need to convert .SRT files .SUB files... but the bitmaps > inside the .SUB file must be 8-bit color. I couldn't find a free ou cheap > software for this, so I decided to create it by myself. But FFmpeg still > doesn't recognize my .SUB file. The complete console output would be useful to diagnose anything. > Question 1: > Is this document really the one I think I need? I mean, I followed every > bit of it but FFmpeg doesn't recognize correctly... Probably not. This document is about DVB subtitles. There are not many formats that can contain DVB subtitles. The nearest I can guess is VOBSUB, which is mostly made of DVD subtitles. There is only one letter different, but this is an entirely different format. 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 wagner.patriota at gmail.com Wed Jul 25 00:41:03 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Tue, 24 Jul 2012 19:41:03 -0300 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: <20120724220841.GA3867@phare.normalesup.org> References: <20120724220841.GA3867@phare.normalesup.org> Message-ID: I think that the correct name of the file I wanna create is MPEG-PS (RLE). My mediainfo says: Format: MPEG-PS ID: 189 (0xBD)-32 (0x20)**** Format: RLE**** Format/Info: Run-length encoding**** Muxing mode: DVD-Video Duration: 1mn 45s FFmpeg is supposed to interpret 2, 4 or 8 bit version of the bitmap cotained on this file... I have a sample attached. When I use it with FFmpeg it does not work perfectly on TV. It goes fine on VLC but on TV it doesn't work. [muxing with MPEG2-TS video] ffmpeg -i input.ts *-i a.sub* -vcodec copy -acodec copy *-scodec dvbsub*output.ts On Tue, Jul 24, 2012 at 7:08 PM, Nicolas George < nicolas.george at normalesup.org> wrote: > Le septidi 7 thermidor, an CCXX, Wagner Patriota a ?crit : > > in order to try to create a .sub file by myself. > > What kind of file are you speaking of exactly? Files with the .sub > extension > may be MicroDVD files, which are simple text files with frames numbers, or > part of a VOBSUB file, but the other half, the index (.idx) is missing. > > > The thing is: I need to convert .SRT files .SUB files... but the bitmaps > > inside the .SUB file must be 8-bit color. I couldn't find a free ou cheap > > software for this, so I decided to create it by myself. But FFmpeg still > > doesn't recognize my .SUB file. > > The complete console output would be useful to diagnose anything. > > > Question 1: > > Is this document really the one I think I need? I mean, I followed every > > bit of it but FFmpeg doesn't recognize correctly... > > Probably not. This document is about DVB subtitles. There are not many > formats that can contain DVB subtitles. The nearest I can guess is VOBSUB, > which is mostly made of DVD subtitles. There is only one letter different, > but this is an entirely different format. > > Regards, > > -- > Nicolas George > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iEYEARECAAYFAlAPHOkACgkQsGPZlzblTJNq2wCePFOc6OeL6Y1JEb9EQk5zOmm3 > 1LUAnRWkeeSoQF5ze18payyQr+fPHXVc > =iSVi > -----END PGP SIGNATURE----- > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: a.sub Type: application/octet-stream Size: 79872 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: a.sub Type: application/octet-stream Size: 79872 bytes Desc: not available URL: From nicolas.george at normalesup.org Wed Jul 25 10:14:23 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Wed, 25 Jul 2012 10:14:23 +0200 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: References: <20120724220841.GA3867@phare.normalesup.org> Message-ID: <20120725081422.GA14975@phare.normalesup.org> Please do not top-post on this mailing list. If you do not know what it means, loop it up before doing it again. Le septidi 7 thermidor, an CCXX, Wagner Patriota a ?crit?: > I think that the correct name of the file I wanna create is MPEG-PS (RLE). A MPEG-PS file with just subtitles will not be very useful to you. > ffmpeg -i input.ts *-i a.sub* -vcodec copy -acodec copy *-scodec > dvbsub*output.ts What are we supposed to do with that? 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 ggarra13 at gmail.com Wed Jul 25 16:15:14 2012 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Wed, 25 Jul 2012 11:15:14 -0300 Subject: [Libav-user] DVD Vob subtitles missing Message-ID: <500FFF72.7090409@gmail.com> I have some VOBs which show with no subtitles when in fact they have them. The problem shows up in ffplay and my viewer, but not in VLC (which adds the titles after the movie is running). Is anyone aware of this problem? Sometimes the first VOB will not show subtitles, but the second VOB in sequence will have them with no problem. From nicolas.george at normalesup.org Wed Jul 25 17:26:18 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Wed, 25 Jul 2012 17:26:18 +0200 Subject: [Libav-user] DVD Vob subtitles missing In-Reply-To: <500FFF72.7090409@gmail.com> References: <500FFF72.7090409@gmail.com> Message-ID: <20120725152618.GA14236@phare.normalesup.org> L'octidi 8 thermidor, an CCXX, Gonzalo Garramuno a ?crit?: > I have some VOBs which show with no subtitles when in fact they have > them. The problem shows up in ffplay and my viewer, but not in VLC > (which adds the titles after the movie is running). Is anyone aware > of this problem? Sometimes the first VOB will not show subtitles, > but the second VOB in sequence will have them with no problem. Does this proposed new FAQ entry help you: http://ffmpeg.org/pipermail/ffmpeg-devel/2012-July/128294.html 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 wagner.patriota at gmail.com Wed Jul 25 18:37:17 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Wed, 25 Jul 2012 13:37:17 -0300 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: <20120725081422.GA14975@phare.normalesup.org> References: <20120724220841.GA3867@phare.normalesup.org> <20120725081422.GA14975@phare.normalesup.org> Message-ID: On Wed, Jul 25, 2012 at 5:14 AM, Nicolas George < nicolas.george at normalesup.org> wrote: > Please do not top-post on this mailing list. If you do not know what it > means, loop it up before doing it again. > > ok, sorry > > Le septidi 7 thermidor, an CCXX, Wagner Patriota a ?crit : > > I think that the correct name of the file I wanna create is MPEG-PS > (RLE). > > A MPEG-PS file with just subtitles will not be very useful to you. > why? are you sure you really undertood what I am asking? I am using the ffmpeg command to join a video with subtitle... the attached "a.sub" WORKS PERFECTLY without the .idx file.... it is working. I just wanna make the same thing but with a bitmap 8-bit-color. that's simple like this! > > > ffmpeg -i input.ts *-i a.sub* -vcodec copy -acodec copy *-scodec > > dvbsub*output.ts > > What are we supposed to do with that? > it is not just supposed to do. it in fact does work. the thing is: I need the .sub file have a bitmap 8-bit-color. This ffmpeg command is used to mux the video and subtitle together. ;-) > > Regards, > > -- > Nicolas George > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iEYEARECAAYFAlAPqt4ACgkQsGPZlzblTJONaACfQCYB64NMVVilQXk20GOBFbKM > 2QcAoIZ65z1vbenbBDE76YimgdnM2XTm > =Dc0K > -----END PGP SIGNATURE----- > > _______________________________________________ > 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 ggarra13 at gmail.com Thu Jul 26 15:43:42 2012 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Thu, 26 Jul 2012 10:43:42 -0300 Subject: [Libav-user] DVD Vob subtitles missing In-Reply-To: <20120725152618.GA14236@phare.normalesup.org> References: <500FFF72.7090409@gmail.com> <20120725152618.GA14236@phare.normalesup.org> Message-ID: 2012/7/25 Nicolas George > > Does this proposed new FAQ entry help you: > > http://ffmpeg.org/pipermail/ffmpeg-devel/2012-July/128294.html > > Regards, > > -- > Nicolas George > > > Thanks for the help. Do you know the options equivalent in libav? I am trying to understand the ffmpeg code and I am a tad lost. I would like my viewer to use a larger probesize and analyzeduration. -- Gonzalo Garramu?o ggarra13 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From ggarra13 at gmail.com Thu Jul 26 15:57:45 2012 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Thu, 26 Jul 2012 10:57:45 -0300 Subject: [Libav-user] DVD Vob subtitles missing In-Reply-To: References: <500FFF72.7090409@gmail.com> <20120725152618.GA14236@phare.normalesup.org> Message-ID: 2012/7/26 Gonzalo Garramuno > > 2012/7/25 Nicolas George > >> >> Does this proposed new FAQ entry help you: >> >> http://ffmpeg.org/pipermail/ffmpeg-devel/2012-July/128294.html >> >> Regards, >> >> -- >> Nicolas George >> >> >> Thanks for the help. Do you know the options equivalent in libav? I am > trying to understand the ffmpeg code and I am a tad lost. I would like my > viewer to use a larger probesize and analyzeduration. > Never mind. I found them. -- Gonzalo Garramu?o ggarra13 at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefasab at gmail.com Fri Jul 27 00:34:14 2012 From: stefasab at gmail.com (Stefano Sabatini) Date: Fri, 27 Jul 2012 00:34:14 +0200 Subject: [Libav-user] [ANNOUNCE] SOCIS 2012 - Request for students In-Reply-To: <20120718233943.GB3387@arborea> References: <20120718233943.GB3387@arborea> Message-ID: <20120726223414.GE19421@arborea> On date Thursday 2012-07-19 01:39:43 +0200, Stefano Sabatini encoded: > We're glad to announce that FFmpeg application to SOCIS (Summer > Of Code In Space) has been accepted and we've been allocated a slot > for a student: > http://sophia.estec.esa.int/socis2012/ > > The selected student will be sponsored to work on one of the tasks > listed on this page: > http://wiki.multimedia.cx/index.php?title=FFmpeg_Summer_Of_Code_In_Space_2012 > > but the student is allowed to propose a different task in case he/she > has a different proposal (but we can't guarantee the task > qualification only in case we'll be able to couple him/her with a > mentor). > > Students' application timeline is on Friday July 27: > http://sophia.estec.esa.int/socis2012/?q=timeline > > If you are a student and you want to partecipate to the program, > you're invited to check more information from the SOCIS web site, in > particular to read the pages: > - http://sophia.estec.esa.int/socis2012/?q=faq > - http://sophia.estec.esa.int/socis2012/?q=tos > - http://sophia.estec.esa.int/socis2012/?q=student_agreement > > and get in touch as soon as possible with the FFmpeg administrators > (Stefano Sabatini and Michael Niedermayer) and/or with one of the > mentors. REMINDER Students application deadline is approaching tomorrow (11 AM UTC), please apply if you are interested. Students proposals will be evaluated based on the qualification task performance and resume in the next few days. Evaluation deadline will happen on July 31, on the next Tuesday, so please propose your qualification task as soon as possible. Thanks and good luck to all candidate contributors! From nicolas.george at normalesup.org Sat Jul 28 17:13:28 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Sat, 28 Jul 2012 17:13:28 +0200 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: References: <20120724220841.GA3867@phare.normalesup.org> <20120725081422.GA14975@phare.normalesup.org> Message-ID: <20120728151328.GA18237@phare.normalesup.org> L'octidi 8 thermidor, an CCXX, Wagner Patriota a ?crit?: > ok, sorry No problem, thanks for fixing it. > why? are you sure you really undertood what I am asking? I did not until now. Thanks for clarifying. > I am using the ffmpeg command to join a video with subtitle... the attached > "a.sub" WORKS PERFECTLY without the .idx file.... it is working. I just I am quite surprised, as I frequently observed that the timestamps (especially the durations) of DVD subtitles streams were somewhat wrong without the corresponding index file, but I will take your word for it. > wanna make the same thing but with a bitmap 8-bit-color. that's simple like > this! I am pretty sure this is not possible: DVD subtitles are 2-bits bitmaps. This document confirms: http://dvd.sourceforge.net/spu_notes (of course, the official specification is closed). 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 Mon Jul 30 12:28:40 2012 From: mark.kenna at sureviewsystems.com (Mark Kenna) Date: Mon, 30 Jul 2012 11:28:40 +0100 Subject: [Libav-user] Dynamically linking multiple versions Message-ID: <501661D8.2070100@sureviewsystems.com> Hi Is is possible to include two different libraries which both use very different versions of FFMpeg when working with dll's? I have two libraries which both have FFMpeg dynamically linked (in their own folders) but when used together the application crashes. Would I have to statically link? Any help would be appreciated. Thanks, Mark. From wagner.patriota at gmail.com Mon Jul 30 23:18:18 2012 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Mon, 30 Jul 2012 18:18:18 -0300 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: <20120728151328.GA18237@phare.normalesup.org> References: <20120724220841.GA3867@phare.normalesup.org> <20120725081422.GA14975@phare.normalesup.org> <20120728151328.GA18237@phare.normalesup.org> Message-ID: On Sat, Jul 28, 2012 at 12:13 PM, Nicolas George < nicolas.george at normalesup.org> wrote: > L'octidi 8 thermidor, an CCXX, Wagner Patriota a ?crit : > > ok, sorry > > No problem, thanks for fixing it. > > > why? are you sure you really undertood what I am asking? > > I did not until now. Thanks for clarifying. > > > I am using the ffmpeg command to join a video with subtitle... the > attached > > "a.sub" WORKS PERFECTLY without the .idx file.... it is working. I just > > I am quite surprised, as I frequently observed that the timestamps > (especially the durations) of DVD subtitles streams were somewhat wrong > without the corresponding index file, but I will take your word for it. > for me it's ok... it's working > > > wanna make the same thing but with a bitmap 8-bit-color. that's simple > like > > this! > > I am pretty sure this is not possible: DVD subtitles are 2-bits bitmaps. > This document confirms: > http://dvd.sourceforge.net/spu_notes > (of course, the official specification is closed). > I got the mistake, my mistake... the device I am going to play the movie is actually a OTT device. It's not a DVD as I said before. So, it uses the DVBSUB as codec. anyways... the CODEC MUST BE DVBSUB... The same file that you cited ".sub" (and idx, although I don't use)... where could I find a documentation? is it the same as the VOBSUB? Thank you so much for the attention. > > Regards, > > -- > Nicolas George > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.12 (GNU/Linux) > > iEYEARECAAYFAlAUAZgACgkQsGPZlzblTJMPDgCeK5Z2rHv5bGgAeivtfArK8NrM > /GoAoICGlto10cZ+RKwCijIUlZsZojhh > =mdeK > -----END PGP SIGNATURE----- > > _______________________________________________ > 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 nicolas.george at normalesup.org Mon Jul 30 23:57:45 2012 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 30 Jul 2012 23:57:45 +0200 Subject: [Libav-user] Trying to create a DVDSUB (.sub) according to Specification In-Reply-To: References: <20120724220841.GA3867@phare.normalesup.org> <20120725081422.GA14975@phare.normalesup.org> <20120728151328.GA18237@phare.normalesup.org> Message-ID: <20120730215745.GA15883@phare.normalesup.org> Le tridi 13 thermidor, an CCXX, Wagner Patriota a ?crit?: > I got the mistake, my mistake... the device I am going to play the movie is > actually a OTT device. It's not a DVD as I said before. So, it uses the > DVBSUB as codec. anyways... the CODEC MUST BE DVBSUB... Ok. According to the spec, the very one you pointed earlier, these ones can be 8-bits. At a quick glance in the source, lavc will automatically select depth 8 if the number of colors is more than 16. There are issues though. For one, encoding of dvbsub from ffmpeg command-line tool has currently problems due to timings. For two, there are not many formats that can contain dvbsub; you are more or less forced to go with MPEG-TS. > The same file that you cited ".sub" (and idx, although I don't use)... > where could I find a documentation? is it the same as the VOBSUB? Yes, it is VOBSUB. Basically, it is DVD subtitles packet muxed in a kind of stripped-down MPEG-PS, plus a text file for the timings and informations that do not fit in the stream, such as palette. 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 ffmpeg at tioui.com Tue Jul 31 02:41:47 2012 From: ffmpeg at tioui.com (Louis M) Date: Mon, 30 Jul 2012 20:41:47 -0400 Subject: [Libav-user] avformat_open_input with custom AVIOContext Message-ID: Hello everyone, I am creating a library to put more than one file into one file (some kind of package file). So, I need to use a custom AVIOContext. I try the following code to test and the "avformat_open_input" give function give me an "Invalid data found when processing input" error. The Code: #include #include #include int read_packet(void *opaque, uint8_t *buf, int buf_size){ FILE *the_file = (FILE *) opaque; return(fread(buf,1,buf_size,the_file)); } int64_t seek(void *opaque, int64_t offset, int whence){ FILE *the_file = (FILE *) opaque; return(fseek ( the_file, offset, whence )); } int main(){ AVFormatContext *input; AVIOContext * avio_context; unsigned char * bio_buffer; FILE *the_file; the_file=fopen("sound.flac","rb"); input=avformat_alloc_context(); bio_buffer=(unsigned char *)av_malloc(4092); avio_context=avio_alloc_context(bio_buffer,4092,0,the_file,&read_packet,NULL,&seek); input->pb=avio_context; if(!input->pb) { return 1; } int r=avformat_open_input(&input,"stream",NULL,NULL); if(r<0){ char * error; error=malloc(64); av_strerror(r,error,64); printf("Error: %s\n",error); free(error); return 1; } avformat_free_context(input); av_free(avio_context); av_free(bio_buffer); fclose(the_file); } The "sound.flac" file is a standard flac file. Here is what the "ffmpeg -i sound.flac" command line give me: [flac @ 0x1c0a7a0] max_analyze_duration reached Input #0, flac, from 'sound.flac': Duration: 00:00:15.31, bitrate: 342 kb/s Stream #0.0: Audio: flac, 44100 Hz, 1 channels, s16 At least one output file must be specified So, if someone can help me out. I'm a stuck here. Thanks in advance. Louis M From faliakis at yahoo.gr Sun Jul 29 09:46:31 2012 From: faliakis at yahoo.gr (aa aaaa) Date: Sun, 29 Jul 2012 08:46:31 +0100 (BST) Subject: [Libav-user] [newbie] how to extract current timestamp of h264 avi file Message-ID: <1343547991.51052.YahooMailNeo@web29806.mail.ird.yahoo.com> Hello everyone, I am newbie to ffmpeg and I am trying to use it in project I am working on. I am using OpenCv but the standar functions give wrong results so I decided to try with ffmpeg. So I would like someone to help me out with the steps I need to do in order to get the timestamp of a frame in a h264 avi file. for example , I would appreciate advice on how to do it. Which libraries must I use, and which steps or procedure must I do. Steps I mean something lik 1.load the video 2.parse video frame by frame 3.use command to get the timestamp. Any piece of code would be great to help me understand better. So thank everyone in advance for every info they can give me to solve my problem. -------------- next part -------------- An HTML attachment was scrubbed... URL: From amillett at matrox.com Tue Jul 31 21:08:01 2012 From: amillett at matrox.com (Alexandre Millette) Date: Tue, 31 Jul 2012 15:08:01 -0400 Subject: [Libav-user] [newbie] how to extract current timestamp of h264 avi file In-Reply-To: <1343547991.51052.YahooMailNeo@web29806.mail.ird.yahoo.com> References: <1343547991.51052.YahooMailNeo@web29806.mail.ird.yahoo.com> Message-ID: <50182D11.20309@matrox.com> Hello, aa aaaa wrote: > So I would like someone to help me out with the steps I need to do in > order to get the timestamp of a frame in a h264 avi file. I will assume you already have the libraries you need and they work in your environment. First include the one you need, like this: extern "C" { #include #include }; Then prepare some object you will need: AVFormatContext* mpFormatCtx AVCodecContext* mpCodecCtx; AVCodec* mpCodec; Here's a function that will open the file and get the context needed later: int ReadFile(const char* apFileName) { av_register_all(); mpFormatCtx = 0; // Open video file if( avformat_open_input( &mpFormatCtx, apFileName, NULL, NULL ) != 0) // Error // Retrieve stream information if( avformat_find_stream_info( mpFormatCtx, NULL ) < 0 ) // Error // Find the first video stream mVideoStream = -1; for( unsigned int i = 0; i < mpFormatCtx->nb_streams; i++ ) { if( mpFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO ) { mVideoStream = i; break; } } if( mVideoStream == -1 ) // no video stream found // Error // Get a pointer to the codec context for the video stream mpCodecCtx = mpFormatCtx->streams[mVideoStream]->codec; // Find the decoder for the video stream mpCodec = avcodec_find_decoder( mpCodecCtx->codec_id ); if( mpCodec == NULL) // Error // Open codec if( avcodec_open( mpCodecCtx, mpCodec ) < 0 ) // Error return 0; } At this point it's possible you have all the info you need, depending on what you want. If what you want is, say, the timestamp of the frame number 86 and you know that the video file has all it's frames of the same length (h264 accepts frames of uneven length IIRC), you can use the information stored in the mpFormatCtx->streams[mVideoStream] structure that you just filled. For example you may use r_frame_rate to get the FPS, converting it into the MPF (microseconds per frame) like this : int micro_sec_per_frame = int( 1000000 / ((float)mpFormatCtx->streams[mVideoStream]->r_frame_rate.num / (float)mpFormatCtx->streams[mVideoStream]->r_frame_rate.den) ); Then your timestamp, in microseconds, is : int timestamp = (86-1) * micro_sec_per_frame; But I get the feeling that you want a bit more than just that... You may have to decode the video frame by frame, but that's quite a bit more code and you shoul specify what you want exactly. Hope this helps, Alex M