[Libav-user] got_picture_ptr of avcodec_decode_video2 always returns 0 for a particular MTS file
Hello, I've come across a particular MTS file that doesn't seem to want to be decoded. I've decoded plenty of other MTS, M4V, and MOV files with my code so something seems to be unique to this one. I can play the file just fine too. Any idea what's going on here? Here's the media info for the bad file: General ID : 0 (0x0) Complete name: D:\Projects\Investigation\00793.MTS Format : BDAV Format/Info : Blu-ray Video File size: 91.9 MiB Duration : 34s 97ms Overall bit rate : 22.6 Mbps Maximum Overall bit rate : 24.0 Mbps Video ID : 4113 (0x1011) Menu ID : 1 (0x1) Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.0 Format settings, CABAC : No Format settings, ReFrames: 2 frames Format settings, GOP : M=1, N=28 Codec ID : 27 Duration : 33s 984ms Bit rate mode: Variable Bit rate : 21.4 Mbps Maximum bit rate : 22.6 Mbps Width: 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate : 29.970 fps Color space : YUV Chroma subsampling : 4:2:0 Bit depth: 8 bits Scan type: Interlaced Scan order : Top Field First Bits/(Pixel*Frame) : 0.345 Stream size : 86.8 MiB (94%) Audio ID : 4352 (0x1100) Menu ID : 1 (0x1) Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Codec ID : 129 Duration : 34s 16ms Bit rate mode: Constant Bit rate : 256 Kbps Channel(s) : 2 channels Channel positions: Front: L R Sampling rate: 48.0 KHz Bit depth: 16 bits Compression mode : Lossy Delay relative to video : -34ms Stream size : 1.04 MiB (1%) Text ID : 4608 (0x1200) Menu ID : 1 (0x1) Format : PGS Codec ID : 144 Duration : 33s 602ms Delay relative to video : -34ms Here's a somewhat simplified version of my code. I use av_open_input_file, av_find_stream_info, avcodec_find_decoder, and avcodec_open in my helper functions. // Allocate video frame pFrame=avcodec_alloc_frame(); // Allocate an AVFrame structure pFrameYUV=avcodec_alloc_frame(); if(pFrameYUV==NULL) { return NULL; } // Determine required buffer size and allocate buffer numBytes=avpicture_get_size(PIX_FMT_YUV420P, width, height); buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); // Assign appropriate parts of buffer to image planes in pFrameYUV avpicture_fill((AVPicture *)pFrameYUV, buffer, PIX_FMT_YUV420P, width, height); AVFormatContext* pFormatCtx; pFormatCtx = pHelper->FormatContextPointer(); int videoStreamIndex = pHelper->VideoStreamIndex(); int frameScanCount = 0; AVCodecContext* pCodecCtx; pCodecCtx = pHelper->CodecContextPointer(); while (av_read_frame(pFormatCtx, &packet) >= 0) { // Is this a packet from the video stream? if (packet.stream_index == videoStreamIndex && frameLocation++) { // Decode video frame avcodec_decode_video2(pCodecCtx, pFrameYUV, &isFrameFinished, &packet); *// FOR THIS VIDEO, **isFrameFinished **IS ALWAYS 0* if (isFrameFinished == 0) { pLog->Write("Frame %d not finished", frameLocation); } // Did we get a video frame? if (isFrameFinished) { // do some analysis on the pixels } // whether we successfully decoded the frame } // whether we were supposed to decode the frame av_free_packet(&packet); } // for each available frame //delete [] buffer; av_free(buffer); av_free(pFrame); // Free the YUV frame av_free(pFrameYUV); Thanks! Simon ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
John, On 02/05/2012 10:29 PM, John Dexter wrote: > > If you're going to make such assertions please back them up. My > research into dynamic linking of (L)GPL libraries finds multiple > explicit claims that distribution of the library source code is _not_ > required if I haven't modified the original, according to LGPL section > 6, specifically 6b. > (http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html linked from > ffmpeg legal page). Section 6b applies only when the LGPL object is "already present on the user's computer system", that is, when installed by the user from other sources and your code just dynamically links to it. Whomever they got the binary from must comply with one of the other methods in section 6. If your installer supplies the LGPL DLLs, 6b doesn't apply to you. You will need to be prepared to offer the source code if you don't ship it with your installer. If you are getting the DLLs you use from a compliant third party, and they cease operating, you are still required to offer the source code for the versions you shipped. Maybe as long as three years later. Of course, I Am Not A Lawyer, and you are free to disagree. You should consult a real lawyer for a more definitive opinion. HTH, Phil ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
On 6 February 2012 03:03, Carl Eugen Hoyos wrote: > > John Dexter writes: > > > > [About http://ffmpeg.org/legal.html ] > > > > That page includes "distribute the ffmpeg source code". > > IIRC that's not a requirement for LGPL? > > It is a crystal-clear requirement. If you're going to make such assertions please back them up. My research into dynamic linking of (L)GPL libraries finds multiple explicit claims that distribution of the library source code is _not_ required if I haven't modified the original, according to LGPL section 6, specifically 6b. (http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html linked from ffmpeg legal page). John. ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
John Dexter writes: > > [About http://ffmpeg.org/legal.html ] > > That page includes "distribute the ffmpeg source code". > IIRC that's not a requirement for LGPL? It is a crystal-clear requirement. Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
On 5 February 2012 18:27, Carl Eugen Hoyos wrote: > > John Dexter writes: > > > (Or in other words: It will only affect you if you want H264 encoding > > but are not willing to buy a commercial x264 license.) > > > > Sorry, I need to ask about that in more detail after more thought. > > There are 2 separate issues here it seems... > > > > > > Whether I can use ffmpeg libraries to encode H264 without making my > > entire application GPL? > > > > Whether I need to pay for a H264 license > > > Is the situation I can use ffmpeg L-GPL if I pay for a H264 license, > > but without buying that license I can only use H264 for full GPL? > > Or am I totally misunderstanding the situation? > > The situation is that if you link your application against a GPL'd > library (or against libavcodec linking against a GPL'd library) > then your application gets GPL'd itself (or you are not complying > with the GPL, making you a copyright violator). > > The LGPL allows you to link against non-free object files as long > as you follow some restrictions - see http://ffmpeg.org/legal.html > - so if your H264 encoding library is *not* licensed under the GPL > (but a proprietary or "commercial" license) there should be no > problem. OK that is clearer - I missed that x264 was GPL and thought H264 was special some way. The rules about how using any GPL code makes my whole app GPL are clear. I'll look into this more and start a new discussion on specifics if needed. > > The remaining questions are certainly not within the scope of > this mailing list, please visit http://x264licensing.com/ Thanks for the link. > > Please set your mailer to "plain text" instead of html, Carl Eugen Is that a list rule? And, does _this_ mail conform? If so I'll try to remember in future. Thanks! ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
On 5 February 2012 18:42, Carl Eugen Hoyos wrote: > Carl Eugen Hoyos writes: > > > The list contains all things you have to do afaict, > > and some things that really make a lot of sense if you trying > > to fulfil the requirements of the LGPL (as opposed to trying > > very hard not to fulfil its concept and getting away with it). > > [About http://ffmpeg.org/legal.html ] > I just saw that above is of course not true for point 2 > (use dynamic linking) but since using static linking makes > conforming to the LGPL more difficult I think it clearly > counts as good advice. > > That page includes "distribute the ffmpeg source code". IIRC that's *not* a requirement for LGPL? There is no hidden insult, I am simply remarking a legal page should clearly differentiate between what is a legal requirement from the license, and what is considered polite. If we start adding what we *want* to what is mandatory, we end up confusing people. ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] using avconv to transmux MPEGTS over RTP to MPEGTS over UDP
Please run with adding option -loglevel debug It will make ./configure options appear in log, so we can try to reproduce the issue. Also maybe some more information will appear. What happens if you split this command into two? avconv -loglevel debug -i rtp://234.5.5.5:10201 -c copy out.ts then, if it succeeds, avconv -loglevel debug -i out.ts -vcodec copy -acodec copy -f mpegts udp://localhost: -- Andrey Utkin ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
Carl Eugen Hoyos writes: > The list contains all things you have to do afaict, > and some things that really make a lot of sense if you trying > to fulfil the requirements of the LGPL (as opposed to trying > very hard not to fulfil its concept and getting away with it). [About http://ffmpeg.org/legal.html ] I just saw that above is of course not true for point 2 (use dynamic linking) but since using static linking makes conforming to the LGPL more difficult I think it clearly counts as good advice. Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
Bruce Wheaton writes: > On Feb 5, 2012, at 8:38, Carl Eugen Hoyos > > (Or in other words: It will only affect you if you want H264 > > encoding but are not willing to buy a commercial x264 license.) > > Carl, for my own information - there are also some > 'less important' codecs that are GPL only, correct? Some video filters, the X11 framegrab code and the avs encoder are examples for GPL'd parts of FFmpeg. Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
John Dexter writes: > > Please consider reading the License Compliance Checklist on > > http://ffmpeg.org/legal.html and if you think anything is not > > clear on this page, please report! > > Since you mention it, I would prefer a list of what I MUST > do and a list of what you PREFER I do, in terms of > open-source etiquette :) (Not being a native speaker, I wonder if there is some insult hidden in this sentence...) The list contains all things you have to do afaict, and some things that really make a lot of sense if you trying to fulfil the requirements of the LGPL (as opposed to trying very hard not to fulfil its concept and getting away with it). Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
John Dexter writes: > (Or in other words: It will only affect you if you want H264 encoding > but are not willing to buy a commercial x264 license.) > > Sorry, I need to ask about that in more detail after more thought. > There are 2 separate issues here it seems... > > > Whether I can use ffmpeg libraries to encode H264 without making my > entire application GPL? > > Whether I need to pay for a H264 license > Is the situation I can use ffmpeg L-GPL if I pay for a H264 license, > but without buying that license I can only use H264 for full GPL? > Or am I totally misunderstanding the situation? The situation is that if you link your application against a GPL'd library (or against libavcodec linking against a GPL'd library) then your application gets GPL'd itself (or you are not complying with the GPL, making you a copyright violator). The LGPL allows you to link against non-free object files as long as you follow some restrictions - see http://ffmpeg.org/legal.html - so if your H264 encoding library is *not* licensed under the GPL (but a proprietary or "commercial" license) there should be no problem. The remaining questions are certainly not within the scope of this mailing list, please visit http://x264licensing.com/ Please set your mailer to "plain text" instead of html, Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
[Libav-user] using avconv to transmux MPEGTS over RTP to MPEGTS over UDP
Dear libav, i'm trying to use avconv to read MPEGTS over RTP and transfer it to MPEGTS over udp. here is the command line i'm using >avconv -i rtp://234.5.5.5:10201 -c copy -f mpegts udp://localhost: and here's the output avconv version v0.8-293-g86b57e4, Copyright (c) 2000-2011 the Libav > developers > built on Feb 4 2012 23:34:56 with gcc 4.5.2 > [NULL @ 006cf780] non-existing SPS 32 referenced in buffering period > [NULL @ 006cf780] non-existing PPS referenced > [h264 @ 006cf780] non-existing SPS 32 referenced in buffering period > [h264 @ 006cf780] non-existing PPS 0 referenced > [h264 @ 006cf780] decode_slice_header error > [h264 @ 006cf780] no frame! > [rtp @ 007fd8c0] Estimating duration from bitrate, this may be inaccurate > Input #0, rtp, from 'rtp://234.5.5.5:10201': > Duration: N/A, start: 669.528000, bitrate: 192 kb/s > Stream #0.0: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s > Stream #0.1: Video: h264 (Main), yuv420p, 1920x1080 [PAR 1:1 DAR > 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc > [mpegts @ 039ffb00] muxrate VBR, pcr every 9000 pkts, sdt every 200, > pat/pmt every 40 pkts > Output #0, mpegts, to 'udp://localhost:': > Metadata: > encoder : Lavf54.0.0 > Stream #0.0: Video: libx264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], > q=2-31, 90k tbn, 90k tbc > Stream #0.1: Audio: mp2, 48000 Hz, stereo, 192 kb/s > Stream mapping: > Stream #0:1 -> #0:0 (copy) > Stream #0:0 -> #0:1 (copy) > Press ctrl-c to stop encoding > [mpegts @ 039ffb00] first pts value must set > *av_interleaved_write_frame(): Operation not permitted* I tried various flags, but none seem to work, the transmuxing always fails with the same "*av_interleaved_write_frame(): Operation not permitted" * message btw, using avplay to play the same RTP stream, works. -- Aviad Rozenhek ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
> > (Or in other words: It will only affect you if you want H264 encoding > but are not willing to buy a commercial x264 license.) Sorry, I need to ask about that in more detail after more thought. There are 2 separate issues here it seems... 1. Whether I can use ffmpeg libraries to encode H264 without making my entire application GPL? 2. Whether I need to pay for a H264 license Is the situation I can use ffmpeg L-GPL if I pay for a H264 license, but without buying that license I can only use H264 for full GPL? Or am I totally misunderstanding the situation? John. ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
On 5 February 2012 16:38, Carl Eugen Hoyos wrote: > John Dexter writes: > > > 2. I had some concerns reading about the legal side, GPL and LGPL. Our > > software is totally closed source and while we use LGPL libraries, it > > sounded like some parts of ffmpeg are GPL-only. Will this realistically > > affect me > > It is your choice if you compile FFmpeg with support for GPL-parts > (which makes the whole library GPL and forbids linking against your > proprietary application) or without. > So only you know if it affects you or not. > I was aware some parts are GPL only and you can compile without those parts... but the legal page doesn't say which, and whether they 'matter'. But you follow on with > (Or in other words: It will only affect you if you want H264 encoding > but are not willing to buy a commercial x264 license.) > So is that the only major restriction? It sounds fairly major since I'm fairly sure our client demands H264 as the primary format. It's hardly part of ffmpeg I know, but any clarification what I can['t] do here would be awesome so I can clearly explain why (if) I can't provide what they consider the standard. Feel free to direct me elsewhere to discuss that topic. > > Please consider reading the License Compliance Checklist on > http://ffmpeg.org/legal.html and if you think anything is not > clear on this page, please report! > Since you mention it, I would prefer a list of what I MUST do and a list of what you PREFER I do, in terms of open-source etiquette :) Thanks! ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
On Feb 5, 2012, at 8:38, Carl Eugen Hoyos > (Or in other words: It will only affect you if you want H264 encoding > but are not willing to buy a commercial x264 license.) Carl, for my own information - there are also some 'less important' codecs that are GPL only, correct? And some scaling optimizations still? Bruce > > Please consider reading the License Compliance Checklist on > http://ffmpeg.org/legal.html and if you think anything is not > clear on this page, please report! > > Carl Eugen > > ___ > Libav-user mailing list > Libav-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Getting to grips with ffmpeg
John Dexter writes: > 2. I had some concerns reading about the legal side, GPL and LGPL. Our > software is totally closed source and while we use LGPL libraries, it > sounded like some parts of ffmpeg are GPL-only. Will this realistically > affect me It is your choice if you compile FFmpeg with support for GPL-parts (which makes the whole library GPL and forbids linking against your proprietary application) or without. So only you know if it affects you or not. (Or in other words: It will only affect you if you want H264 encoding but are not willing to buy a commercial x264 license.) Please consider reading the License Compliance Checklist on http://ffmpeg.org/legal.html and if you think anything is not clear on this page, please report! Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
[Libav-user] Remuxing mpegts udp stream, how to fill AVCodecContext.extradata of outgoing stream?
I have a mpegts file (h264/aac) which was created by dumping a mpegts udp stream to a file. (the file can be played with vlc etc. perfectly). Now I need to convert that file again to a stream (without decoding/encoding). If I simply parse the file and remux the frames to an mpegts udp stream the resulting stream is not really playable, vlc can play just fragments of video and audio and a lot of errors. (remuxing to a file in any format works though). Apparently the headers in the outgoing h264 and in the outgoing aac are missing, and to add them I need to fill the extradata of their CodecContext . Because I do not have an incoming stream anymore, but read a file, I cannot copy the extradata from the incoming stream's codec context (it is empty), but apparently I need to manually fill the extradata of the Context of the outgoing stream. Despite going through the mailing list archives up and down and scanning the source code of ffmpeg and libavcodec /libavformat (and googling for days) I still do not see how I can copy the header info from the (incoming) x264 and aac codecs into the extradata of the outgoing Codec Context. Any sample code (or pointer to source code) where I can see where to get the required info (priv_data?) and how to format and write it into extradata is very much appreciated! ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user