From brado at bighillsoftware.com Mon Apr 1 01:31:33 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 16:31:33 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> Message-ID: On Mar 31, 2013, at 1:25 AM, Alex Cohn wrote: > I am not sure when "duration" is taken into account, but you could > simply set current->pts = prev->pts+2. Note that this was my original > proposal. Alex -- I considered that approach, and essentially ran that same test -- manually manipulating the pts values that is. But the problem with this is twofold: - A "+2" pts increase likely will only work when you have an actual frame rate that is half that of the expected frame rate which is used to initially set the time_base. That's not my use case (the closest approximation is 24 fps expected, and on this particular computer / camera I'm testing with, 15fps. And I think in theory, the only video source that can feed an encoder with fixed-fps video is one that is fully known and controllable prior to encoding (like an existing video file, or just generating data like the examples do). More about this in a moment. - If I'm going to muck with the video pts in this fashion, the audio pts also has to be mucked with to keep it in sync, and of course, audio samples are received at a different rate than the video. So that's a complexity there. The bigger picture is the matter of having encoding determined by a frame rate-based time_base. As I alluded to above, unless you are just generating audio/video at runtime, or are reading from a file where the video obviously already exists and all the meta-data is available up front, I would think that any live capture video source is theoretically variable in nature, due to almost certain variances in hardware, computer, etc. That said, it raises the question of having a time base in terms of frame rate, rather than time-base in terms of time. One thing I encountered with some frequency in my Google journeys were blog posts and examples discussing actually setting time_base.den to 1000, not in terms of frame rate, but milliseconds in a second. This seems to make more sense to me, but there must be a reason, that time_base was pinned to frame rate (if anyone knows, I'd be interested to hear). I'm not sure if this was the intended design or not, but it seems peculiar to me that while I have sample buffers that provide exact presentation time (with scale), decode time (with scale), and duration time (with scale) for every single frame, this information does appear to be enough on its own to encode the frames with proper timing, simply because the codec context needs a fixed frame rate configured up front before encoding begins. Somehow that just seems wrong, and I feel like I must be missing something simple -- having all of this information should be enough for encoding. I'll ask this one again -- because I would think this would be the way to iron out the discrepancy: what is the net effect of duration on timing? If I set an accurate pts and dts (which I am, I have the exact info for these), why does setting the exact duration of the frame not account for the other missing piece of the puzzle. Essentially that info equals sequence, start time and length -- that would seem complete...any thoughts? Brad From kalileo at universalx.net Mon Apr 1 03:32:54 2013 From: kalileo at universalx.net (Kalileo) Date: Mon, 1 Apr 2013 08:32:54 +0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> Message-ID: <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> On Apr 1, 2013, at 06:31 , Brad O'Hearne wrote: > On Mar 31, 2013, at 1:25 AM, Alex Cohn wrote: >> I am not sure when "duration" is taken into account, but you could >> simply set current->pts = prev->pts+2. Note that this was my original >> proposal. > > Alex -- I considered that approach, and essentially ran that same test -- manually manipulating the pts values that is. But the problem with this is twofold: > > - A "+2" pts increase likely will only work when you have an actual frame rate that is half that of the expected frame rate which is used to initially set the time_base. That's not my use case (the closest approximation is 24 fps expected, and on this particular computer / camera I'm testing with, 15fps. And I think in theory, the only video source that can feed an encoder with fixed-fps video is one that is fully known and controllable prior to encoding (like an existing video file, or just generating data like the examples do). More about this in a moment. There's a lot of half-theory in your questions, and i get confused about your intentions. Do you want to solve a problem (of video/audio not being in sync) or do you want to redesign the dts/pts concept of video/audio syncing? > > - If I'm going to muck with the video pts in this fashion, the audio pts also has to be mucked with to keep it in sync, and of course, audio samples are received at a different rate than the video. So that's a complexity there. Didn't you say that it's _not_ in sync now? So obviously you've to correct one side, not do the same modification on both sides. I do not understand why you need to make this so complicated. It is so easy, same PTS = to be played at the same time. You cannot expect your player to play Audio with PTS 456789 at the same time as video with PTS 123456, but if audio and video both have a PTS around 456789 then most players will make an attempt to play them at the same time. Your stream, the one which is not in sync, have you checked the DTS/PTS values of audio and video at the beginning and later? If you do so, you see where they drift apart, and you get a hint what and where to correct. FFPROBE is your friend for such probing. As the gazillions of perfectly in sync videos out there show, the system is working, no matter if it's the best or not. But you must set the values to allow the system to work, that means if it is to be played at the same time, then PTS must be (about) the same. The beauty of this is that it works even if half of the other data is messed up, fps and whatever can be wrong, the player can use the audio as master and correct the video timing using PTS alone, and it plays perfectly in sync. Over and out. From brado at bighillsoftware.com Mon Apr 1 04:50:06 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 19:50:06 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> Message-ID: <30FAC343-08DE-4930-A26B-B3B9D39DB6EE@bighillsoftware.com> On Mar 31, 2013, at 6:32 PM, Kalileo wrote: Kalileo -- thanks for the reply. I'm not sure if you've read this thread and everything I've written, but based on the questions it appears you may have missed a post or two, so please forgive me if there's a rehash here. > There's a lot of half-theory in your questions, and i get confused about your intentions. Do you want to solve a problem (of video/audio not being in sync) or do you want to redesign the dts/pts concept of video/audio syncing? > Didn't you say that it's _not_ in sync now? So obviously you've to correct one side, not do the same modification on both sides. > > I do not understand why you need to make this so complicated. It is so easy, same PTS = to be played at the same time. I'll do my best to distill this all down as simply as possible. THE GOAL Capture video and audio from QTKit, pass the decompressed video and audio sample buffers to FFmpeg for encoding to FLV, and output the encoded frames (ultimately to a network stream, but in my present prototype app, a file). This is live capture-encode-stream use-case where the video is then being broadcast and played by multiple users in as near real-time as possible. Latency and delay needs to be minimized and eliminated to the degree it is possible. THE PROBLEM I have finally determined through many hours of testing that the problem here is NOT pts and dts values I am assigning. The values I am assigning to pts and dts are 100% accurate -- every video and audio sample buffer received from QuickTime (QTSampleBuffer) delivers its exact presentation time, decode time, and duration. When I plug these values into the AVPacket pts and dts values, video and audio is perfectly synced provided that -- and here's the crux of the issues -- the time_base.den value matches EXACTLY the *actual* frame rate of captured frames being returned. If the actual frame rate is different from the frame rate indicated in time_base.den, then the video does not play properly. In my specific use case, I had configured a minimum frame rate of 24 fps on my QTDecompressedVideoCaptureOutput, and so expecting that frame rate, I configured my codec context time_base.den to be 24 as well. What happened, however, is that despite being configured to output 24 fps, it actually output fewer fps, and when that happened, even though the pts and dts values were the exact ones delivered on the sample buffers, the video played much faster than it should, while the audio was still perfect. So I manually went through my console log, counted how many frames per second were actually being received from capture (15), and hard-coded 15 as the time_base.den value. I reran my code with no other changes, and the video and audio is synced perfectly. The problem is the nature of the time_base, and however internally it is being used in encoding. Here is the present problem in a single statement: the encoding process requires that the time_base.den value on the codec context be set *prior to encoding* to a fixed fps, but if actual fps varies from the time_base.den fps, the video doesn't play properly (and also any relative adjustment you try to make to pts in time_base units will be off as well). That's it in a nutshell -- there's no guarantee that a capture source is going to deliver frames at the fixed fps in the time_base, and if it doesn't, timing is off. THOUGHTS I don't know how the various codecs work internally (mine is adpcm_swf), but just from pounding on them with tests from the outside, it appears that the time_base.den governs most everything. As stated, unfortunately it wants a fixed value for a variable unit (in a capture scenario), so even though I have presentation time, decode time, and duration, the disparity between the actual frame rate and the time_base.den throws everything off. I am curious about the purpose and use of the AVPacket.duration value. I'm suspecting it isn't being used at all. I cannot verify this at this point, but I'm suspecting that one possibility of what is happening is that QuickTime could be accomplishing a 30fps frame rate by delivering 15fps with single frame duration * 2. I'd guess that if the codec context had a time_base oriented to time (such as milliseconds), a metric which does not fluctuate, and duration was considered, none of this would be a problem. Not knowing the internals of avcodec, however, I cannot say for sure. But QuickTime stuff is a different issue, and on the QuickTime side of things, and it doesn't change the problem in FFmpeg (and we are going to be doing the same thing on a Windows box soon, so it will be the same thing there with Windows hardware) -- differing cameras, computers, etc., the capture frame rate cannot be assumed as fixed (nor is it known up front) so having to specify an accurate fixed FPS for time_base.den is problematic, unless there's another way to rectify the problem. I hope that helps clear up any confusion. Thanks, Brad From brado at bighillsoftware.com Mon Apr 1 05:27:26 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 20:27:26 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: <30FAC343-08DE-4930-A26B-B3B9D39DB6EE@bighillsoftware.com> References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930-A26B-B3B 9D39DB6EE@bighillsoftware.com> Message-ID: On Mar 31, 2013, at 7:50 PM, Brad O'Hearne wrote: As a means of simplifying the root core of my problem even further, I've thought of an even simpler way to state the fundamental problem I'm having with FFmpeg encoding, here it is: I have video frames, and the exact presentation time, decode time, and duration time of each frame. I do not, however, have any idea what the actual frame rate of the video is, nor can I determine that up front. Given avcodec's need for the time_base to be assigned a value prior to encoding, and given that time_base.den is expected to be the frame rate (which is fixed, i.e. doesn't change throughout the encoding process), how can I encode my video such that its timings are accurate during playback? Thanks, Brad From kalileo at universalx.net Mon Apr 1 06:20:48 2013 From: kalileo at universalx.net (Kalileo) Date: Mon, 1 Apr 2013 11:20:48 +0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: <30FAC343-08DE-4930-A26B-B3B9D39DB6EE@bighillsoftware.com> References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3B9D39DB6EE@bighillsoftware.com> Message-ID: <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> On Apr 1, 2013, at 09:50 , Brad O'Hearne wrote: > On Mar 31, 2013, at 6:32 PM, Kalileo wrote: > > Kalileo -- thanks for the reply. I'm not sure if you've read this thread and everything I've written, but based on the questions it appears you may have missed a post or two, so please forgive me if there's a rehash here. I haven't read your _other_ threads. > >> There's a lot of half-theory in your questions, and i get confused about your intentions. Do you want to solve a problem (of video/audio not being in sync) or do you want to redesign the dts/pts concept of video/audio syncing? > >> Didn't you say that it's _not_ in sync now? So obviously you've to correct one side, not do the same modification on both sides. >> >> I do not understand why you need to make this so complicated. It is so easy, same PTS = to be played at the same time. > > I'll do my best to distill this all down as simply as possible. > > THE GOAL > Capture video and audio from QTKit, pass the decompressed video and audio sample buffers to FFmpeg for encoding to FLV, and output the encoded frames (ultimately to a network stream, but in my present prototype app, a file). This is live capture-encode-stream use-case where the video is then being broadcast and played by multiple users in as near real-time as possible. Latency and delay needs to be minimized and eliminated to the degree it is possible. > > THE PROBLEM > I have finally determined through many hours of testing that the problem here is NOT pts and dts values I am assigning. The values I am assigning to pts and dts are 100% accurate -- every video and audio sample buffer received from QuickTime (QTSampleBuffer) delivers its exact presentation time, decode time, and duration. When I plug these values into the AVPacket pts and dts values, video and audio is perfectly synced provided that -- and here's the crux of the issues -- the time_base.den value matches EXACTLY the *actual* frame rate of captured frames being returned. in other words, it works if you give the encoder correct values. > If the actual frame rate is different from the frame rate indicated in time_base.den, then the video does not play properly. in other words, it does not work if you give the encoder incorrect values. > In my specific use case, I had configured a minimum frame rate of 24 fps on my QTDecompressedVideoCaptureOutput, and so expecting that frame rate, I configured my codec context time_base.den to be 24 as well. What happened, however, is that despite being configured to output 24 fps, it a > ctually output fewer fps, and when that happened, even though the pts and dts values were the exact ones delivered on the sample buffers, Did you ever check the resulting video pts and dts values? When you say "the pts and dts values were the exact ones delivered on the sample buffers" you talk about the input, before encoding, and not the output, after encoding, right? > the video played much faster than it should, while the audio was still perfect. So I manually went through my console log, counted how many frames per second were actually being received from capture (15), and hard-coded 15 as the time_base.den value. I reran my code with no other changes, and the video and audio is synced perfectly. The problem is the nature of the time_base, and however internally it is being used in encoding. Some assumptions: Your encoder (!) does give the 16th frame the PTS the 16th frame at 25 fps would have received and not the PTS the 26th frame (at 25 fps) would have received. Hence when playing in a player audio and video drift 2/5th of a second apart, every second. How can the encoder possibly know that it gets 15 fps instead of the promised 25? It needs the correct info to calculate the next DTS/PTS. You would need to measure at the capture source (before you feed the encoder) what frame rate it is actually sending out, and set that (as you apparently somehow did eventually). Alternatively you could also measure the average framerate dynamically and, if that changes, manipulate the DTS/PTS _after_ encoding but _before_ writing. I found players to usually use the container's DTS/PTS values, so that's working, and I have done it in some projects. You simply get an average over the video frames per time unit, and use that value to adjust video DTS/PTS accordingly _after_ encoding but _before_ writing. And voila, variable fps implemented, should work in every player which goes by PTS and even better if it uses audio as master for syncing. From brado at bighillsoftware.com Mon Apr 1 06:57:24 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 21:57:24 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3 B9D39DB6EE@bighillsoftware.com> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> Message-ID: On Mar 31, 2013, at 9:20 PM, Kalileo wrote: >> In my specific use case, I had configured a minimum frame rate of 24 fps on my QTDecompressedVideoCaptureOutput, and so expecting that frame rate, I configured my codec context time_base.den to be 24 as well. What happened, however, is that despite being configured to output 24 fps, it a >> ctually output fewer fps, and when that happened, even though the pts and dts values were the exact ones delivered on the sample buffers, > > Did you ever check the resulting video pts and dts values? When you say "the pts and dts values were the exact ones delivered on the sample buffers" you talk about the input, before encoding, and not the output, after encoding, right? I checked them both. They are accurate when the time_base.den is hardcoded to the actual fps being received from capture. > How can the encoder possibly know that it gets 15 fps instead of the promised 25? It needs the correct info to calculate the next DTS/PTS. Therein lies the problem --the reality is that the actual fps is not known prior to encoding. So your question could be answered in another way: the capture frame rate is not known, nor can it be accurately known prior when the time_base.den needs to be set. Each frame however is delivered with accurate presentation time (based on time scale, not frame rate), decode time (based on time scale, not frame rate), and duration time (based on time scale, not frame rate). I suppose my thought is this -- instead of requiring the frame rate to calculate the next DTS/PTS, why is it that given both the DTS and PTS and the duration, it needs the frame rate to calculate the next DTS/PTS? Frame rate doesn't seem necessary with that info -- doesn't DTS/PTS + duration allow the next DTS/PTS to be calculated, essentially realizing whatever frame rate is taking place? Brad From kalileo at universalx.net Mon Apr 1 07:37:33 2013 From: kalileo at universalx.net (Kalileo) Date: Mon, 1 Apr 2013 12:37:33 +0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3 B9D39DB6EE@bighillsoftware.com> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> Message-ID: On Apr 1, 2013, at 11:57 , Brad O'Hearne wrote: > On Mar 31, 2013, at 9:20 PM, Kalileo wrote: >>> In my specific use case, I had configured a minimum frame rate of 24 fps on my QTDecompressedVideoCaptureOutput, and so expecting that frame rate, I configured my codec context time_base.den to be 24 as well. What happened, however, is that despite being configured to output 24 fps, it a >>> ctually output fewer fps, and when that happened, even though the pts and dts values were the exact ones delivered on the sample buffers, >> >> Did you ever check the resulting video pts and dts values? When you say "the pts and dts values were the exact ones delivered on the sample buffers" you talk about the input, before encoding, and not the output, after encoding, right? > > I checked them both. They are accurate when the time_base.den is hardcoded to the actual fps being received from capture. Which is confirming what we told you all the time ;) - make sure the PTS is correct and it will play correctly. > >> How can the encoder possibly know that it gets 15 fps instead of the promised 25? It needs the correct info to calculate the next DTS/PTS. > > Therein lies the problem --the reality is that the actual fps is not known prior to encoding. So your question could be answered in another way: the capture frame rate is not known, nor can it be accurately known prior when the time_base.den needs to be set. Each frame however is delivered with accurate presentation time (based on time scale, not frame rate), decode time (based on time scale, not frame rate), and duration time (based on time scale, not frame rate). > > I suppose my thought is this -- instead of requiring the frame rate to calculate the next DTS/PTS, why is it that given both the DTS and PTS and the duration, it needs the frame rate to calculate the next DTS/PTS? Frame rate doesn't seem necessary with that info -- doesn't DTS/PTS + duration allow the next DTS/PTS to be calculated, essentially realizing whatever frame rate is taking place? That sounds possible. But then again, if you know the duration, you know the fps, and can set it. Being able to change the fps value on the fly might be a simpler way than to give each frame a duration. From brado at bighillsoftware.com Mon Apr 1 07:40:38 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 22:40:38 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3 B9D39DB6EE@bighillsoftware.com> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> Message-ID: On Mar 31, 2013, at 10:37 PM, Kalileo wrote: > Being able to change the fps value on the fly might be a simpler way than to give each frame a duration. Can that be done? I was under the impression that time_base.den had to be set up front and couldn't be changed mid-encoding. If changing the time_base.den every frame is perfectly fine, and won't corrupt things, then that certainly would be the way to go. Brad From alexcohn at netvision.net.il Mon Apr 1 08:36:06 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Mon, 1 Apr 2013 09:36:06 +0300 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> Message-ID: On 1 Apr 2013 07:57, "Brad O'Hearne" wrote: > I suppose my thought is this -- instead of requiring the frame rate to calculate the next DTS/PTS, why is it that given both the DTS and PTS and the duration, it needs the frame rate to calculate the next DTS/PTS? Frame rate doesn't seem necessary with that info -- doesn't DTS/PTS + duration allow the next DTS/PTS to be calculated, essentially realizing whatever frame rate is taking place? Video encoding is all about legacy standards, legacy players, legacy devices. Some support predefined frame rate, some allow choosing an arbitrary frame rate, others allow even choosing duration per frame. If you can verify that your expected player accepts time-base.den = 1000, go for that as it gives you higher flexibility. On the other hand, 23.976 frames/s enjoys a bit wider support. Between these two extremes lay your options. And remember, frame rate /duration may be set per stream or per container, and in many different ways. Not necessarily changes to the way you time-code your video, require changes for the audio stream. BR, Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Mon Apr 1 08:36:51 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 31 Mar 2013 23:36:51 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3 B9D39DB6EE@bighillsoftware.com> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> Message-ID: <1609126D-9362-47D5-9FD8-06F1DFA21D52@bighillsoftware.com> On Mar 31, 2013, at 10:40 PM, Brad O'Hearne wrote: > On Mar 31, 2013, at 10:37 PM, Kalileo wrote: >> Being able to change the fps value on the fly might be a simpler way than to give each frame a duration. > > Can that be done? I was under the impression that time_base.den had to be set up front and couldn't be changed mid-encoding. If changing the time_base.den every frame is perfectly fine, and won't corrupt things, then that certainly would be the way to go. Presuming there's no unknowns about changing the time_base.den on the fly throughout encoding, problem solved. Throughout the weeks of Googling and reading endless source code, forum / mailing list posts, blogs, etc. on this, I had picked up the impression that time_base.den was to be set once prior to encoding and not mucked with thereafter. However, I just used the duration to calculate the frame rate and now I'm setting the time_base.den prior to pts and dts for every frame. Works great. Provided that there aren't any surprises in returning back to outputting over a network stream (I had changed my original need to outputting to a file for simpler testing), it appears I've bested this use case. I want to thank everyone who took time to dialog and lend their knowledge and assistance with my questions, it is greatly appreciated. While it was moderately easy to get an initial body of source code together for solving this problem, this was a fairly difficult problem to solve. There were many nuances and things to figure out which never surfaced in questions I posted to this mailing list. Answers to questions were not easy to find -- I'm not sure about the history of the source code, but the examples and posts around the Internet seemed to present a fair number of red herrings and disinformation (perhaps unintended). Anyway, this is all to say that the source code I used to prototype this pipeline is out on Github, free for anyone else's reference: https://github.com/BigHillSoftware/QTFFmpeg Hopefully this will help any new travelers using FFmpeg on a Mac, encoding with QTKit, and perhaps save them a little time down the road. Thanks again to everyone who helped, Cheers, Brad From 401478138 at qq.com Mon Apr 1 10:23:01 2013 From: 401478138 at qq.com (Zhang Yi) Date: Mon, 01 Apr 2013 16:23:01 +0800 Subject: [Libav-user] How to get PPS and SPS information from Codec Context when encoding H264 from iOS camera. Message-ID: Hi, everyone I am developing an app on iOS based on ffmpeg. I want stream live video from iPhone camera to Red5 server. I had captured the frame from iPhone camera and converted the frame into H264 format. Now I need to extract SPS and PPS information from CodecContext.extradata.. I had seen some posts with h264_mp4toannexb bitstream filter to extract SPS and PPS information. But have no idea how to extract. I'm sure the experts here can confirm or correct me, and explain better what to do. Best Regards, Yi Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From mike at mikeversteeg.com Mon Apr 1 10:45:42 2013 From: mike at mikeversteeg.com (Mike Versteeg) Date: Mon, 1 Apr 2013 10:45:42 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: Thanks John. As I said this is more prone to jitter than a timer event. I've also remember to change the priority but oddly enough, at least on W7, it makes no difference: I still get the occasional (exact) 10 ms delay, which almost never happens when using a timer. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Mon Apr 1 11:57:21 2013 From: rjvbertin at gmail.com (=?ISO-8859-1?Q?Ren=E9_J=2EV=2E_Bertin?=) Date: Mon, 1 Apr 2013 11:57:21 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: On 1 April 2013 10:45, Mike Versteeg wrote: > Thanks John. As I said this is more prone to jitter than a timer event. > I've also remember to change the priority but oddly enough, at least on W7, > it makes no difference: I still get the occasional (exact) 10 ms delay, > which almost never happens when using a timer. > I presume MS Windows still doesn't provide timers with <1ms resolution, be it event-based or something like usleep/nanosleep? I haven't seen your original post, but I've already struggled myself to get reliable 1kHz realtime behaviour without external hardware. I ended up with a busy-wait loop, (hogging the CPU was acceptable in my case). R -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicolas.george at normalesup.org Mon Apr 1 12:07:34 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 1 Apr 2013 12:07:34 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: <20130401100734.GA22484@phare.normalesup.org> Le duodi 12 germinal, an CCXXI, Ren? J.V. Bertin a ?crit?: > I presume MS Windows still doesn't provide timers with <1ms resolution, be > it event-based or something like usleep/nanosleep? I haven't seen your > original post, but I've already struggled myself to get reliable 1kHz > realtime behaviour without external hardware. I ended up with a busy-wait > loop, (hogging the CPU was acceptable in my case). Basic sanity check: I hope everyone here realizes that on a non-real time OS, even a timer with that kind of nominal precision can end up waiting a few dozens milliseconds because the screen saver activated or a page was needed from the swap? Modern hardware, with multicore CPUs and loads of memory, make this less severe a problem, but you still get no guarantee at all. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From nicolas.george at normalesup.org Mon Apr 1 12:14:36 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 1 Apr 2013 12:14:36 +0200 Subject: [Libav-user] error when calling avfilter_graph_create_filter In-Reply-To: References: Message-ID: <20130401101436.GF22484@phare.normalesup.org> Le septidi 7 germinal, an CCXXI, Richard Schilling a ?crit?: > I think I'm passing all the right parameters to > avfilter_graph_create_filter, but I still get a return value of -22, which > seems to indicate a parameter problem. I'm missing some detail here?. > > Can anyone tell me what's wrong with the call to > avfilter_graph_create_filter in the function below? Thanks. > char args[256]; > ret = avfilter_graph_create_filter(&in_filter_ctx, > input_filter, "src", args, NULL, graph); There is nothing in your "args" string except random data that was sitting on the stack. 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 mike at mikeversteeg.com Mon Apr 1 12:18:39 2013 From: mike at mikeversteeg.com (Mike Versteeg) Date: Mon, 1 Apr 2013 12:18:39 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: @Rene: not that I know, and 1 ms will be very unreliable. @Nicolas: Yes, and this is often said. However these days using a timer you get very reliable and stable periods with hardly any jitter. Unless your period needs to be (on average) 33.33 ms, then timers won't do. It's really odd Windows does not provide in this, nor (apparently) libav*. But at least now I know it is what it is and we'll have to do with loops/sleep. Thanks everyone. -------------- next part -------------- An HTML attachment was scrubbed... URL: From rjvbertin at gmail.com Mon Apr 1 14:59:32 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 1 Apr 2013 14:59:32 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: <20130401100734.GA22484@phare.normalesup.org> References: <20130401100734.GA22484@phare.normalesup.org> Message-ID: <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> On Apr 01, 2013, at 12:07, Nicolas George wrote: >> original post, but I've already struggled myself to get reliable 1kHz >> realtime behaviour without external hardware. I ended up with a busy-wait >> loop, (hogging the CPU was acceptable in my case). > > Basic sanity check: I hope everyone here realizes that on a non-real time > OS, even a timer with that kind of nominal precision can end up waiting a > few dozens milliseconds because the screen saver activated or a page was > needed from the swap? Modern hardware, with multicore CPUs and loads of > memory, make this less severe a problem, but you still get no guarantee at > all. > Of course, presuming your remark concerned the last bit of my post. I may be mistaken, but I think that the higher your timer precision, the lower the jitter such 'force-majeur' events produce (or, the jitter is proportional to your timer's precision). Right? @Mike : 1ms will be very unreliable in what scenario? Using an MS timer? My experience would agree with that... Just as an anecdote: I worked in a driving simulation laboratory until about a year ago. They use a software base that used to run on SGI workstations, then under Linux, and nowadays under MS Windows (because of graphics driver support). The last versions I've seen run under WinXP had an infrequent issue where the visual would sometimes freeze for a second or 2. This was visible, EXCEPT in the logs, as if time had stood still during those lapses. And indeed, switching to "real time" priority would preempt the machine to a large extent, but not improve timing regularity by that much. R From tksharpless at gmail.com Mon Apr 1 15:24:52 2013 From: tksharpless at gmail.com (Thomas Sharpless) Date: Mon, 1 Apr 2013 09:24:52 -0400 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: On Mon, Apr 1, 2013 at 6:18 AM, Mike Versteeg wrote: > @Rene: not that I know, and 1 ms will be very unreliable. > > @Nicolas: Yes, and this is often said. However these days using a timer > you get very reliable and stable periods with hardly any jitter. Unless > your period needs to be (on average) 33.33 ms, then timers won't do. > > It's really odd Windows does not provide in this, nor (apparently) libav*. > But at least now I know it is what it is and we'll have to do with > loops/sleep. Thanks everyone. > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > Really odd indeed. So, bottom line, how do commercial movie/video players generate correct frame rates? Or don't they? -------------- next part -------------- An HTML attachment was scrubbed... URL: From mybrokenbeat at gmail.com Mon Apr 1 15:41:13 2013 From: mybrokenbeat at gmail.com (Oleg) Date: Mon, 1 Apr 2013 16:41:13 +0300 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: References: Message-ID: Your eye and ear will not see\hear difference if audio or video stream will be late on +\- 10ms. So video players don't need to render exact framerate. 01.04.2013, ? 16:24, Thomas Sharpless ???????(?): > > > On Mon, Apr 1, 2013 at 6:18 AM, Mike Versteeg wrote: > @Rene: not that I know, and 1 ms will be very unreliable. > > @Nicolas: Yes, and this is often said. However these days using a timer you get very reliable and stable periods with hardly any jitter. Unless your period needs to be (on average) 33.33 ms, then timers won't do. > > It's really odd Windows does not provide in this, nor (apparently) libav*. But at least now I know it is what it is and we'll have to do with loops/sleep. Thanks everyone. > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > Really odd indeed. So, bottom line, how do commercial movie/video players generate correct frame rates? Or don't they? > > _______________________________________________ > 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 Apr 1 16:02:55 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 1 Apr 2013 16:02:55 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> References: <20130401100734.GA22484@phare.normalesup.org> <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> Message-ID: <20130401140255.GA32535@phare.normalesup.org> Le duodi 12 germinal, an CCXXI, "Ren? J.V. Bertin" a ?crit?: > I may be mistaken, but I think that the higher your timer precision, the > lower the jitter such 'force-majeur' events produce (or, the jitter is > proportional to your timer's precision). Right? I believe you are wrong: you mix timer precision and time slice. On a NOHZ Linux x86_64 kernel and an idle system, the precision of nanosleep seems to be 100 ?s, but if your system is busy, the process will be preempted for a full time slice, and that is much larger, above 500 ?s. Regards, -- Nicolas George -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From rjvbertin at gmail.com Mon Apr 1 16:52:00 2013 From: rjvbertin at gmail.com (=?iso-8859-1?Q?=22Ren=E9_J=2EV=2E_Bertin=22?=) Date: Mon, 1 Apr 2013 16:52:00 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: <20130401140255.GA32535@phare.normalesup.org> References: <20130401100734.GA22484@phare.normalesup.org> <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> <20130401140255.GA32535@phare.normalesup.org> Message-ID: <04144FE6-E4C1-48EB-B248-EF320ED8AC42@gmail.com> On Apr 01, 2013, at 16:02, Nicolas George wrote: > Le duodi 12 germinal, an CCXXI, "Ren? J.V. Bertin" a ?crit : >> I may be mistaken, but I think that the higher your timer precision, the >> lower the jitter such 'force-majeur' events produce (or, the jitter is >> proportional to your timer's precision). Right? > > I believe you are wrong: you mix timer precision and time slice. > > On a NOHZ Linux x86_64 kernel and an idle system, the precision of nanosleep > seems to be 100 ?s, but if your system is busy, the process will be > preempted for a full time slice, and that is much larger, above 500 ?s. > > Regards, In any case we seem to agree that it all depends on how the timer is implemented, and of course that goes both ways. Your nanosleep function that has a precision 100000x worse than what one might expect seems to be a good case in point. (What's a NOHZ kernel?) From i.like.privacy.too at gmail.com Mon Apr 1 17:17:34 2013 From: i.like.privacy.too at gmail.com (Camera Man) Date: Mon, 01 Apr 2013 18:17:34 +0300 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: <20130401140255.GA32535@phare.normalesup.org> References: <20130401100734.GA22484@phare.normalesup.org> <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> <20130401140255.GA32535@phare.normalesup.org> Message-ID: <5159A50E.30302@gmail.com> An HTML attachment was scrubbed... URL: From nicolas.george at normalesup.org Mon Apr 1 17:27:56 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Mon, 1 Apr 2013 17:27:56 +0200 Subject: [Libav-user] Best way to create a fractional ms timer? In-Reply-To: <04144FE6-E4C1-48EB-B248-EF320ED8AC42@gmail.com> References: <20130401100734.GA22484@phare.normalesup.org> <1B13EA73-6F06-4480-9E40-11E804F42B1A@gmail.com> <20130401140255.GA32535@phare.normalesup.org> <04144FE6-E4C1-48EB-B248-EF320ED8AC42@gmail.com> Message-ID: <20130401152756.GA19078@phare.normalesup.org> Le duodi 12 germinal, an CCXXI, "Ren? J.V. Bertin" a ?crit?: > In any case we seem to agree that it all depends on how the timer is > implemented, and of course that goes both ways. Of course, but there are standard kernel designs for that. > (What's a NOHZ kernel?) The traditional way of implementing timing in an operating system kernel is to have a periodic timer interrupt: each time the interrupt is triggered, the kernel checks whether something needs to be done. This includes userland timers and sleep functions, but also timed operations at the kernel level, such as forcing disk cache flush or TCP retransmits. Problem: an interrupt into kernel space is expensive, several hundreds or thousands of CPU cycles; you do not want them too frequent. On the other hand, all timed operations will have the accuracy of the timer interrupt: this is a balance between efficiency and cost. IIRC, the timer interrupt for Minix (late eighties) ran at 60 Hz; the Linux kernel used to run at 100 Hz, but as hardware grew faster, options to make it 250 Hz or 1000 Hz were added. There is a newer design, where the kernel computes the exact time for the next task, and sets the interrupt controller to trigger an interrupt at exactly that time. In Linux, this design is called NOHZ. This design is slightly more complex to program, but much more efficient, since it reduces the interrupt overhead to its exact minimum while allowing a much better accuracy. For tightly embedded systems, just waking the CPU 100 times per second for an interrupt and a few trivial computations would have a significant impact on the power consumption, that the NOHZ design eliminates. I am not sure whether the NOHZ design is practical, or even possible, on older hardware, especially the old i8253 used in the PC architecture: it requires an interrupt timer that can be re-programmed with a very low overhead. All this is completely orthogonal to the time slice issue. A time slice is the amount of time dedicated to a process in a preemptive multitasking environment: if the process has run for that amount of time, the kernel will preempt it and see if someone else wants to run. In real world situations, this is of course made more complex by conditions about process priority and such. Preempting a process is very expensive: it has all the costs of an interrupt, and more, since all CPU caches become useless. For that reason, time slices can be quite large. There is no link between timer interrupts and time slices except that preempting is a timed operation like any other, and therefore is subject to the accuracy of the timer interrupt. I suspect reading a good book on kernel design would be a good idea for anyone who intends to do advanced programming. The standard reference is of course Tanenbaum & Woodhull. 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 rogerdpack2 at gmail.com Mon Apr 1 23:33:04 2013 From: rogerdpack2 at gmail.com (Roger Pack) Date: Mon, 1 Apr 2013 15:33:04 -0600 Subject: [Libav-user] Choppy dshow audio playback with ffplay In-Reply-To: References: Message-ID: what if you just record locally (no UDP) does it die? On 12/24/12, Taha Ansari wrote: > Hi! > > I have a small test application that sends microphone audio over network. > But the audio playback is sometimes very choppy/lossy, and also I initially > need to 'seek' ffplay back to hear audio with minimum latency. I do this in > Windows, using dshow, zeranoe ffmpeg builds, MSVS; and here is custom code > of relevance (output file is in extension .mp2, and packets are sent on > udp. I tried AAC extension as well, but results are somewhat the same): > > *********** + Decoding part: + ************* > if(this->packet.stream_index == this->audioStream) > { > unsigned int samples_size= 0; > AVCodecContext *c = outputCodecCtxAudio; > int finalPTS = 0; > samples = (short *) av_fast_realloc(samples, &samples_size, > FFMAX(packet.size, AVCODEC_MAX_AUDIO_FRAME_SIZE)); > finalPTS = packet.pts; > audiobufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*2; > avcodec_decode_audio3(pCodecCtxAudio, samples, &audiobufsize, > &packet); > > > if(pCodecCtxAudio->sample_rate != c->sample_rate || > pCodecCtxAudio->channels != c->channels ) > { > if ( rs == NULL) > { > rs = av_audio_resample_init(c->channels, > pCodecCtxAudio->channels, c->sample_rate, pCodecCtxAudio->sample_rate, > AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, 0,0,0,0); > } > } > if(pCodecCtxAudio->sample_rate != c->sample_rate || > pCodecCtxAudio->channels != c->channels) > { > int size_out = audio_resample(rs, (short *)buffer_resample, > samples, audiobufsize/ (pCodecCtxAudio->channels * 2) ); > av_fifo_generic_write(fifo, (uint8_t *)buffer_resample, > size_out * c->channels * 2, NULL ); > } > else > { > av_fifo_generic_write(fifo, (uint8_t *)samples, audiobufsize, > NULL ); > } > } > *********** - Decoding part: - ************* > > *********** + Encoding part: + *************** > if ( decoderData->audiobufsize ) > { > AVPacket pkt; > av_init_packet(&pkt); > > AVCodecContext* c = encoderData->audio_st->codec; > > int frame_bytes = c->frame_size * 2 * c->channels; > > while( av_fifo_size(decoderData->fifo) >= frame_bytes ) > { > int ret = av_fifo_generic_read( decoderData->fifo, data_buf, > frame_bytes, NULL ); > /* encode the samples */ > pkt.size= avcodec_encode_audio(c, audio_out, frame_bytes > /*packet.size*/, (short *)data_buf); > > pkt.stream_index= encoderData->audio_st->index; > pkt.data= audio_out; > pkt.flags |= AV_PKT_FLAG_KEY; > > pkt.pts = pkt.dts = 0; > /* write the compressed frame in the media file */ > if (av_interleaved_write_frame(encoderData->ocAud, &pkt) != 0) > { > fprintf(stderr, "Error while writing audio frame\n"); > exit(1); > } > } > } > *********** - Encoding part: - *************** > > Other code is similar to the muxing.c example that comes with the builds. I > know the functions used above are kind of outdated, but that is the best > working source I could find from the internet. > > Can anyone kindly highlight how I could improve my code, or do I need to > tweak ffplay somehow for better results? > > Thanks for your time, > > Best regards > From mtaha.ansari at gmail.com Tue Apr 2 08:01:39 2013 From: mtaha.ansari at gmail.com (Taha Ansari) Date: Tue, 2 Apr 2013 11:01:39 +0500 Subject: [Libav-user] Choppy dshow audio playback with ffplay In-Reply-To: References: Message-ID: Hi! Thanks for your reply - I just tried your suggestion, and recorded approximately 1.5 minutes of audio, and saved it to a file on hard-disk (no UDP involved). There are no cut-offs or choppy playback; all voice is apparently recorded fine. So this means above mentioned routines are working properly. So that leaves UDP channel and decoding/playback on other end. Since managing changing of destination file (local vs. UDP) is something managed by FFmpeg itself (and for testing purpose I am always on same network), there are more chances there is something not optimized on the decoding end. On Tue, Apr 2, 2013 at 2:33 AM, Roger Pack wrote: > what if you just record locally (no UDP) does it die? > > On 12/24/12, Taha Ansari wrote: > > Hi! > > > > I have a small test application that sends microphone audio over network. > > But the audio playback is sometimes very choppy/lossy, and also I > initially > > need to 'seek' ffplay back to hear audio with minimum latency. I do this > in > > Windows, using dshow, zeranoe ffmpeg builds, MSVS; and here is custom > code > > of relevance (output file is in extension .mp2, and packets are sent on > > udp. I tried AAC extension as well, but results are somewhat the same): > > > > *********** + Decoding part: + ************* > > if(this->packet.stream_index == this->audioStream) > > { > > unsigned int samples_size= 0; > > AVCodecContext *c = outputCodecCtxAudio; > > int finalPTS = 0; > > samples = (short *) av_fast_realloc(samples, &samples_size, > > FFMAX(packet.size, AVCODEC_MAX_AUDIO_FRAME_SIZE)); > > finalPTS = packet.pts; > > audiobufsize = AVCODEC_MAX_AUDIO_FRAME_SIZE*2; > > avcodec_decode_audio3(pCodecCtxAudio, samples, &audiobufsize, > > &packet); > > > > > > if(pCodecCtxAudio->sample_rate != c->sample_rate || > > pCodecCtxAudio->channels != c->channels ) > > { > > if ( rs == NULL) > > { > > rs = av_audio_resample_init(c->channels, > > pCodecCtxAudio->channels, c->sample_rate, pCodecCtxAudio->sample_rate, > > AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16, 0,0,0,0); > > } > > } > > if(pCodecCtxAudio->sample_rate != c->sample_rate || > > pCodecCtxAudio->channels != c->channels) > > { > > int size_out = audio_resample(rs, (short *)buffer_resample, > > samples, audiobufsize/ (pCodecCtxAudio->channels * 2) ); > > av_fifo_generic_write(fifo, (uint8_t *)buffer_resample, > > size_out * c->channels * 2, NULL ); > > } > > else > > { > > av_fifo_generic_write(fifo, (uint8_t *)samples, audiobufsize, > > NULL ); > > } > > } > > *********** - Decoding part: - ************* > > > > *********** + Encoding part: + *************** > > if ( decoderData->audiobufsize ) > > { > > AVPacket pkt; > > av_init_packet(&pkt); > > > > AVCodecContext* c = encoderData->audio_st->codec; > > > > int frame_bytes = c->frame_size * 2 * c->channels; > > > > while( av_fifo_size(decoderData->fifo) >= frame_bytes ) > > { > > int ret = av_fifo_generic_read( decoderData->fifo, data_buf, > > frame_bytes, NULL ); > > /* encode the samples */ > > pkt.size= avcodec_encode_audio(c, audio_out, frame_bytes > > /*packet.size*/, (short *)data_buf); > > > > pkt.stream_index= encoderData->audio_st->index; > > pkt.data= audio_out; > > pkt.flags |= AV_PKT_FLAG_KEY; > > > > pkt.pts = pkt.dts = 0; > > /* write the compressed frame in the media file */ > > if (av_interleaved_write_frame(encoderData->ocAud, &pkt) != > 0) > > { > > fprintf(stderr, "Error while writing audio frame\n"); > > exit(1); > > } > > } > > } > > *********** - Encoding part: - *************** > > > > Other code is similar to the muxing.c example that comes with the > builds. I > > know the functions used above are kind of outdated, but that is the best > > working source I could find from the internet. > > > > Can anyone kindly highlight how I could improve my code, or do I need to > > tweak ffplay somehow for better results? > > > > Thanks for your time, > > > > Best regards > > > _______________________________________________ > 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 mpupilli at gmail.com Tue Apr 2 15:31:02 2013 From: mpupilli at gmail.com (Mark Pupilli) Date: Tue, 2 Apr 2013 14:31:02 +0100 Subject: [Libav-user] Double free/corruption problem. In-Reply-To: References: Message-ID: On 7 December 2012 18:51, Mark Pupilli wrote: > I get a double free or corruption problem, should really do a bug > report but don't have time to decipher the FFmpeg bug reporting page. > I'll post it here in case anyone is interested, feel free to ignore. > > When using custom IO for reading involves something like the > following when creating a context: > > buffer = (uint8_t*)av_malloc( BUFFER_SIZE ); > ctxt = avio_alloc_context( buffer, BUFFER_SIZE, 0, this, > read_function, NULL, NULL ); > > and then to free it: > > av_free( ctxt ); > av_free( buffer ); > > However, if BUFFER_SIZE > 32768 bytes then av_free( buffer ) results > in a crash due to invalid free/delete (which can also be detected by > valgrind). > Not calling av_free( buffer ) leads to a memory leak (reported by > valgrind). > > In the case of calling av_free() Valgrind reports the buffer as > already being free'd in: > > ==5471== Address 0x9181680 is 0 bytes inside a block of size 32,784 free'd > ==5471== at 0x4C2A82E: free (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==5471== by 0x712EC6F: av_free (mem.c:186) > ==5471== by 0x6DBEFC4: ffio_set_buf_size (aviobuf.c:707) > ==5471== by 0x6DBE1E5: fill_buffer (aviobuf.c:408) > ==5471== by 0x6DBE570: avio_read (aviobuf.c:495) > ==5471== by 0x6DE8971: ff_id3v2_read (id3v2.c:748) > ==5471== by 0x6EA4F42: avformat_open_input (utils.c:638) > > which if you follow the call in a debugger leads to the culprit at > aviobuf.c:408: > > /* make buffer smaller in case it ended up large after probing */ > if (s->read_packet && s->buffer_size > max_buffer_size) { > ffio_set_buf_size(s, max_buffer_size); > > s->checksum_ptr = dst = s->buffer; > len = s->buffer_size; > } > > This only gets called when we are reading. So in the case of using > custom input libav takes it upon itself to tinker with the user > supplied buffer. The crash only occurs if the buffer size is larger > than 32KB > which in my case it was because I was trying to follow some examples > which show allocating (32768 + FF_INPUT_BUFFER_PADDING_SIZE) bytes. > > I don't know if the bug is that libav is supposed to give an error if > the buffer is larger than 32KB, or not tinker with user supplied > buffers, or avio_alloc_context should take a ** to the buffer so it > can reallocate properly and clients don't have > to choose between a double free or a memory leak, but its definitely > wrong one way or another. I actually do not understand why the user > needs to pass in the buffer at all as it seems avio_alloc_context > could do it internally if it is going to > reallocate it on a whim anyway. > > regards, > Mark > A couple of users have contacted me about this since. One of them has a workaround for the bug (thanks Keith!): Before you free the avio buffer: check that the pointer in the AVIOContext structure is the same as the buffer you allocated yourself and passed to avio_alloc_context(...) - if it is the same you can safely free it, if it is not the same then the library has already freed and reallocated the buffer (and will automatically free the buffer it allocated) so there is no need to do anything. Another workaround is to only ever allocate a buffer of size 32768 bytes because the library does not appear to re-allocate the io buffer in that case but I think the above workaround is more future proof against any crazy stuff the library might do with the buffers you give it in future releases. Mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Tue Apr 2 18:43:12 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 18:43:12 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/3/30 Carl Eugen Hoyos > Lars Hammarstrand writes: > > Please try to fix your quoting / set your mailer to text-only. > > [ Off topic: Sorry - no can do, gmail standard. What mail client do you use? ] Tested to run ffmpeg (the tool) and it crashes every time exactly on the same spot as xbmc! Has n1.2 ever been tested on IOS? Question: shall I create a ticet on ffmpeg.org or at libav.org (since the ARM HW optz orginates from Mans Mullgards work) or both maybe? Output from gdb on IOS: 18:09:52 root at iPhone-4 /ffmpeg-n1.2 $ *uname -a* Darwin iPhone-4 11.0.0 Darwin Kernel Version 11.0.0: Sun Apr 8 21:51:26 PDT 2012; root:xnu-1878.11.10~1/RELEASE_ARM_S5L8930X iPhone3,1 arm N90AP Darwin $ *gdb ffmpeg* GNU gdb 6.3.50-20050815 (Apple version gdb-1821) (Fri Jun 29 08:41:41 UTC 2012) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "arm-apple-darwin"...Reading symbols for shared libraries . done (gdb) *r ffmpeg -i http://techslides.com/demos/sample-videos/small.mp4-acodec copy -vcodec copy output.mp4 * Starting program: /ffmpeg-n1.2/ffmpeg ffmpeg -i http://techslides.com/demos/sample-videos/small.mp4 -acodec copy -vcodec copy output.mp4 Reading symbols for shared libraries ......................... done ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers built on Apr 2 2013 17:54:06 with llvm-gcc 4.2.1 (LLVM build 2410.2.00) configuration: --disable-ffplay --disable-ffserver --disable-ffprobe --disable-doc --disable-bzlib --target-os=darwin --enable-cross-compile --enable-gpl --enable-version3 --arch=arm --cpu=cortex-a8 --enable-pic --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --extra-cflags='-mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad' --enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2 --enable-optimizations --enable-debug=3 --disable-stripping --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='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/iPhoneOS6.1.sdk --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand. ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 Line number 405 out of range; h264pred_neon.S has 359 lines. (gdb) *bt* #0 ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 #1 0x003fc75a in hl_decode_mb_simple_8 (h=0x0) at h264_mb_template.c:161 #2 0x003fdad8 in ff_h264_hl_decode_mb (h=) at /ffmpeg-n1.2/libavcodec/h264.c:2415 #3 0x00401da4 in decode_slice (avctx=, arg=) at /ffmpeg-n1.2/libavcodec/h264.c:4266 #4 0x00402380 in execute_decode_slices () at /ffmpeg-n1.2/libavcodec/h264.c:4355 #5 0x00402dec in decode_nal_units (h=0xf00000, buf=0xd25484 "", buf_size=4207149, parse_extradata=0) at /ffmpeg-n1.2/libavcodec/h264.c:4699 #6 0x004033d6 in decode_frame (avctx=0x1253800, data=0x0, got_frame=0x2fdfef8c, avpkt=) at /ffmpeg-n1.2/libavcodec/h264.c:4811 #7 0x003247ce in avcodec_decode_video2 (avctx=0x1253800, picture=0xe1f630, got_picture_ptr=0x10, avpkt=0x2fdfef28) at /ffmpeg-n1.2/libavcodec/utils.c:1690 #8 0x00067c16 in try_decode_frame (st=0xe1e820, avpkt=, options=0x0) at /ffmpeg-n1.2/libavformat/utils.c:2514 #9 0x0006c468 in avformat_find_stream_info (ic=0xd18004, options=0x2fe25a14) at /ffmpeg-n1.2/libavformat/utils.c:2946 #10 0x00004448 in open_input_file (o=0x2fdff374, filename=) at /ffmpeg-n1.2/ffmpeg_opt.c:786 #11 0x00003de8 in open_files (l=0x0, inout=0x0, open_file=0x5f5944 ) at /ffmpeg-n1.2/ffmpeg_opt.c:2307 #12 0x00004058 in ffmpeg_parse_options (argc=, argv=) at /ffmpeg-n1.2/ffmpeg_opt.c:2344 #13 0x00010c30 in main (argc=, argv=) at /ffmpeg-n1.2/ffmpeg.c:3317 Current language: auto; currently asm (gdb) (gdb) disass $pc-32,$pc+32 Dump of assembler code for function ff_pred8x8_top_dc_neon: 0x00398b74 : andeq lr, r1, #163840 ; 0x28000 0x00398b78 : ldreq pc, [pc, -r2, lsr #18] 0x00398b7c : addeq pc, r0, #704 ; 0x2c0 0x00398b80 : bleq 0x7d47c8 0x00398b84 : ldmdaeq r0, {r1, r2, r3, r7, r8, r9, r10, r11, sp, lr, pc}^ 0x00398b88 : stcne 15, cr15, [r0], {179} 0x00398b8c : stceq 15, cr15, [r0], {177} 0x00398b90 : strheq pc, [r1], r10 0x00398b94 : svclt 0x0000e04a End of assembler dump. (gdb) -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Apr 2 19:45:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 17:45:00 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > Tested to run ffmpeg (the tool) and it crashes every > time exactly on the same spot as xbmc! Thank you for testing! > Has n1.2 ever been tested on IOS? Did you test it before? > Question: shall I create a ticet on ffmpeg.org or at > libav.org (since the ARM HW optz orginates from Mans > Mullgards work) or both maybe? Only trac is supported (and suggested) on this mailing list. Please test current git head first to make sure the problem is still reproducible. Could you run the testsuite (make SAMPLES=path fate) on the iPhone? This would allow to verify if only H264 is affected or also other codecs. Does it work with -cpuflags -neon? Does it work with --disable-neon? Is this a regression, ie does it work with any older version? Carl Eugen From cehoyos at ag.or.at Tue Apr 2 19:49:18 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 17:49:18 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > (gdb) disass $pc-32,$pc+32 Please add the register dump, some developers can see the problem if it is present. Thank you, Carl Eugen From lars.hammarstrand at gmail.com Tue Apr 2 20:38:18 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 20:38:18 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > (gdb) disass $pc-32,$pc+32 > > Please add the register dump, some developers can > see the problem if it is present. > > Complete trace: $ *uname -a* Darwin Lars-iPhone-4 11.0.0 Darwin Kernel Version 11.0.0: Sun Apr 8 21:51:26 PDT 2012; root:xnu-1878.11.10~1/RELEASE_ARM_S5L8930X iPhone3,1 arm N90AP Darwin $ *gdb ffmpeg* GNU gdb 6.3.50-20050815 (Apple version gdb-1821) (Fri Jun 29 08:41:41 UTC 2012) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "arm-apple-darwin"...Reading symbols for shared libraries . done (gdb) *r ffmpeg -i http://techslides.com/demos/sample-videos/small.mp4-acodec copy -vcodec copy output.mp4 * Starting program: /ffmpeg-n1.2/ffmpeg ffmpeg -i http://techslides.com/demos/sample-videos/small.mp4 -acodec copy -vcodec copy output.mp4 Reading symbols for shared libraries ......................... done Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand. ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 Line number 405 out of range; h264pred_neon.S has 359 lines. (gdb) *bt* #0 ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 #1 0x003fc75a in hl_decode_mb_simple_8 (h=0x0) at h264_mb_template.c:161 #2 0x003fdad8 in ff_h264_hl_decode_mb (h=) at /ffmpeg-n1.2/libavcodec/h264.c:2415 #3 0x00401da4 in decode_slice (avctx=, arg=) at /ffmpeg-n1.2/libavcodec/h264.c:4266 #4 0x00402380 in execute_decode_slices () at /ffmpeg-n1.2/libavcodec/h264.c:4355 #5 0x00402dec in decode_nal_units (h=0xf00000, buf=0xd25484 "", buf_size=4207149, parse_extradata=0) at /ffmpeg-n1.2/libavcodec/h264.c:4699 #6 0x004033d6 in decode_frame (avctx=0x13b5a00, data=0x0, got_frame=0x2fdfef84, avpkt=) at /ffmpeg-n1.2/libavcodec/h264.c:4811 #7 0x003247ce in avcodec_decode_video2 (avctx=0x13b5a00, picture=0xe4bb40, got_picture_ptr=0x10, avpkt=0x2fdfef20) at /ffmpeg-n1.2/libavcodec/utils.c:1690 #8 0x00067c16 in try_decode_frame (st=0xe4ad30, avpkt=, options=0x0) at /ffmpeg-n1.2/libavformat/utils.c:2514 #9 0x0006c468 in avformat_find_stream_info (ic=0xd18004, options=0x2fe25a14) at /ffmpeg-n1.2/libavformat/utils.c:2946 #10 0x00004448 in open_input_file (o=0x2fdff36c, filename=) at /ffmpeg-n1.2/ffmpeg_opt.c:786 #11 0x00003de8 in open_files (l=0x0, inout=0x0, open_file=0x5f5944 ) at /ffmpeg-n1.2/ffmpeg_opt.c:2307 #12 0x00004058 in ffmpeg_parse_options (argc=, argv=) at /ffmpeg-n1.2/ffmpeg_opt.c:2344 #13 0x00010c30 in main (argc=, argv=) at /ffmpeg-n1.2/ffmpeg.c:3317 Current language: auto; currently asm (gdb) *disass $pc-32,$pc+32* Dump of assembler code for function ff_pred8x8_top_dc_neon: 0x00398b74 : andeq lr, r1, #163840 ; 0x28000 0x00398b78 : ldreq pc, [pc, -r2, lsr #18] 0x00398b7c : addeq pc, r0, #704 ; 0x2c0 0x00398b80 : bleq 0x7d47c8 0x00398b84 : ldmdaeq r0, {r1, r2, r3, r7, r8, r9, r10, r11, sp, lr, pc}^ 0x00398b88 : stcne 15, cr15, [r0], {179} 0x00398b8c : stceq 15, cr15, [r0], {177} 0x00398b90 : strheq pc, [r1], r10 0x00398b94 : svclt 0x0000e04a End of assembler dump. (gdb) *info all-registers* r0 0xdd5990 14506384 r1 0x130 304 r2 0x398b6c 3771244 r3 0x4b804 309252 r4 0xf00000 15728640 r5 0xf00fc4 15732676 r6 0x0 0 r7 0x2fdfecf4 803204340 r8 0xde3990 14563728 r9 0x4b824 309284 r10 0xfa8610 16418320 r11 0x0 0 r12 0x0 0 sp 0x2fdfec28 803204136 lr 0x3fc75b 4179803 pc 0x398b6c 3771244 cpsr { 0x60000010, n = 0x0, z = 0x1, c = 0x1, v = 0x0, q = 0x0, j = 0x0, ge = 0x0, e = 0x0, a = 0x0, i = 0x0, f = 0x0, t = 0x0, mode = 0x10 } { 0x60000010, n = 0, z = 1, c = 1, v = 0, q = 0, j = 0, ge = 0, e = 0, a = 0, i = 0, f = 0, t = 0, mode = usr } s0 0 (raw 0x00000000) s1 0 (raw 0x00000000) s2 0 (raw 0x00000000) s3 0 (raw 0x00000000) s4 0 (raw 0x00000000) s5 0 (raw 0x00000000) s6 0 (raw 0x00000000) s7 0 (raw 0x00000000) s8 0 (raw 0x00000000) s9 0 (raw 0x00000000) s10 0 (raw 0x00000000) s11 0 (raw 0x00000000) s12 0 (raw 0x00000000) s13 0 (raw 0x00000000) s14 0 (raw 0x00000000) s15 0 (raw 0x00000000) s16 0 (raw 0x00000000) s17 1.75 (raw 0x3fe00000) s18 0 (raw 0x00000000) s19 0 (raw 0x00000000) s20 0 (raw 0x00000000) s21 0 (raw 0x00000000) s22 0 (raw 0x00000000) s23 0 (raw 0x00000000) s24 0 (raw 0x00000000) s25 0 (raw 0x00000000) s26 0 (raw 0x00000000) s27 0 (raw 0x00000000) s28 0 (raw 0x00000000) s29 0 (raw 0x00000000) s30 0 (raw 0x00000000) s31 0 (raw 0x00000000) fpscr { 0x63000090, n = 0x0, z = 0x1, c = 0x1, v = 0x0, dn = 0x1, fz = 0x1, rmode = 0x0, stride = 0x0, len = 0x0, ide = 0x0, ixe = 0x0, ufe = 0x0, ofe = 0x0, dze = 0x0, ioe = 0x0, idc = 0x1, ixc = 0x1, ufc = 0x0, ofc = 0x0, dzc = 0x0, ioc = 0x0 } { 0x63000090, n = 0, z = 1, c = 1, v = 0, dn = 1, fz = 1, rmode = 0, stride = 0, len = 0, ide = 0, ixe = 0, ufe = 0, ofe = 0, dze = 0, ioe = 0, idc = 1, ixc = 1, ufc = 0, ofc = 0, dzc = 0, ioc = 0 } d16 1 (raw 0x3ff0000000000000) d17 4503599627370497 (raw 0x4330000000000001) d18 -1 (raw 0xbff0000000000000) d19 2147483647 (raw 0x41dfffffffc00000) d20 -1 (raw 0xbff0000000000000) d21 1 (raw 0x3ff0000000000000) d22 0.084170438349246979 (raw 0x3fb58c31a0000000) d23 -0.10307344049215317 (raw 0xbfba630560000000) d24 0 (raw 0x0000000000000000) d25 0 (raw 0x0000000000000000) d26 0 (raw 0x0000000000000000) d27 0 (raw 0x0000000000000000) d28 0 (raw 0x0000000000000000) d29 0 (raw 0x0000000000000000) d30 0 (raw 0x0000000000000000) d31 0 (raw 0x0000000000000000) d0 0 (raw 0x0000000000000000) d1 0 (raw 0x0000000000000000) d2 0 (raw 0x0000000000000000) d3 0 (raw 0x0000000000000000) d4 0 (raw 0x0000000000000000) d5 0 (raw 0x0000000000000000) d6 0 (raw 0x0000000000000000) d7 0 (raw 0x0000000000000000) d8 0.5 (raw 0x3fe0000000000000) d9 0 (raw 0x0000000000000000) d10 0 (raw 0x0000000000000000) d11 0 (raw 0x0000000000000000) d12 0 (raw 0x0000000000000000) d13 0 (raw 0x0000000000000000) d14 0 (raw 0x0000000000000000) d15 0 (raw 0x0000000000000000) q0 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q1 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q2 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q3 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q4 { uint128 = 4602678819172646912, v4_float = {0, 1.75, 0, 0}, v4_int32 = {0, 1071644672, 0, 0}, v8_int16 = {0, 0, 0, 16352, 0, 0, 0, 0}, v16_int8 = {0, 0, 0, 0, 0, 0, -32, 63, 0, 0, 0, 0, 0, 0, 0, 0} } (raw 0x00000000000000003fe0000000000000) q5 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q6 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q7 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q8 { uint128 = 0x43300000000000013ff0000000000000, v4_float = {0, 1.875, 0, 176}, v4_int32 = {0, 1072693248, 1, 1127219200}, v8_int16 = {0, 0, 0, 16368, 1, 0, 0, 17200}, v16_int8 = {0, 0, 0, 0, 0, 0, -16, 63, 1, 0, 0, 0, 0, 0, 48, 67} } (raw 0x43300000000000013ff0000000000000) q9 { uint128 = 0x41dfffffffc00000bff0000000000000, v4_float = {0, -1.875, -nan(0x400000), 27.9999981}, v4_int32 = {0, -1074790400, -4194304, 1105199103}, v8_int16 = {0, 0, 0, -16400, 0, -64, -1, 16863}, v16_int8 = {0, 0, 0, 0, 0, 0, -16, -65, 0, 0, -64, -1, -1, -1, -33, 65} } (raw 0x41dfffffffc00000bff0000000000000) q10 { uint128 = 0x3ff0000000000000bff0000000000000, v4_float = {0, -1.875, 0, 1.875}, v4_int32 = {0, -1074790400, 0, 1072693248}, v8_int16 = {0, 0, 0, -16400, 0, 0, 0, 16368}, v16_int8 = {0, 0, 0, 0, 0, 0, -16, -65, 0, 0, 0, 0, 0, 0, -16, 63} } (raw 0x3ff0000000000000bff0000000000000) q11 { uint128 = 0xbfba6305600000003fb58c31a0000000, v4_float = {-1.08420217e-19, 1.4183408, 3.68934881e+19, -1.45614684}, v4_int32 = {-1610612736, 1068862513, 1610612736, -1078303995}, v8_int16 = {0, -24576, -29647, 16309, 0, 24576, 25349, -16454}, v16_int8 = {0, 0, 0, -96, 49, -116, -75, 63, 0, 0, 0, 96, 5, 99, -70, -65} } (raw 0xbfba6305600000003fb58c31a0000000) q12 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q13 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q14 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) q15 { uint128 = 0, v4_float = {0, 0, 0, 0}, v4_int32 = {0, 0, 0, 0}, v8_int16 = {0, 0, 0, 0, 0, 0, 0, 0}, v16_int8 = {0 } } (raw 0x00000000000000000000000000000000) -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Tue Apr 2 21:28:54 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 21:28:54 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > Tested to run ffmpeg (the tool) and it crashes every > > time exactly on the same spot as xbmc! > > Thank you for testing! You are welcome! :-) > Has n1.2 ever been tested on IOS? > > Did you test it before? > 1. No, as stated in a previous mail XBMC is currently based on ffmpeg version 0.10.2 that works perfectly well on *Apple IOS (iphone/ipad)* thus this is the first time we test xbmc with the ffmpeg 2.1 libraries. But that's not my point, let me refrase: a) What is the minimum *platform* (win32, linux, etc) test requirement for a new ffmpeg release , i.e does IOS count a standard platform for new ffmpeg eeleases or is release 1.2 previously untested on IOS? b) Who is normally maintaining the apple ios (iphone/ipad) platform for ffmpeg.org? Only trac is supported (and suggested) on this mailing list. > 2. Let me refrase the question: Since M?ns Rullg?rd at libav has done most work on the ARM optimizations, which bug trackers is best to use a) the libav.org bug tracker or b) the ffmpeg.org bug tracek or c) both bug trackers? > Please test current git head first to make sure the problem > is still reproducible. > 3. Ok, will do! > Could you run the testsuite (make SAMPLES=path fate) on the > iPhone? This would allow to verify if only H264 is affected > or also other codecs. > 4. Sorry, you have to be a bit more specific on this one since I'm not a ffmpeg core developer. FATE is a rather complex automated testing environment and IMHO this aught to be performed by a skilled IOS mainterner at ffmpeg.org > Does it work with -cpuflags -neon? > Does it work with --disable-neon? > 5. --disable-asm works. Is this a regression, ie does it work with any older version? 6. Se point 1 above or read this mail conversion from start. -- Regards, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Tue Apr 2 21:33:11 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 21:33:11 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Lars Hammarstrand > 2013/4/2 Carl Eugen Hoyos > >> Lars Hammarstrand writes: >> >> > (gdb) disass $pc-32,$pc+32 >> >> Please add the register dump, some developers can >> see the problem if it is present. >> >> > > Sorry, reply didn't work: > >Your mail to 'Libav-user' with the subject > > Re: [Libav-user] Reference app with ffmpeg n1.2 libs that works onIOS ? > >Is being held until the list moderator can review it for approval. > >The reason it is being held: > > Message body is too big: 52200 bytes with a limit of 40 KB > >Either the message will get posted to the list, or you will receive >notification of the moderator's decision. If you would like to cancel >this posting, please visit the following URL: -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Tue Apr 2 21:39:34 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 21:39:34 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > (gdb) disass $pc-32,$pc+32 > > Please add the register dump, some developers can > see the problem if it is present. > > http://pastebin.com/vCBCJ719 -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Apr 2 21:45:02 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 19:45:02 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > Could you run the testsuite (make SAMPLES=path fate) on the > > iPhone? This would allow to verify if only H264 is affected > > or also other codecs. > > 4. Sorry, you have to be a bit more specific on this one > since I'm not a ffmpeg core developer. FATE is a rather > complex automated testing environment Yes, definitely: $ make SAMPLES=fate-suite fate-rsync $ make SAMPLES=fate-suite fate ;-) (Needs rsync installed) Most of your remaining questions are simply impossible to answer (I don't remember FFmpeg ever having a maintainer for x86, ppc or any other architecture and allow me to repeat that only trac is relevant on this mailing list), but please test if -cpuflags -neon or --disable-neon helps. (I will open a ticket if all information is available, if you open it without bisecting this will unfortunately not really help.) Carl Eugen From lars.hammarstrand at gmail.com Tue Apr 2 22:41:40 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 22:41:40 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > > Could you run the testsuite (make SAMPLES=path fate) on the > > > iPhone? This would allow to verify if only H264 is affected > > > or also other codecs. > > > > 4. Sorry, you have to be a bit more specific on this one > > since I'm not a ffmpeg core developer. FATE is a rather > > complex automated testing environment > > Yes, definitely: > $ make SAMPLES=fate-suite fate-rsync > $ make SAMPLES=fate-suite fate > ;-) > (Needs rsync installed) > Are you sure this will work on IOS, I mean have anyone ever tested to run FATE directly from an IOS device like an iphone or ipad? Remember, there is no development environment natively on IOS thus everything needs to be cross compiled on OSX and then transferred over to the device for execution... > Most of your remaining questions are simply impossible > to answer (I don't remember FFmpeg ever having a > maintainer for x86, ppc or any other architecture and > Seriously, are you absolutely sure that FFmpeg is never ever tested on ANY platform before a public release?? > allow me to repeat that only trac is relevant on > this mailing list), I think you missed my point for the second time :) But never mind, I'll file a bug report at libav myself... > but please test if -cpuflags -neon > or --disable-neon helps. > Will do! (I will open a ticket if all information is available, > Great, here are some additional configure flags. Please tell me if you need anything else to open a ticket! $ ./ffmpeg ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers built on Apr 2 2013 17:54:06 with llvm-gcc 4.2.1 (LLVM build 2410.2.00) configuration: --disable-ffplay --disable-ffserver --disable-ffprobe --disable-doc --disable-bzlib --target-os=darwin --enable-cross-compile --enable-gpl --enable-version3 --arch=arm --cpu=cortex-a8 --enable-pic --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' --extra-cflags='-mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad' --enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2 --enable-optimizations --enable-debug=3 --disable-stripping --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc --as='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/iPhoneOS6.1.sdk --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}... > if you open it without bisecting this will unfortunately > not really help.) I'll need some more detailes how we shall proceed with bisecting. Is it possible to automate everything with a script, like "Start: git get next version, compile, copy to device, remote exec, check return code, break if error else goto start" ?? I've no intention to compile hundreds of different versions by hand you know. :) :) -- Regards, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Tue Apr 2 22:53:09 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Tue, 2 Apr 2013 22:53:09 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Lars Hammarstrand > 2013/4/2 Carl Eugen Hoyos > >> >> > but please test if -cpuflags -neon >> or --disable-neon helps. > > Forgot to ask. Do any of these flags replace any other flags or should they be used in conjunction with existing configure flags as below? -- Regards, Lars. ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers > built on Apr 2 2013 17:54:06 with llvm-gcc 4.2.1 (LLVM build 2410.2.00) > configuration: --disable-ffplay --disable-ffserver --disable-ffprobe > --disable-doc --disable-bzlib --target-os=darwin --enable-cross-compile > --enable-gpl --enable-version3 --arch=arm --cpu=cortex-a8 --enable-pic > --extra-cflags='-arch armv7' --extra-ldflags='-arch armv7' > --extra-cflags='-mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad' > --enable-neon --disable-armv5te --disable-armv6 --disable-armv6t2 > --enable-optimizations --enable-debug=3 --disable-stripping > --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc > --as='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/iPhoneOS6.1.sdk > --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Apr 2 23:25:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 21:25:06 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > (I will open a ticket if all information is available, > > Great, here are some?additional?configure flags. > Please tell me if you need anything else to open a ticket! Please test if --disable-neon and -cpuflags -neon fix the problem. > I've no intention to compile hundreds of?different? > versions by hand you know. :) :) 14 will be sufficient, I will guide you. Carl Eugen From cehoyos at ag.or.at Tue Apr 2 23:26:44 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 21:26:44 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > but please test if -cpuflags -neon > > or --disable-neon helps. > > Forgot to ask. Do any of these flags replace any > other flags or should they be used in conjunction > with existing configure flags as below? > --enable-neon I suspect it is not a good idea to use --disable-neon --enable-neon (-cpuflags is a runtime option) Carl Eugen From cehoyos at ag.or.at Tue Apr 2 23:30:12 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 21:30:12 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Carl Eugen Hoyos writes: > > I've no intention to compile hundreds of?different? > > versions by hand you know. :) :) > > 14 will be sufficient, I will guide you. To elaborate: You tell me which version does work and which version crashes, and I will tell you which versions to test. Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 01:09:35 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 01:09:35 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/2 Carl Eugen Hoyos > Carl Eugen Hoyos writes: > > > > I've no intention to compile hundreds of different > > > versions by hand you know. :) :) > > > > 14 will be sufficient, I will guide you. > > To elaborate: > You tell me which version does work and > which version crashes, and I will tell > you which versions to test. > > You have to supply a more detailed action-plan to operate git bisecting in this case since the last (and current) working version of ffmpeg for xbmc is n0.10.2 which is quite a few commits from n2.1, probably a whole lot more than just 14 iterations thus I think it's a good idea that we automate things. Test for your self: git bisect bad git bisect start git bisect good n0.10.2 git bisect view --stat What numbers did you get? Btw, have any of you guys done any fully automated bisecting with "git bisect run" that cross compiles locally and runs on a remote ios device (or any other platform for that matter) that can serve as an example? -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 01:15:19 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 01:15:19 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Lars Hammarstrand > 2013/4/2 Carl Eugen Hoyos > >> Carl Eugen Hoyos writes: >> >> > > I've no intention to compile hundreds of different >> > > versions by hand you know. :) :) >> > >> > 14 will be sufficient, I will guide you. >> >> To elaborate: >> You tell me which version does work and >> which version crashes, and I will tell >> you which versions to test. >> >> > You have to supply a more detailed action-plan to operate git bisecting in > this case since the last (and current) working version of ffmpeg for xbmc > is n0.10.2 which is quite a few commits from n2.1, probably a whole lot > more than just 14 iterations thus I think it's a good idea that we automate > things. Test for your self: > > git bisect bad > git bisect start > git bisect good n0.10.2 > git bisect view --stat > Typo above, meant this: git bisect start git bisect bad n2.1 git bisect good n0.10.2 git bisect view --stat -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 01:28:24 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 2 Apr 2013 23:28:24 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > You tell me which version does work and > > which version crashes, and I will tell > > you which versions to test. > > You have to supply a more detailed action-plan > to operate git bisecting in this case since the > last (and current) working version of ffmpeg for > xbmc is n0.10.2 which is quite a few commits > from n2.1, probably a whole lot more than just > 14 iterations Exactly 14 iterations, please trust me, I am doing this quite often. Before starting, please test -cpuflags -neon and --disable-neon to make 100% sure that we know what we are searching for. For the bisect, please confirm first that 3c5fe5b does indeed work fine (this corresponds to 0.10 and is the first of 14 compiles). Then please test a1bcc76. If it works ok, test 3860e34, if not try 35894eb (These are compiles two and three.) Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 01:57:58 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 01:57:58 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > > You tell me which version does work and > > > which version crashes, and I will tell > > > you which versions to test. > > > > You have to supply a more detailed action-plan > > to operate git bisecting in this case since the > > last (and current) working version of ffmpeg for > > xbmc is n0.10.2 which is quite a few commits > > from n2.1, probably a whole lot more than just > > 14 iterations > > Exactly 14 iterations, please trust me, I am doing > this quite often. Ok, I'll trust you completely ;-) > Before starting, please test -cpuflags -neon and > --disable-neon to make 100% sure that we know what > we are searching for. > Success, --disable-neon and -cpuflags -neon did the trick! Tested a down-scale with: $ ffmpeg -cpuflags -neon -i http://santai.tv/vod/test/test_format_1.mp4-acodec copy -vcodec copy -s 640x360 -level 21 -refs 2 -b 384k -threads 0 output.mp4 > For the bisect, please confirm first that 3c5fe5b > does indeed work fine (this corresponds to 0.10 > and is the first of 14 compiles). > Then please test a1bcc76. > If it works ok, test 3860e34, if not try 35894eb > (These are compiles two and three.) > > Ok, got it. I'll will reset the configure flags to the ones used before. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 02:18:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 00:18:00 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > Exactly 14 iterations, please trust me, I am doing > > this quite often. > > Ok, I'll trust you completely (I was actually wrong: 14 iterations == 15 compiles) > Before starting, please test -cpuflags -neon and > --disable-neon to make 100% sure that we know what > we are searching for. > > Success, --disable-neon and -cpuflags -neon did the trick! I hoped you would first test -cpuflags -neon on a build with "--enable-neon" and then "--disable-neon" without any cpuflags - sorry for being unclear! 100% unrelated to this bisect that we should really do in any case (you may already have realized that nobody else but you is able to do it): I only start to realize now what you are actually doing, please allow me state very, very clearly that it is imo *not* a good idea to update xbmc now to a version of FFmpeg that is already outdated. There will be no future release series containing new features but the old API! Carl Eugen From andrey.krieger.utkin at gmail.com Wed Apr 3 03:55:41 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Wed, 3 Apr 2013 04:55:41 +0300 Subject: [Libav-user] creating a new filter... In-Reply-To: References: <321B8C36-D2F3-46E4-ACE5-F2D8D1E5ABC6@gmail.com> <78E1B518-E4B1-45E3-81B0-034E1C53D310@gmail.com> Message-ID: I can add to the above a couple of points. You are not obliged to send your filter to us, it you are going to use it just for yourself. But if you are going to share some useful code, some development community members may do some integration work for you, thus you get your target achieved sooner. You can look how other filters get added into libavfilter library, for example: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=6ea8a830e8f1eee465174c479840b18b4963d43d;hp=5f61e09a8f28af45d7db1f5e7767d14322255f49 And IIRC means "if i recall correctly" :) From andrey.krieger.utkin at gmail.com Wed Apr 3 04:02:57 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Wed, 3 Apr 2013 05:02:57 +0300 Subject: [Libav-user] Posting a sample project on Github In-Reply-To: <14DD3B35-6C3C-4A85-B289-4E31AD25FD8E@bighillsoftware.com> References: <14DD3B35-6C3C-4A85-B289-4E31AD25FD8E@bighillsoftware.com> Message-ID: 2013/3/13 Brad O'Hearne : > So in order to do this, and respect FFmpeg etiquette and licensing terms, is it desired that I include with my source code on Github: > > a) Just FFmpeg built binaries. > b) FFmpeg built binaries plus unarchived FFmpeg source. > c) FFmpeg built binaries plus archived source. You can include none, and just make your project build system to download and build it at moment of compilation. IMHO this choise is not important, i see no way at all to violate free license when you show your complete code with other free software. Good luck with your project, go on publishing your code, i hope you will get help here. From michaelni at gmx.at Wed Apr 3 04:39:43 2013 From: michaelni at gmx.at (Michael Niedermayer) Date: Wed, 3 Apr 2013 04:39:43 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: <20130403023943.GB9979@kiste2> On Tue, Apr 02, 2013 at 08:38:18PM +0200, Lars Hammarstrand wrote: > 2013/4/2 Carl Eugen Hoyos > > > Lars Hammarstrand writes: > > > > > (gdb) disass $pc-32,$pc+32 > > > > Please add the register dump, some developers can > > see the problem if it is present. > > > > > > Complete trace: > $ *uname -a* > Darwin Lars-iPhone-4 11.0.0 Darwin Kernel Version 11.0.0: Sun Apr 8 > 21:51:26 PDT 2012; root:xnu-1878.11.10~1/RELEASE_ARM_S5L8930X iPhone3,1 arm > N90AP Darwin > > $ *gdb ffmpeg* > GNU gdb 6.3.50-20050815 (Apple version gdb-1821) (Fri Jun 29 08:41:41 UTC > 2012) > Copyright 2004 Free Software Foundation, Inc. > GDB is free software, covered by the GNU General Public License, and you are > welcome to change it and/or distribute copies of it under certain > conditions. > Type "show copying" to see the conditions. > There is absolutely no warranty for GDB. Type "show warranty" for details. > This GDB was configured as "arm-apple-darwin"...Reading symbols for shared > libraries . done > > (gdb) *r ffmpeg -i > http://techslides.com/demos/sample-videos/small.mp4-acodec copy > -vcodec copy output.mp4 > * > Starting program: /ffmpeg-n1.2/ffmpeg ffmpeg -i > http://techslides.com/demos/sample-videos/small.mp4 -acodec copy -vcodec > copy output.mp4 > Reading symbols for shared libraries ......................... done > > Program received signal EXC_BAD_INSTRUCTION, Illegal instruction/operand. > ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 > Line number 405 out of range; h264pred_neon.S has 359 lines. > > (gdb) *bt* > #0 ff_pred8x8_128_dc_neon () at h264pred_neon.S:405 > #1 0x003fc75a in hl_decode_mb_simple_8 (h=0x0) at h264_mb_template.c:161 > #2 0x003fdad8 in ff_h264_hl_decode_mb (h= due to optimizations>) at /ffmpeg-n1.2/libavcodec/h264.c:2415 > #3 0x00401da4 in decode_slice (avctx= to optimizations>, arg= optimizations>) at /ffmpeg-n1.2/libavcodec/h264.c:4266 > #4 0x00402380 in execute_decode_slices () at > /ffmpeg-n1.2/libavcodec/h264.c:4355 > #5 0x00402dec in decode_nal_units (h=0xf00000, buf=0xd25484 "", > buf_size=4207149, parse_extradata=0) at /ffmpeg-n1.2/libavcodec/h264.c:4699 > #6 0x004033d6 in decode_frame (avctx=0x13b5a00, data=0x0, > got_frame=0x2fdfef84, avpkt= optimizations>) at /ffmpeg-n1.2/libavcodec/h264.c:4811 > #7 0x003247ce in avcodec_decode_video2 (avctx=0x13b5a00, picture=0xe4bb40, > got_picture_ptr=0x10, avpkt=0x2fdfef20) at > /ffmpeg-n1.2/libavcodec/utils.c:1690 > #8 0x00067c16 in try_decode_frame (st=0xe4ad30, avpkt= unavailable, due to optimizations>, options=0x0) at > /ffmpeg-n1.2/libavformat/utils.c:2514 > #9 0x0006c468 in avformat_find_stream_info (ic=0xd18004, > options=0x2fe25a14) at /ffmpeg-n1.2/libavformat/utils.c:2946 > #10 0x00004448 in open_input_file (o=0x2fdff36c, filename= temporarily unavailable, due to optimizations>) at > /ffmpeg-n1.2/ffmpeg_opt.c:786 > #11 0x00003de8 in open_files (l=0x0, inout=0x0, open_file=0x5f5944 > ) at /ffmpeg-n1.2/ffmpeg_opt.c:2307 > #12 0x00004058 in ffmpeg_parse_options (argc= unavailable, due to optimizations>, argv= due to optimizations>) at /ffmpeg-n1.2/ffmpeg_opt.c:2344 > #13 0x00010c30 in main (argc= optimizations>, argv=) > at /ffmpeg-n1.2/ffmpeg.c:3317 > Current language: auto; currently asm > > (gdb) *disass $pc-32,$pc+32* > Dump of assembler code for function ff_pred8x8_top_dc_neon: > 0x00398b74 : andeq lr, r1, #163840 ; 0x28000 > 0x00398b78 : ldreq pc, [pc, -r2, lsr #18] > 0x00398b7c : addeq pc, r0, #704 ; 0x2c0 > 0x00398b80 : bleq 0x7d47c8 > 0x00398b84 : ldmdaeq r0, {r1, r2, r3, r7, r8, > r9, r10, r11, sp, lr, pc}^ > 0x00398b88 : stcne 15, cr15, [r0], {179} > 0x00398b8c : stceq 15, cr15, [r0], {177} > 0x00398b90 : strheq pc, [r1], r10 > 0x00398b94 : svclt 0x0000e04a > End of assembler dump. > > (gdb) *info all-registers* [...] > pc 0x398b6c 3771244 iam not an arm expert but the address pc is at doesnt seem to be part of the disassembly [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: Digital signature URL: From lars.hammarstrand at gmail.com Wed Apr 3 11:12:55 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 11:12:55 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > > Exactly 14 iterations, please trust me, I am doing > > > this quite often. > > > > Ok, I'll trust you completely > > (I was actually wrong: 14 iterations == 15 compiles) > That will take roughly 7,5 hours (give or take) in a worst case scenario. That's why I want to automate with git bisec run. I played around with "git log" a found a commit that (what I think) seems close to 0.10 that will produce 13 iterations: $ git bisect good 33c21378a846d880110324f3e139a693a9bb30ca Bisecting: 6686 revisions left to test after this (roughly 13 steps) [15a0fb58a3294876c23989915a4a6202411be1b0] Merge remote-tracking branch 'qatar/master' But it seems you are using an earlier commit. Which commit did you use for "git bisect good"? > > Before starting, please test -cpuflags -neon and > > --disable-neon to make 100% sure that we know what > > we are searching for. > > > > Success, --disable-neon and -cpuflags -neon did the trick! > > I hoped you would first test -cpuflags -neon on > a build with "--enable-neon" and then "--disable-neon" > without any cpuflags - sorry for being unclear! > Ok, I'll test that too! > > 100% unrelated to this bisect that we should really > do in any case (you may already have realized that > nobody else but you is able to do it): > Ok, lets do it! :) > I only start to realize now what you are actually > doing, please allow me state very, very clearly that > it is imo *not* a good idea to update xbmc now to a > version of FFmpeg that is already outdated. There > will be no future release series containing new > features but the old API! Well, yes - we're aware about the new api and that 1.2 will the be the last version with the old api. But since a change to the new api will take some time to implement, we want to use the version 1.2 that solves a bunch of other more or less serious problems that we currently struggle with in version 0.10.2. We are talking show stoppers that is for instance preventing users to watch certain content types, hangs or causes stuttering video playback. And we can't be sure this problem won't occur with the new api, can we? Xbmc does currently work with ffmpeg n1.2 on all platforms except IOS thus it's worth the effort to fix this particular problem. -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 11:18:58 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 11:18:58 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: <20130403023943.GB9979@kiste2> References: <20130403023943.GB9979@kiste2> Message-ID: 2013/4/3 Michael Niedermayer > On Tue, Apr 02, 2013 at 08:38:18PM +0200, Lars Hammarstrand wrote: > > 2013/4/2 Carl Eugen Hoyos > > > > (gdb) *disass $pc-32,$pc+32* > > Dump of assembler code for function ff_pred8x8_top_dc_neon: > > 0x00398b74 : andeq lr, r1, #163840 ; 0x28000 > > 0x00398b78 : ldreq pc, [pc, -r2, lsr #18] > > 0x00398b7c : addeq pc, r0, #704 ; 0x2c0 > > 0x00398b80 : bleq 0x7d47c8 > > 0x00398b84 : ldmdaeq r0, {r1, r2, r3, r7, r8, > > r9, r10, r11, sp, lr, pc}^ > > 0x00398b88 : stcne 15, cr15, [r0], {179} > > 0x00398b8c : stceq 15, cr15, [r0], {177} > > 0x00398b90 : strheq pc, [r1], r10 > > 0x00398b94 : svclt 0x0000e04a > > End of assembler dump. > > > > (gdb) *info all-registers* > pc 0x398b6c 3771244 > > iam not an arm expert but the address pc is at doesnt seem to be part > of the disassembly > > So it seems. Could it be an address alignment problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 11:20:29 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 09:20:29 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > > Success, --disable-neon and -cpuflags -neon did the trick! > > > > I hoped you would first test -cpuflags -neon on > > a build with "--enable-neon" and then "--disable-neon" > > without any cpuflags - sorry for being unclear! > > Ok, I'll test that too! Don't. It appears that exchanging mails takes an enormous time, so just start bisecting with the versions I already sent. As an alternative, you may of course do the bisect without my help (that means less work for me). If you are lucky with the versions you choose, it may also mean a significant reduction of the amount of time you need. (But also consider that I use git bisect more often than you and that it bears some annoyances when used with the FFmpeg sources.) [...] > Well, yes - we're aware about the new api and that > 1.2 will the be the last version with the old api. That is all I wanted to make sure of. Carl Eugen From cehoyos at ag.or.at Wed Apr 3 11:23:51 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 09:23:51 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > (I was actually wrong: 14 iterations == 15 compiles) > > That will take?roughly 7,5 hours (give or take) in a > worst case scenario. (There is no worst case scenario, the amount of time is roughly the same in all scenarios.) Could you elaborate? Does cross compilation take approximately 30 minutes? If yes, it will be easy to reduce the time... (I originally thought that reducing compilation time will take more time than it saves, but with 30 minutes per run that is of course not true.) Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 12:31:34 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 12:31:34 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > > > Success, --disable-neon and -cpuflags -neon did the trick! > > > > > > I hoped you would first test -cpuflags -neon on > > > a build with "--enable-neon" and then "--disable-neon" > > > without any cpuflags - sorry for being unclear! > > > > Ok, I'll test that too! > > Don't. > No problem, skipping. > It appears that exchanging mails takes an enormous > time, so just start bisecting with the versions I > already sent. > As an alternative, you may of course do the bisect > without my help (that means less work for me). If > you are lucky with the versions you choose, it may > also mean a significant reduction of the amount of > time you need. > (But also consider that I use git bisect more often > than you and that it bears some annoyances when > used with the FFmpeg sources.) > Initially I want to run the fully automated git bisect run. For that I need a "good commit nr" and eventually "git skip start...end" and other info that might be good to know about beforehand. Summary: Q1. Please provide a starting point, i.e "git bisect good commit" for 0.10.2. Q2. Please explain where you got the starting point from and how (git log or internal docs?) Q3. Please provide other necessary info or bisect flags that may impact the bisecting process. -- Thanks in advance, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 12:43:15 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 12:43:15 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > > (I was actually wrong: 14 iterations == 15 compiles) > > > > That will take roughly 7,5 hours (give or take) in a > > worst case scenario. > > (There is no worst case scenario, the amount of time is > roughly the same in all scenarios.) > Worst case scenario is when you need to perform all iterations before you find the "bad commit". > Could you elaborate? > Does cross compilation take approximately 30 minutes? > more or less: cleaning + compiling + codsigning on a rather slow vmware partition: ~ 10-12 min, wake up + cleaning + copy to device: ~ 10-12 mins, remote exec ffmpeg + gather result 1-2 min (3-4 min if it fails and a gdb script is executed) If yes, it will be easy to reduce the time... (I originally thought that reducing compilation time > will take more time than it saves, but with 30 minutes > per run that is of course not true.) > > Enlighten me please :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 12:51:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 10:51:06 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > Initially I want to run the fully automated git > bisect run. It appears that you know much more about bisecting FFmpeg than I do. If you report the first failing commit here on this mailing list I will forward it to the bug tracker / the relevant developers. If you decide that you want to do it my way, please follow: http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/10324/focus=10406 Thank you, Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 13:02:41 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 13:02:41 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > It appears that you know much more about > bisecting FFmpeg than I do. If you report > the first failing commit here on this > mailing list I will forward it to the > bug tracker / the relevant developers. > Well, I don't know about that but I'll certainly work hard to find the dar'n bug ;-) > If you decide that you want to do it my way, > please follow: > > http://thread.gmane.org/gmane.comp.video.ffmpeg.libav.user/10324/focus=10406 Ok, can you please confirm I'm at the correct starting point: $ git bisect good 3c5fe5b Bisecting: 6692 revisions left to test after this (roughly 13 steps) [bec180e1127f6753b5af1e6e5242020e0de12366] Merge commit 'a1bcc76e6036e78f25cbb7323c145056cfca9d93' -- Thanks, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 13:28:45 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 11:28:45 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > Ok, can you please confirm I'm at the correct starting point: > > $ git bisect good 3c5fe5b Only you can answer if 3c5fe5b works ok, if it does, please test a1bcc76. (In case this is not obvious: Because of the peculiarities of the FFmpeg project, your script may save you some time but will not work the way you are used to from other git repositories, I therefore suggest manual compilation.) If compilation really takes >10minutes, you can try the following configure line with current git head: $ ./configure --disable-everything --enable-protocol=file --enable-demuxer=mov --enable-parser=h264 --enable-decoder=h264 (You of course have to add the cross-compilation options.) This assumes your crashing test file is a mov file, adapt the --enable-demuxer entry in case it is not. You can also test --disable-optimizations, this speeds compilation up significantly but may hide the bug: It is probably ok in your case but who knows. (This will work even less with a script because some revisions will need additional --enable-* options to succeed compilation.) Carl Eugen From cehoyos at ag.or.at Wed Apr 3 13:33:54 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 11:33:54 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > > > That will take?roughly 7,5 hours (give or take) in a > > > worst case scenario. > > (There is no worst case scenario, the amount of time is > > roughly the same in all scenarios.) > > Worst case scenario is when you need to perform all > iterations before you find the "bad commit". Please understand that there is no worst-case scenario when doing git bisect. (There is only one scenario +/- 1 compile.) Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 14:52:23 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 14:52:23 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > Ok, can you please confirm I'm at the correct starting point: > > > > $ git bisect good 3c5fe5b > > Only you can answer if 3c5fe5b works ok, if it does, > please test a1bcc76. > My fault, sorry I was unclear: a) Does commit nr "3c5fe5b" correspond to 0.10.2. b) I'm just curious but where and how do you manage to "dig out" that info? > (In case this is not obvious: Because of the > peculiarities of the FFmpeg project, your > script may save you some time but will not > work the way you are used to from other git > repositories, I therefore suggest manual > compilation.) > I understand. I'll try the manual way with the three commits you suggested. > If compilation really takes >10minutes, you can > try the following configure line with current > git head: > $ ./configure --disable-everything --enable-protocol=file > --enable-demuxer=mov --enable-parser=h264 --enable-decoder=h264 > > (You of course have to add the cross-compilation options.) > > This assumes your crashing test file is a mov file, > adapt the --enable-demuxer entry in case it is not. > > You can also test --disable-optimizations, this speeds > compilation up significantly but may hide the bug: It > is probably ok in your case but who knows. > > (This will work even less with a script because some > revisions will need additional --enable-* options to > succeed compilation.) > > Exactly what I was looking for, thank you! -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 17:45:55 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 17:45:55 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > > For the bisect, please confirm first that 3c5fe5b > does indeed work fine (this corresponds to 0.10 > and is the first of 14 compiles). > Then please test a1bcc76. > If it works ok, test 3860e34, if not try 35894eb > (These are compiles two and three.) > > 0. 3c5fe5b # Works OK 1. a1bcc76 # Works OK (got avconv but worked with the same runtime flags as ffmpeg) 2. 3860e34 # Works OK 3. 35894eb # Didn't compile: CC libavfilter/allfilters.o error: invalid operand in inline asm: 'adds $1, ${2:R}, ${2:Q}, lsr #31 itet ne mvnne $1, #1<<31 moveq $0, ${2:Q} eorne $0, $1, ${2:R}, asr #31 ' make: *** [libavfilter/af_volume.o] Error 1 make: *** Waiting for unfinished jobs.... --- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 17:47:58 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 17:47:58 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: I'll start a bisect run now just for testing... -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 18:07:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 16:07:19 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > 0. 3c5fe5b # Works OK > 1. a1bcc76? # Works OK > (got avconv but worked with the same runtime flags as ffmpeg) Sorry, that was my fault. > 2. 3860e34? # Works OK Please test 353dbaa now. If 353dbaa works ok, please test 6b2e650 If 353dbaa does not work, please test 230bef0 If you tested 6b2e650 and if works ok please test 6b8f211 If you tested 6b2e650 and if does not work, test 5361f49 Only if you tested 230bef0 and it worked, test 6717d1a If you tested 230bef0 and it failed, test f2c49da > 3. 35894eb ? ? ? ?# Didn't compile: But it wasn't necessary anyway, you correctly tested 3860e34. Since the regression is so "new" (fork development has slowed down significantly), a normal bisect will likely work fine. (I was assuming an older bug when git bisect always wanted to test broken versions.) Carl Eugen From lars.hammarstrand at gmail.com Wed Apr 3 20:25:18 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 20:25:18 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: Result from bisect run where bad=n2.1 and good=3c5fe5b: Run Status: ffmpeg-bec180e: OK. Run Status: ffmpeg-3860e34: OK. Run Status: ffmpeg-353dbaa: Failed. (rc=132) Run Status: ffmpeg-230bef0: Failed. (rc=132) Run Status: ffmpeg-f2c49da: Failed. (rc=132) Run Status: ffmpeg-e98fab1: Failed. (rc=132) Run Status: ffmpeg-3b56ed3: OK. Run Status: ffmpeg-255be07: OK. Run Status: ffmpeg-d0b7e83: Failed. (rc=132) Run Status: ffmpeg-936eaa8: OK. Run Status: ffmpeg-8bee8f7: OK. The first bad commit could be any of: 66371c2851348cfbf0940370b7f6772aa304d8e6 eb7018d2fcd4a665a8c2b65e1c73c3fe9f7ca356 d0b7e832fecab33799bb1fc5e0c032119bc34b33 We cannot bisect more! bisect run cannot continue any more -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 20:28:47 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 20:28:47 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > Please test 353dbaa now. > If 353dbaa works ok, please test 6b2e650 > If 353dbaa does not work, please test 230bef0 > > If you tested 6b2e650 and if works ok please test 6b8f211 > If you tested 6b2e650 and if does not work, test 5361f49 > > Only if you tested 230bef0 and it worked, test 6717d1a > If you tested 230bef0 and it failed, test f2c49da > > Ok, will do... -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 20:37:31 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 20:37:31 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Lars Hammarstrand > 2013/4/3 Carl Eugen Hoyos > >> Please test 353dbaa now. >> If 353dbaa works ok, please test 6b2e650 >> If 353dbaa does not work, please test 230bef0 >> >> If you tested 6b2e650 and if works ok please test 6b8f211 >> If you tested 6b2e650 and if does not work, test 5361f49 >> >> Only if you tested 230bef0 and it worked, test 6717d1a >> If you tested 230bef0 and it failed, test f2c49da >> >> > Ok, will do... > Didn't notice at first but it seems that all tests are covered by bisect run. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Wed Apr 3 20:57:27 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Wed, 3 Apr 2013 20:57:27 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Lars Hammarstrand > Result from bisect run where bad=n2.1 and good=3c5fe5b: > > Run Status: ffmpeg-bec180e: OK. > Run Status: ffmpeg-3860e34: OK. > Run Status: ffmpeg-353dbaa: Failed. (rc=132) > Run Status: ffmpeg-230bef0: Failed. (rc=132) > Run Status: ffmpeg-f2c49da: Failed. (rc=132) > Run Status: ffmpeg-e98fab1: Failed. (rc=132) > Run Status: ffmpeg-3b56ed3: OK. > Run Status: ffmpeg-255be07: OK. > Run Status: ffmpeg-d0b7e83: Failed. (rc=132) > Run Status: ffmpeg-936eaa8: OK. > Run Status: ffmpeg-8bee8f7: OK. > > The first bad commit could be any of: > 66371c2851348cfbf0940370b7f6772aa304d8e6 > eb7018d2fcd4a665a8c2b65e1c73c3fe9f7ca356 > d0b7e832fecab33799bb1fc5e0c032119bc34b33 > We cannot bisect more! > bisect run cannot continue any more > -- > This is my guess: lt smells like an alignment problem since only the failed versions gets the following warnings during linkage: *LD ffmpeg* *ld: warning: ARM function not 4-byte aligned: .Literal_0 from libavcodec/libavcodec.a(dsputil_arm.o)* *ld: warning: ARM function not 4-byte aligned: .Literal_3 from libavcodec/libavcodec.a(dsputil_arm.o)* *ld: warning: ARM function not 4-byte aligned: .Literal_1 from libavcodec/libavcodec.a(dsputil_arm.o)* *ld: warning: ARM function not 4-byte aligned: .Literal_2 from libavcodec/libavcodec.a(dsputil_arm.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic2 from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: empty_row from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: end_of_row_loop from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: start_column_loop from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: column_loop from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: empty_odd_column from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: the_end from libavcodec/libavcodec.a(jrevdct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __end_b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __a_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __almost_empty_row from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __end_row_loop from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __end_b_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __a_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: __end_simple_idct_arm from libavcodec/libavcodec.a(simple_idct_arm.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic36 from libavcodec/libavcodec.a(h264cmc_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic54 from libavcodec/libavcodec.a(h264cmc_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic7 from libavcodec/libavcodec.a(fft_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic11 from libavcodec/libavcodec.a(fft_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic27 from libavcodec/libavcodec.a(fft_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic10 from libavcodec/libavcodec.a(vp3dsp_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lput_rv40_qpel16_v_s6 from libavcodec/libavcodec.a(rv40dsp_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lput_rv40_qpel16_v_s5 from libavcodec/libavcodec.a(rv40dsp_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lavg_rv40_qpel16_v_s6 from libavcodec/libavcodec.a(rv40dsp_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lavg_rv40_qpel16_v_s5 from libavcodec/libavcodec.a(rv40dsp_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic5 from libavcodec/libavcodec.a(fft_fixed_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic17 from libavcodec/libavcodec.a(fft_fixed_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lpic34 from libavcodec/libavcodec.a(fft_fixed_neon.o)* *ld: warning: ARM function not 4-byte aligned: .Lhf_apply_noise_1 from libavcodec/libavcodec.a(sbrdsp_neon.o)* -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 3 21:52:26 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 3 Apr 2013 19:52:26 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > Run Status: ffmpeg-d0b7e83: Failed. (rc=132) > Run Status: ffmpeg-8bee8f7: OK. Does --disable-thumb fix the crashes? (Or --enable-thumb?) In any case: Please run your configure line for both above versions and post the diff for the following two files here: config.h config.mak Thank you, Carl Eugen From brado at bighillsoftware.com Thu Apr 4 06:03:20 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 3 Apr 2013 21:03:20 -0700 Subject: [Libav-user] Video and audio timing / syncing In-Reply-To: <1609126D-9362-47D5-9FD8-06F1DFA21D52@bighillsoftware.com> References: <8849BACD-1DB9-4C98-A280-5AC348A7B289@bighillsoftware.com> <20130328042544.GG3758@leki> <047B80CE-E744-47C0-AA9E-992B3F78BE92@bighillsoftware.com> <088A5762-926F-4011-9A2B-D9828A7F99F6@bighillsoftware.com> <7261CEEC-778A-4985-9C26-DA8F679B0986@universalx.net> <46153253-4986-4947-8CDD-4C2EA9664133@bighillsoftware.com> <1CD37ACA-6B93-4E3F-9997-89FE9C8B33CE@gmail.com> <4925EE80-0265-42A9-99E8-5DD355E81301@bighillsoftware.com> <7037820E-E1A6-438E-9ABA-DAC5ACA2B97F@universalx.net> <30FAC343-08DE-4930- A26B-B3 B9D39DB6EE@bighillsoftware.com> <74A17926-0520-41E6-84F6-418AC9AC5F76@universalx.net> <1609126D-9362-47D5-9FD8-06F1DFA21D52@bighillsoftware.com> Message-ID: On Mar 31, 2013, at 11:36 PM, Brad O'Hearne wrote: > Presuming there's no unknowns about changing the time_base.den on the fly throughout encoding, problem solved. > Throughout the weeks of Googling and reading endless source code, forum / mailing list posts, blogs, etc. on this, I had picked up the impression that time_base.den was to be set once prior to encoding and not mucked with thereafter. However, I just used the duration to calculate the frame rate and now I'm setting the time_base.den prior to pts and dts for every frame. Works great. For the sake of those who might follow with a similar use-case, and as a basis for making a suggestion, I need to add a footnote to my previous email on resolution. As it turned out, the testing I did at that time which produced the "Works great" conclusion above didn't bounce the frame rate significantly to expose the fact that there was an actual problem doing this. By pot luck, I came across a manipulation of the video camera which significantly bounced the frame rate (it cut it in half), and when time_base.den was changed on the fly to match the new frame rate, the subsequent resulting pts in the new time_base units resulted in an inaccurate timing, and the "non-monotonically increasing..." error for pts and dts, and also the out-of-sync audio and video problem again. As it turns out, the original impression I had picked up that time_base should not be changed on the fly is correct. The time_base should not be changed to match a variable frame rate, the time_base should be set up front and remain constant for the entire encoding process. Given the current definition of time_base, the proper way to handle a variable frame-rate is to do the following: 1. Set time_base.den such that you can assume that the frame rate will never increase. I set my time_base.den value to 30, as I didn't foresee ever receiving a frame-rate higher than 30fps. 2. Use pts and dts values which increment by 1 for every frame. 3. Use the presentation time, duration and calculated frame rate of the received sample buffer to determine the frame rate, and whether the current frame should be encoded/written 0 times, 1 time, or multiple times based on how many frames the encoder is expecting at that specific pts. In other words, if the frame rate is bouncing around, a particular frame may need to be written only once (normal), multiple times (the frame rate has dropped), or not at all (frame rate has increased). That last step which ironed out all timing issues made clear to me some of the things I had seen in various examples on the Internet (though not the FFmpeg official examples) which spoke of "delayed frames". I'm not completely sure it was the exact same problem being addressed, but it made sense after having to do this the general idea in play -- bottom line, the implementer has to fabricate fixed-fps out of variable fps. As a point of suggestion, I would suggest that the FFmpeg maintainers either consider adding this fps smoothing for variable fps inside of avcodec, or alternatively reconsider the anchoring of time_base from the current potentially variable metric of frame rate to a fixed metric against which pts and dts can reliably and easily be converted. Frame rate is only truly fixed with either auto-generated frames (such as the FFmpeg examples) or when encoding a pre-existing file. But for live-capture, frame rate is variable -- hardware / software / latency etc., not to make mention of the fact that the capture mechanism in play (QTKit or otherwise) doesn't necessarily guarantee *any* particular frame rate. I am not sure the design reason for making time-base be effectively frame-rate units, but as stated, frame-rate is a potentially varying metric. I would think that a time_base anchored to a fixed metric (such as time itself, e.g. milliseconds in a second - 1000) would be a much more reliable and versatile design, as it would serve fixed and variable frame rate scenarios equally well. I found it a little strange that I was receiving sample buffers from the capture mechanism with *exact* decode time, presentation time, and duration time, and yet while logically this is completely sufficient info to set frame timings, there were gymnastics and compensation required so as to accommodate a fixed frame rate, which as stated, in a live-capture scenario is basically fictional. If there's no alteration to the time_base design, then I would again encourage adding fps smoothing to avcodec. If event that is not possible or desirable, at least add the algorithm for doing so to the FFmpeg code examples. While I have some code cleanup yet to do, I have updated the video streaming part of my sample app to include this handling, if anyone now or down the road can benefit: https://github.com/BigHillSoftware/QTFFmpeg Cheers, Brad From lars.hammarstrand at gmail.com Thu Apr 4 06:08:33 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 4 Apr 2013 06:08:33 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/3 Carl Eugen Hoyos > >Lars Hammarstrand writes: > > > > Run Status: ffmpeg-d0b7e83: Failed. (rc=132) > > Run Status: ffmpeg-8bee8f7: OK. > > Does --disable-thumb fix the crashes? > (Or --enable-thumb?) > > In any case: Please run your configure line for > both above versions and post the diff for the > following two files here: > config.h > config.mak > > Sure, no problem. A question though, will this be sufficient for a ticket or do you want me to locate and fix the error as well? ;-) ;-) Anyhow, I'll need to put this on hold for a short while since I'll be away for a short business trip for a couple of days. /Regards, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 4 14:05:07 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 4 Apr 2013 12:05:07 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: Message-ID: Lars Hammarstrand writes: > --as='/Users/Shared/xbmc-depends/buildtools-native/bin/gas-preprocessor.pl Which version of gas-preprocessor.pl is this? A version prior to October 2012 would likely explain the crashes you are seeing. Carl Eugen From praks411 at gmail.com Thu Apr 4 14:12:54 2013 From: praks411 at gmail.com (praks411) Date: Thu, 4 Apr 2013 05:12:54 -0700 (PDT) Subject: [Libav-user] Audio and Video Stream copy Message-ID: <1365077574459-4657192.post@n4.nabble.com> Hi , I'm trying to follow the muxing example and also aconv code for one of my requirement. I want to write a simple container converter which just copy stream from one format to another which going through decoding. I've .flv and i'm converting into .avi. After doing all the initialization for both input and output file. I'm reading frame by frame from input using av_read_frame and based on stream index (audio/video) I'm writing them to output using av_interleaved_write_frame. Finally when copying finishes I'm writing trailer. The output file is generated but on playing it, it seems to be blank. I cannot get any audio or video from it. Moreover the duration of the file has changed original flv video was of 5min but the output avi file has duration of 1hr. I'm bit new to audio/video stuff but going through code and various mails. I think this has to do with time stamp or time base settings in output format context. But I'm not able to get them and how to set them. I followed avconv code and looked into do_stream_copy functions and I guess I'm not setting my output packets dts/pts and also duration. However I'm not able to get do_stream_copy function. If some has more insight it into please let me. I've also attached my code for any reference. Thanks in advance Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-and-Video-Stream-copy-tp4657192.html Sent from the libav-users mailing list archive at Nabble.com. From praks411 at gmail.com Thu Apr 4 14:43:55 2013 From: praks411 at gmail.com (praks411) Date: Thu, 4 Apr 2013 05:43:55 -0700 (PDT) Subject: [Libav-user] Audio and Video Stream copy In-Reply-To: <1365077574459-4657192.post@n4.nabble.com> References: <1365077574459-4657192.post@n4.nabble.com> Message-ID: <1365079435144-4657193.post@n4.nabble.com> Ok after setting pts, dts and duration of output packets as per do_streamcopy function in avconv.c I was able to get the correct duration in the ouput file. However still I'm not getting any audio or video. Please suggest what could be going wrong. Thanks, Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-and-Video-Stream-copy-tp4657192p4657193.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Apr 4 15:16:21 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 4 Apr 2013 13:16:21 +0000 (UTC) Subject: [Libav-user] Audio and Video Stream copy References: <1365077574459-4657192.post@n4.nabble.com> <1365079435144-4657193.post@n4.nabble.com> Message-ID: praks411 writes: > Ok after setting pts, dts and duration of output > packets as per do_streamcopy function in avconv.c Please note that avconv is known to contain many bugs (some of them security relevant) and is therefore unsupported, please see http://ffmpeg.org/download.html for supported versions. Check the doc/examples subdirectory for some example code. Carl Eugen From praks411 at gmail.com Thu Apr 4 15:37:40 2013 From: praks411 at gmail.com (praks411) Date: Thu, 4 Apr 2013 06:37:40 -0700 (PDT) Subject: [Libav-user] Audio and Video Stream copy In-Reply-To: References: <1365077574459-4657192.post@n4.nabble.com> <1365079435144-4657193.post@n4.nabble.com> Message-ID: <1365082660464-4657195.post@n4.nabble.com> Ok, I'm just using it for code reference just some of the parts so I guess that would be fine. I'm also looking into the example list. Also while in debugging I notice that on adding two new streams(video and audio one after another) using avformat_new_streams, the nb_streams (number of streams) field of AVFormatContext shows value as 2. But when I expand the streams field(in watch windows) I see only one stream(VIDEO) with index = 0 and id = 0, corresponding codec context with codec id set to AVMEDIA_TYPE_VIDEO. However I'm not able to see the other stream (AUDIO) and corresponding codec context. Is this fine? I'm debugging in vc++ 2012 with libav 9.1. Thanks, Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-and-Video-Stream-copy-tp4657192p4657195.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Apr 4 18:30:42 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 4 Apr 2013 16:30:42 +0000 (UTC) Subject: [Libav-user] Audio and Video Stream copy References: <1365077574459-4657192.post@n4.nabble.com> <1365079435144-4657193.post@n4.nabble.com> <1365082660464-4657195.post@n4.nabble.com> Message-ID: praks411 writes: > I'm debugging in vc++ 2012 with libav 9.1. This fork of FFmpeg contains several hundred known bugs that are not reproducible with FFmpeg, some of them security relevant. Please understand that we therefore cannot support it on this mailing list, please see http://ffmpeg.org/download.html for supported versions. Carl Eugen From harald.jordan at redstream.at Fri Apr 5 09:31:28 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Fri, 5 Apr 2013 09:31:28 +0200 Subject: [Libav-user] Filtering_video.c and yadif does not work Message-ID: <00da01ce31cf$9646b290$c2d417b0$@redstream.at> Hey all! I am trying to integrate a yadif filter into my program. It was not a big problem to get the filtering_video.c example running with const char *filter_descr = "scale=78:24"; unfortunately, when I change this line "yadif"; the unmodified example Filtering_video.c of the most current version will produce a memory access error ath this line: while (1) { ret = av_buffersink_get_frame(buffersink_ctx, filt_frame); but only every 2-5th runtime, at other runtimes it works just fine! OK, so far so good. Read error means basically we have a mem alloc or release error somewhere. Playing with this since 2 weeks but I don't get it out... As I am on windows and MSVC (this has reasons), I cannot really have a look where exactly the error is in the av_buffersink_get_frame function, but I read a lot into the source code - without success ;-). Any idea? All the best, Harry From cehoyos at ag.or.at Fri Apr 5 10:20:45 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 5 Apr 2013 08:20:45 +0000 (UTC) Subject: [Libav-user] =?utf-8?q?Filtering=5Fvideo=2Ec_and_yadif_does_not_w?= =?utf-8?q?ork?= References: <00da01ce31cf$9646b290$c2d417b0$@redstream.at> Message-ID: Harald Jordan writes: > As I am on windows and MSVC (this has reasons), > I cannot really have a look where exactly the > error is Without a backtrace (and without source code), this will be impossible to fix. Either use msvc or gdb to get a backtrace. Carl Eugen From lars.hammarstrand at gmail.com Fri Apr 5 11:51:34 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 5 Apr 2013 11:51:34 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/4 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > --as='/Users/Shared/xbmc-depends/buildtools-native/bin/ > gas-preprocessor.pl > > Which version of gas-preprocessor.pl is this? > A version prior to October 2012 would likely > explain the crashes you are seeing. > > Spot on! Exactly what I was thinking about some day ago. Unfortunately it's hard to tell which version xbmc is using since gas-preprocessor.pl lacks version info. I did a quick check and compared a version I found online, and sure enough, there were some address alignment updates in there among other stuff. Didn't find any gas-preprocessor.pl in the ffmpeg repo thus where do you find one which is supported by ffmpeg? diff: xbmc gas-preprocessor.pl / downloaded: 379a380,384 > my $thumb = 0; > > my %thumb_labels; > my %call_targets; > 398a404,406 > $thumb = 1 if $line =~ /\.code\s+16|\.thumb/; > $thumb = 0 if $line =~ /\.code\s+32|\.arm/; > 403c411 < $label = ".Literal_$literal_num"; --- > $label = "Literal_$literal_num"; 408a417 > $line .= ".align 2\n"; 414a424,439 > # thumb add with large immediate needs explicit add.w > if ($thumb and $line =~ /add\s+.*#([^@]+)/) { > $line =~ s/add/add.w/ if eval_expr($1) > 255; > } > > # mach-o local symbol names start with L (no dot) > $line =~ s/(? > if ($thumb and $line =~ /^\s*(\w+)\s*:/) { > $thumb_labels{$1}++; > } > > if ($line =~ /^\s*((\w+:)?blx?|\.globl)\s+(\w+)/) { > $call_targets{$3}++; > } > 491a517 > print ASMFILE ".align 2\n"; 495a522,524 > map print(ASMFILE ".thumb_func $_\n"), > grep exists $thumb_labels{$_}, keys %call_targets; > -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Fri Apr 5 13:11:51 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 5 Apr 2013 13:11:51 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/5 Lars Hammarstrand > > Didn't find any gas-preprocessor.pl in the ffmpeg repo thus where do you > find one which is supported by ffmpeg? > > Never mind, found this ref (in github.com/FFmpeg/FFmpeg/blob/master/doc/platform.texi): http://github.com/yuvi/gas-preprocessor, commit f4a42dc077 from Oct 03, 2012. I'll try this one and get back... -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Fri Apr 5 15:26:48 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 5 Apr 2013 15:26:48 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: 2013/4/5 Lars Hammarstrand > 2013/4/5 Lars Hammarstrand > >> >> Didn't find any gas-preprocessor.pl in the ffmpeg repo thus where do you >> find one which is supported by ffmpeg? >> >> Never mind, found this ref (in > github.com/FFmpeg/FFmpeg/blob/master/doc/platform.texi): > http://github.com/yuvi/gas-preprocessor, commit f4a42dc077 from Oct 03, > 2012. I'll try this one and get back... > Got some new errors with the new gas-preprocessor. Full log at: http://pastebin.com/wF4aZGis. Brief summary: Version info - ffmpeg e820e3a (n1.2), gas-preprocessor f4a42dc077 (Oct 03, 2012) 1. LD ffmpeg_g ld: warning: ARM function not 4-byte aligned: empty_row from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: end_of_row_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: start_column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: empty_odd_column from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: the_end from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: __b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __a_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __almost_empty_row from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_row_loop from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_b_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __a_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_simple_idct_arm from libavcodec/libavcodec.a(simple_idct_arm.o) *ld: in libavcodec/libavcodec.a(h264qpel_neon.o), in section __TEXT,__text reloc 12: R_ABS reloc but no absolute symbol at target address for architecture armv7* collect2: ld returned 1 exit status make: *** [ffmpeg_g] Error 1 2. A lot of warnings from gas-preprocessor.pl in libavcodec/arm: "*Unable to identify target architecture at /usr/local/bin/gas-preprocessor.pl line 82.*" -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From belkevich at mlsdev.com Fri Apr 5 15:31:44 2013 From: belkevich at mlsdev.com (Alexey Belkevich) Date: Fri, 5 Apr 2013 16:31:44 +0300 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: Message-ID: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> On Friday, April 5, 2013 at 4:26 PM, Lars Hammarstrand wrote: > Got some new errors with the new gas-preprocessor. Full log at: http://pastebin.com/wF4aZGis. Brief summary: > > Version info - ffmpeg e820e3a (n1.2), gas-preprocessor f4a42dc077 (Oct 03, 2012) > > 1. LD ffmpeg_g > ld: warning: ARM function not 4-byte aligned: empty_row from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: end_of_row_loop from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: start_column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: empty_odd_column from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: the_end from libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: __b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __a_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __almost_empty_row from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_row_loop from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_b_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __a_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_simple_idct_arm from libavcodec/libavcodec.a(simple_idct_arm.o) > ld: in libavcodec/libavcodec.a(h264qpel_neon.o), in section __TEXT,__text reloc 12: R_ABS reloc but no absolute symbol at target address for architecture armv7 > collect2: ld returned 1 exit status > make: *** [ffmpeg_g] Error 1 > > > > Try updated gas-preprocessor - https://github.com/mansr/gas-preprocessor.git It should fix error with "R_ABS reloc" -------------- next part -------------- An HTML attachment was scrubbed... URL: From ggarra13 at gmail.com Fri Apr 5 16:22:32 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Fri, 05 Apr 2013 11:22:32 -0300 Subject: [Libav-user] WMV saving with av_guess_format Message-ID: <515EDE28.1050505@gmail.com> I have a routine that saves a movie from sequential frames. However, when the filename is a .wmv file, av_guess_format seems to return a corrupt context. The result of saving is a movie file with just 3 frames. I also tried muxing.c from head but it did not compile. After a change in defines I could make it compile but when running it it returns sample_fmt not supported for wmv. From lars.hammarstrand at gmail.com Fri Apr 5 17:05:31 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 5 Apr 2013 17:05:31 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: 2013/4/5 Alexey Belkevich > On Friday, April 5, 2013 at 4:26 PM, Lars Hammarstrand wrote: > > Got some new errors with the new gas-preprocessor. Full log at: > http://pastebin.com/wF4aZGis. Brief summary: > > Version info - ffmpeg e820e3a (n1.2), gas-preprocessor f4a42dc077 (Oct > 03, 2012) > > 1. LD ffmpeg_g > ld: warning: ARM function not 4-byte aligned: empty_row from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: end_of_row_loop from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: start_column_loop from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: column_loop from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: empty_odd_column from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: the_end from > libavcodec/libavcodec.a(jrevdct_arm.o) > ld: warning: ARM function not 4-byte aligned: __b_evaluation from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_b_evaluation from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __a_evaluation from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __almost_empty_row from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_row_loop from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_b_evaluation2 from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __a_evaluation2 from > libavcodec/libavcodec.a(simple_idct_arm.o) > ld: warning: ARM function not 4-byte aligned: __end_simple_idct_arm from > libavcodec/libavcodec.a(simple_idct_arm.o) > *ld: in libavcodec/libavcodec.a(h264qpel_neon.o), in section > __TEXT,__text reloc 12: R_ABS reloc but no absolute symbol at target > address for architecture armv7* > collect2: ld returned 1 exit status > make: *** [ffmpeg_g] Error 1 > > Try updated gas-preprocessor - > https://github.com/mansr/gas-preprocessor.git > It should fix error with "R_ABS reloc" > > *Success!! * Finally is the last piece of the root cause identified and solved :D *Big Smile*. I'm pretty sure this will solve the xbmc problem as well but let me come back with a final confirmation later on. Found also this link regarding the same error: http://ffmpeg.org/pipermail/ffmpeg-user/2012-December/012307.html. May I suggest one of the following changes regarding the gas-processor.pl: 1) Distribute a prepackaged version of gas-processor.pl that works, together with ffmpeg. 2) At the very least, update the docs (docs/platform.texi) regarding the gas-processor.p referense to "https://github.com/mansr/gas-preprocessor" and also add some controls to "Configure" that verifies that the correct version of gas-processor.pl is used. Personally, I would prefer point nr 1. And finally, many Big Thanks to all who helped and assisted with this problem, especially to Carl that came up with a lot of different ideas and managed to find the right track (gas-processor.pl) and to Alexey that found a solution to the last error. /Regards, Lars. -------------- next part -------------- An HTML attachment was scrubbed... URL: From harald.jordan at redstream.at Fri Apr 5 18:21:15 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Fri, 5 Apr 2013 18:21:15 +0200 Subject: [Libav-user] Filtering_video.c and yadif does not work In-Reply-To: References: <00da01ce31cf$9646b290$c2d417b0$@redstream.at> Message-ID: <029601ce3219$990de940$cb29bbc0$@redstream.at> >Without a backtrace (and without source code), this will be impossible to fix. >Either use msvc or gdb to get a backtrace. >Carl Eugen Thanks Carl, I will try to boost my debugging abilities ;-) I just thought somebody might know that yadif e.g. buffers frames and that is why I need to to this and this before or after feeding the frame into the graph... Harry From lars.hammarstrand at gmail.com Fri Apr 5 19:41:05 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Fri, 5 Apr 2013 19:41:05 +0200 Subject: [Libav-user] noise on mp3-decoding In-Reply-To: References: Message-ID: With like __attribute__((aligned(32))), __attribute__((aligned(4))), or __attribute__((packed)) ( http://www.aleph1.co.uk/chapter-10-arm-structured-alignment-faq) Example: unsigned char request[BUFFER_SIZE] __attribute__((aligned(32))); 2013/3/26 Alexey Belkevich > Also, I found this note in avcodec_decode_audio4 description > > You might have to align the input buffer. The alignment requirements > depend on the CPU and the decoder > ( > http://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga834bb1b062fbcc2de4cf7fb93f154a3e > ) > > Is anyone know what it means? And how I can align buffer? > > Hello! > I'm building an iOS audio player. I've tested playback in iOS Simulator > (i386) and everything was fine. But when I've tested it on iPhone (ARM) > there was only noise. Other formats are playing fine. > I've done little research, and there what I found: > 1) av_read_frame - returns the same data on both device and simulator > (I've checked it in packet->data) > 2) avcodec_decode_audio4 - returns DIFFERENT data on device and simulator > (I've checked it in frame->data) > > Can it be related to ffmpeg compiling options? > Any ideas? > > -- > Alexey Belkevich > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Fri Apr 5 20:59:04 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 5 Apr 2013 11:59:04 -0700 Subject: [Libav-user] Audio good when writing to file, bad when streaming Message-ID: <140A9A94-8680-4596-AC8A-DCAE403887F8@bighillsoftware.com> Ok....so with the code I have developed with the help to questions asked over the past several weeks on this list, I can successfully process captured audio and video, encode them to an FLV file, and write the file out locally. All is well there. But when I change the output format to attempt to stream this, while all succeeds (meaning no errors), the video comes through fine, but the audio is complete junk. The only difference between the code executed in the two scenarios is: 1. Output name (which is a file name when writing locally, and a URL when streaming across the network). 2. I am setting a particular flag to indicate that output is not going to a file when streaming across the network, as in the following line of code: _avOutputFormat->flags = AVFMT_NOFILE As mentioned, the video stream is fine. The audio stream is fine when written locally, but when streamed, the audio played on the other end is junk. I have tried both av_write_frame and av_interleaved_write_frame, and netiher call solves the problem. Any ideas on how to rectify this problem would be greatly appreciated. Brad From harald.jordan at redstream.at Sat Apr 6 14:45:26 2013 From: harald.jordan at redstream.at (Harald Jordan) Date: Sat, 6 Apr 2013 14:45:26 +0200 Subject: [Libav-user] Filtering_video.c and yadif does not work In-Reply-To: <00da01ce31cf$9646b290$c2d417b0$@redstream.at> References: <00da01ce31cf$9646b290$c2d417b0$@redstream.at> Message-ID: <000001ce32c4$9d4bc350$d7e349f0$@redstream.at> Finally i found https://ffmpeg.org/trac/ffmpeg/ticket/25 which describes the same problem that I have (but 2 years old), the source of the Problem is acutally the MSVC compiler. My solution is to either outsource the ffmpeg code into a dll that's compiled with mingw (eclipse c++). But first I will try to port the whole project into Eclipse and g++... Thanks Carl, Harry _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user From justin-zhao at qq.com Sun Apr 7 08:08:21 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Sun, 7 Apr 2013 14:08:21 +0800 Subject: [Libav-user] AAC encoding question Message-ID: Hi, I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong. note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully! ============program================= main() { int ret; AVCodec *codec; AVCodecContext *c; AVFrame *frame; avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if (!codec) return; //avcodec_register(codec); c = avcodec_alloc_context3(codec); if (!c) return; c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; c->frame_size = 88200; c->sample_fmt = AV_SAMPLE_FMT_S16; // open it ret = avcodec_open2(c, codec, NULL); if (ret >= 0) printf("OK\r\n"); } Best Regards, Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin-zhao at qq.com Sun Apr 7 08:16:16 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Sun, 7 Apr 2013 14:16:16 +0800 Subject: [Libav-user] AAC encoding error Message-ID: Hi, I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong. note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully! ============program================= main() { int ret; AVCodec *codec; AVCodecContext *c; AVFrame *frame; avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if (!codec) return; //avcodec_register(codec); c = avcodec_alloc_context3(codec); if (!c) return; c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; c->frame_size = 88200; c->sample_fmt = AV_SAMPLE_FMT_S16; // open it ret = avcodec_open2(c, codec, NULL); if (ret >= 0) printf("OK\r\n"); } Best Regards, Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From haridassagarn at tataelxsi.co.in Sun Apr 7 08:40:29 2013 From: haridassagarn at tataelxsi.co.in (Haridas Sagar N) Date: Sun, 7 Apr 2013 06:40:29 +0000 Subject: [Libav-user] AAC encoding question In-Reply-To: References: Message-ID: <5773415B74E79546B5E12D008F2014B11F3C6F1D@SIXPRD0410MB396.apcprd04.prod.outlook.com> Change sample format toAV_SAMPLE_FMT_FLTP______________ From: libav-user-bounces at ffmpeg.org [libav-user-bounces at ffmpeg.org] on behalf of Justin [justin-zhao at qq.com] Sent: Sunday, April 07, 2013 11:38 AM To: libav-user Subject: [Libav-user] AAC encoding question Hi, I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong. note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully! ============program================= main() { int ret; AVCodec *codec; AVCodecContext *c; AVFrame *frame; avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if (!codec) return; //avcodec_register(codec); c = avcodec_alloc_context3(codec); if (!c) return; c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; c->frame_size = 88200; c->sample_fmt = AV_SAMPLE_FMT_S16; // open it ret = avcodec_open2(c, codec, NULL); if (ret >= 0) printf("OK\r\n"); } Best Regards, Justin Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you From justin-zhao at qq.com Sun Apr 7 08:45:18 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Sun, 7 Apr 2013 14:45:18 +0800 Subject: [Libav-user] AAC encoding question Message-ID: Thank you firstly, I have tried all sample format by for loop, but it still didn't work. ------------------ Best Regards, Justin ------------------ Original ------------------ From: "Haridas Sagar N"; Date: Sun, Apr 7, 2013 02:40 PM To: "This list is about using libavcodec, libavformat, libavutil, libavdeviceand libavfilter."; Subject: Re: [Libav-user] AAC encoding question Change sample format toAV_SAMPLE_FMT_FLTP______________ From: libav-user-bounces at ffmpeg.org [libav-user-bounces at ffmpeg.org] on behalf of Justin [justin-zhao at qq.com] Sent: Sunday, April 07, 2013 11:38 AM To: libav-user Subject: [Libav-user] AAC encoding question Hi, I am trying to encode audio using the AAC audio encoder with the program below, but when I call the avcodec_open2 funtion, the function always return -733130664. I don't know where is wrong in it. I'll very appreciate someone who can point out the wrong. note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the avcodec_open2 can return 0 successfully! ============program================= main() { int ret; AVCodec *codec; AVCodecContext *c; AVFrame *frame; avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if (!codec) return; //avcodec_register(codec); c = avcodec_alloc_context3(codec); if (!c) return; c->bit_rate = 64000; c->sample_rate = 44100; c->channels = 2; c->frame_size = 88200; c->sample_fmt = AV_SAMPLE_FMT_S16; // open it ret = avcodec_open2(c, codec, NULL); if (ret >= 0) printf("OK\r\n"); } Best Regards, Justin Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From whatsthat at gmail.com Sun Apr 7 09:22:46 2013 From: whatsthat at gmail.com (whatsthat) Date: Sun, 7 Apr 2013 15:22:46 +0800 Subject: [Libav-user] Does ffmpeg support non-english device name as parameter? Message-ID: Hi, all I tried to use ffmpeg to record audio with Windows Chinese version and failed. Firstly I used -list_devices to get all audio devices, it succeed with a list of audio devices. All these devices' name begin with some Chinese characters not showed properly. just like below: [dshow @ 000000000218cdc0] "?????????(VMware VMaudio (VMAUDIO) (" [dshow @ 000000000218cdc0] "?????????(VMware VMaudio (VMAUDIO) (" [dshow @ 000000000218cdc0] "???????????? (VMware VMaudio (VMAUDIO) " Then I tried to use ffmpeg to record audio as below: ffmpeg -f dshow -i audio="?????????(VMware VMaudio (VMAUDIO) (" -f wav test.wav it failed with error messages: [dshow @ 000000000241a000] Could not find audio device. audio=?????????(VMware VMaudio (VMAUDIO) (: Input/output error what is the matter? Chinese device name issue? hope some one could help me, thanks ! -------------- next part -------------- An HTML attachment was scrubbed... URL: From whatsthat at gmail.com Sun Apr 7 09:24:36 2013 From: whatsthat at gmail.com (whatsthat) Date: Sun, 7 Apr 2013 15:24:36 +0800 Subject: [Libav-user] Does ffmpeg support non-english device name as parameter? In-Reply-To: References: Message-ID: By the way, is it possible to pass audio device not with name? like using device's UUID or something else? how? On Sun, Apr 7, 2013 at 3:22 PM, whatsthat wrote: > Hi, all > > I tried to use ffmpeg to record audio with Windows Chinese version and > failed. > > Firstly I used -list_devices to get all audio devices, it succeed with a > list of audio devices. All these devices' name begin with some Chinese > characters not showed properly. just like below: > > [dshow @ 000000000218cdc0] "?????????(VMware VMaudio (VMAUDIO) (" > [dshow @ 000000000218cdc0] "?????????(VMware VMaudio (VMAUDIO) (" > [dshow @ 000000000218cdc0] "???????????? (VMware VMaudio (VMAUDIO) " > > Then I tried to use ffmpeg to record audio as below: > > ffmpeg -f dshow -i audio="?????????(VMware VMaudio (VMAUDIO) (" -f wav test.wav > > it failed with error messages: > > [dshow @ 000000000241a000] Could not find audio device. > audio=?????????(VMware VMaudio (VMAUDIO) (: Input/output error > > > what is the matter? Chinese device name issue? > > hope some one could help me, thanks ! > > > > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From goverall at hotmail.com Mon Apr 8 04:21:25 2013 From: goverall at hotmail.com (Gary Overall) Date: Sun, 7 Apr 2013 22:21:25 -0400 Subject: [Libav-user] av_read_frame concatenating data packets?? Message-ID: I have a TS file that presently includes 3 streams:1) h264 Video 2) aac audio 3) See Below The third stream contains some data that is being presented in ID3 format. The stream has a stream-ID of 0xBD (stream type private??). There are several packets (e.g. 5) of this type spread throughout the file, each with it own PTS. "avformat_open_input()" does not identify (unknown type) this third stream and "avformat_find_stream_info()" guesses it is an audio mp3 stream. Since I know the stream is data, I have tried overriding the stream type to AVMEDIA_TYPE_NB, AVMEDIA_TYPE_DATA, and AVMEDIA_TYPE_ATTACHMENT. I do not need a decoder for this stream since I can see the data in the packets returned from "av_read_frame()" and I can decode the data myself, however there is a problem that appears regardless my stream type overrides: "av_read_frame" seems to be saving up the data from all 5 of the packets and presenting them all to me as one packet with the PTS of the first one. I would really like each of the packets in the file to return from "av_read_frame()" individually, each with its own PTS. Does anyone know why av_read_frame() might be concatenating data packets and consolidating them into a single packet? Thank You,This has been a hard one for me. -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjoern.drabeck at gmail.com Mon Apr 8 07:23:11 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Mon, 8 Apr 2013 13:23:11 +0800 Subject: [Libav-user] Update filter settings at runtime Message-ID: Hi, I have recently played around with filters, and successfully integrated them into my test application, so I can apply video and audio filters, for example bass and treble filters when I play an audio file, or apply a video filter - but those I always set on opening of the file. I have however got a question on what the recommended practice would be on updating filters at runtime? I would like to be able for example to have an equalizer panel for the audio, where I can change the bass, treble, etc settings and apply those while playing back the file, so I can fine tune it to a setting that I like. The filter samples are very basic and don't really indicate an approach for that.. Anyone have any hints on how to do this? thanks, Bjoern -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Mon Apr 8 10:35:43 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 8 Apr 2013 08:35:43 +0000 Subject: [Libav-user] AAC encoding error In-Reply-To: References: Message-ID: On 4/7/13, Justin wrote: > Hi, > > I am trying to encode audio using the AAC audio encoder with the program > below, but when I call the avcodec_open2 funtion, the function always return > -733130664. I don't know where is wrong in it. I'll very appreciate someone > who can point out the wrong. Native AAC encoder is experimental and so you need to set additional flag to use. > > note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the > avcodec_open2 can return 0 successfully! > > ============program================= > main() > { > int ret; > AVCodec *codec; > AVCodecContext *c; > AVFrame *frame; > > avcodec_register_all(); > codec = avcodec_find_encoder(AV_CODEC_ID_AAC); > if (!codec) return; > //avcodec_register(codec); > c = avcodec_alloc_context3(codec); > if (!c) return; > > c->bit_rate = 64000; > c->sample_rate = 44100; > c->channels = 2; > c->frame_size = 88200; > c->sample_fmt = AV_SAMPLE_FMT_S16; > // open it > ret = avcodec_open2(c, codec, NULL); > if (ret >= 0) printf("OK\r\n"); > } > > Best Regards, > Justin From justin-zhao at qq.com Mon Apr 8 16:24:19 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Mon, 8 Apr 2013 22:24:19 +0800 Subject: [Libav-user] AAC encoding error Message-ID: But, how can I set the additional flag? thank you very much. ------------------ Justin ------------------ Original ------------------ From: "Paul B Mahol"; Date: Mon, Apr 8, 2013 04:35 PM To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error On 4/7/13, Justin wrote: > Hi, > > I am trying to encode audio using the AAC audio encoder with the program > below, but when I call the avcodec_open2 funtion, the function always return > -733130664. I don't know where is wrong in it. I'll very appreciate someone > who can point out the wrong. Native AAC encoder is experimental and so you need to set additional flag to use. > > note:if the codec AV_CODEC_ID_AAC is changed as AV_CODEC_ID_MP2, the > avcodec_open2 can return 0 successfully! > > ============program================= > main() > { > int ret; > AVCodec *codec; > AVCodecContext *c; > AVFrame *frame; > > avcodec_register_all(); > codec = avcodec_find_encoder(AV_CODEC_ID_AAC); > if (!codec) return; > //avcodec_register(codec); > c = avcodec_alloc_context3(codec); > if (!c) return; > > c->bit_rate = 64000; > c->sample_rate = 44100; > c->channels = 2; > c->frame_size = 88200; > c->sample_fmt = AV_SAMPLE_FMT_S16; > // open it > ret = avcodec_open2(c, codec, NULL); > if (ret >= 0) printf("OK\r\n"); > } > > Best Regards, > Justin _______________________________________________ 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 lulebo at gmail.com Mon Apr 8 17:31:59 2013 From: lulebo at gmail.com (Carl Lindqvist) Date: Mon, 8 Apr 2013 17:31:59 +0200 Subject: [Libav-user] Segmenting using pipe Message-ID: Hello I have been experimenting with encoding a single file and removing parts of the stream. I need this function when encoding material with breaks for commercials to remove bars and other funky stuff and sync with the subtitles. I have done some tests with piping (windows), and I can get this to work pretty well for two arbitrary segments as an example: (ffmpeg -i inputfile.mp4 -ss 00:10:00 -t 60 -bsf h264_mp4toannexb -vcodec copy -acodec copy -f mpegts - ffmpeg -i inputfile.mp4 -ss 00:20:00 -t 60 -bsf h264_mp4toannexb -vcodec copy -acodec copy -f mpegts - )| ffmpeg -y -f mpegts -i - -c:v libx264 -preset veryfast -x264opts keyint=75:min-keyint=75:no-scenecut -b:v 704k -minrate 704k -maxrate 704k -bufsize 1500k -profile:v baseline -aspect 16:9 -c:a libvo_aacenc -b:a 96k -ac 2 test.mp4 (this will create a two minute file from two different sections of the input file) The problem is the codec copying in the first parts. Since the timecodes might begin in the middle of a GOP, the final ffmpeg will not know what to do until the first I-frame shows up, so it just shows a freeze frame until that happens. There is a requirement of a fixed gop size of 3 secs for the final output file, so I need to do the encoding again for the final step, no cat can be used on segments. Is there a good intermediate codec to decode to in the first step? (Preferrably uncompressed to gain performance) I have found yuv4mpegvideo but that only does video. I need the audio as well. Anyone got any smart ideas? /Carl -------------- next part -------------- An HTML attachment was scrubbed... URL: From lulebo at gmail.com Mon Apr 8 18:03:56 2013 From: lulebo at gmail.com (Carl Lindqvist) Date: Mon, 8 Apr 2013 18:03:56 +0200 Subject: [Libav-user] Segmenting using pipe In-Reply-To: References: Message-ID: Sorry, wrong list. I will submit my question to ffmpeg-user instead. /Carl 2013/4/8 Carl Lindqvist > Hello > > I have been experimenting with encoding a single file and removing parts > of the stream. I need this function when encoding material with breaks for > commercials to remove bars and other funky stuff and sync with the > subtitles. > > I have done some tests with piping (windows), and I can get this to work > pretty well for two arbitrary segments as an example: > > (ffmpeg -i inputfile.mp4 -ss 00:10:00 -t 60 -bsf h264_mp4toannexb -vcodec > copy -acodec copy -f mpegts - > ffmpeg -i inputfile.mp4 -ss 00:20:00 -t 60 -bsf h264_mp4toannexb -vcodec > copy -acodec copy -f mpegts - )| ffmpeg -y -f mpegts -i - -c:v libx264 > -preset veryfast -x264opts keyint=75:min-keyint=75:no-scenecut -b:v 704k > -minrate 704k -maxrate 704k -bufsize 1500k -profile:v baseline -aspect 16:9 > -c:a libvo_aacenc -b:a 96k -ac 2 test.mp4 > > (this will create a two minute file from two different sections of the > input file) > > The problem is the codec copying in the first parts. Since the timecodes > might begin in the middle of a GOP, the final ffmpeg will not know what to > do until the first I-frame shows up, so it just shows a freeze frame until > that happens. > > There is a requirement of a fixed gop size of 3 secs for the final output > file, so I need to do the encoding again for the final step, no cat can be > used on segments. > > Is there a good intermediate codec to decode to in the first step? > (Preferrably uncompressed to gain performance) I have found yuv4mpegvideo > but that only does video. I need the audio as well. Anyone got any smart > ideas? > > /Carl > -------------- next part -------------- An HTML attachment was scrubbed... URL: From goverall at hotmail.com Tue Apr 9 01:14:51 2013 From: goverall at hotmail.com (Gary Overall) Date: Mon, 8 Apr 2013 19:14:51 -0400 Subject: [Libav-user] Disable probing on an individual stream?? Message-ID: I have asked this question in a more complex way before. I know more now and I am hoping someone could give me a suggestion. Please, please help. I have a stream in a .ts file that contains several packets of ID3 data. I would like to get each packet back from av_read_frame() individually for that stream. I am decoding the data myself so I do not care if the packets from this stream are properly identified. It seems like these packets are being identified as mp3 and av_read_frame() is gathering up all of these packets and presenting them as one. Is there any way that I can turn off probing for individual streams? I believe this might work because if I mangle the ID3 header in the first packet (change ID3 to ID4), I get the following message: [mpegts @ 0x103801800] probed stream 0 failed] on the call to av_read_frame() After that, all packets come back to me individually just as I would like. Is there a way I can prevent av_read_frame() from interpreting the packets from this stream? Any other suggestions please??? please?? I am very close.. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andrey.krieger.utkin at gmail.com Tue Apr 9 01:30:13 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Tue, 9 Apr 2013 02:30:13 +0300 Subject: [Libav-user] Update filter settings at runtime In-Reply-To: References: Message-ID: I'd also appreciate qualified answer to this question. If there will not be found any smart ability to do so, you can go with just recreating the whole filtergraph when settings change. I. e. you flush remaining frames from filtering mechanism, free AVFilterGraph, and create a new one for usage. But if used filters' output is dependent on previous frames, this is not acceptable solution. From andrey.krieger.utkin at gmail.com Tue Apr 9 01:35:10 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Tue, 9 Apr 2013 02:35:10 +0300 Subject: [Libav-user] Disable probing on an individual stream?? In-Reply-To: References: Message-ID: Please provide your minimized source code, which works the way you describe, and relevant media file sample, also high-debug-level output of it would be good. From andrey.krieger.utkin at gmail.com Tue Apr 9 01:42:35 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Tue, 9 Apr 2013 02:42:35 +0300 Subject: [Libav-user] AAC encoding error In-Reply-To: References: Message-ID: 2013/4/8 Justin : > But, how can I set the additional flag? thank you very much. This way: AVDictionary *opts = NULL; av_dict_set(&opts, "strict", "experimental", 0); int ret = avcodec_open2(encoder_context, codec, &opts); av_dict_free(&opts); From andrey.krieger.utkin at gmail.com Tue Apr 9 01:54:17 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Tue, 9 Apr 2013 02:54:17 +0300 Subject: [Libav-user] Segmenting using pipe In-Reply-To: References: Message-ID: 2013/4/8 Carl Lindqvist : > Is there a good intermediate codec to decode to in the first step? > (Preferrably uncompressed to gain performance) I have found yuv4mpegvideo > but that only does video. I need the audio as well. Anyone got any smart > ideas? Keep in mind that you need a support of this video codec from the side of concatenatable MPEGTS container. I don't know if i can advise any such codec. I'd think of making an application that works in one pass. -- Andrey Utkin From stefasab at gmail.com Tue Apr 9 02:24:18 2013 From: stefasab at gmail.com (Stefano Sabatini) Date: Tue, 9 Apr 2013 02:24:18 +0200 Subject: [Libav-user] Update filter settings at runtime In-Reply-To: References: Message-ID: <20130409002418.GM29586@arborea> On date Monday 2013-04-08 13:23:11 +0800, Bjoern Drabeck encoded: > Hi, > > I have recently played around with filters, and successfully integrated > them into my test application, so I can apply video and audio filters, for > example bass and treble filters when I play an audio file, or apply a video > filter - but those I always set on opening of the file. > > I have however got a question on what the recommended practice would be on > updating filters at runtime? See the process_command() API, for example how it is used in hue and sendcmd filters. > > I would like to be able for example to have an equalizer panel for the > audio, where I can change the bass, treble, etc settings and apply those > while playing back the file, so I can fine tune it to a setting that I like. > > The filter samples are very basic and don't really indicate an approach for > that.. > > Anyone have any hints on how to do this? You need to implement a process_command() callback, which should be fairly simple, or in alternative send a feature request on trac. -- FFmpeg = Fabulous & Fostering Merciless Power Erudite Generator From bjoern.drabeck at gmail.com Tue Apr 9 03:50:48 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Tue, 9 Apr 2013 09:50:48 +0800 Subject: [Libav-user] Update filter settings at runtime In-Reply-To: <20130409002418.GM29586@arborea> References: <20130409002418.GM29586@arborea> Message-ID: > > I have recently played around with filters, and successfully integrated > > them into my test application, so I can apply video and audio filters, > for > > example bass and treble filters when I play an audio file, or apply a > video > > filter - but those I always set on opening of the file. > > > > > I have however got a question on what the recommended practice would be > on > > updating filters at runtime? > > See the process_command() API, for example how it is used in hue and > sendcmd filters. > > Yes I saw that, and initially thought this mechanism is provided on most filters (at least those for which it would make sense), but it's very few.. > > > > I would like to be able for example to have an equalizer panel for the > > audio, where I can change the bass, treble, etc settings and apply those > > while playing back the file, so I can fine tune it to a setting that I > like. > > > > The filter samples are very basic and don't really indicate an approach > for > > that.. > > > > Anyone have any hints on how to do this? > > You need to implement a process_command() callback, which should be > fairly simple, or in alternative send a feature request on trac. > -- > > I suppose if I sent a feature request it would not be predictable when it becomes available, so that leaves trying to implement it myself. Will check out the code and do that, and report back on my progress. If the result seems reasonable I can make it available for other people too. thanks Bjoern -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin-zhao at qq.com Tue Apr 9 11:54:32 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Tue, 9 Apr 2013 17:54:32 +0800 Subject: [Libav-user] AAC encoding error Message-ID: I have done as your way, and pleasantly found that it really worked sucessfully. I very appreciate you, thank you very much again. ------------------ Best Regards, Justin ------------------ Original ------------------ From: "Andrey Utkin"; Date: Tue, Apr 9, 2013 07:42 AM To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error 2013/4/8 Justin : > But, how can I set the additional flag? thank you very much. This way: AVDictionary *opts = NULL; av_dict_set(&opts, "strict", "experimental", 0); int ret = avcodec_open2(encoder_context, codec, &opts); av_dict_free(&opts); _______________________________________________ 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 reuben.scratton at gmail.com Tue Apr 9 21:43:08 2013 From: reuben.scratton at gmail.com (Reuben Scratton) Date: Tue, 9 Apr 2013 20:43:08 +0100 Subject: [Libav-user] Efficient AAC decoding on ARM with FFmpeg 1.1.x Message-ID: Hi, I maintain a video player app on Android and recently had occasion to upgrade it's FFmpeg from 0.8.6 to 1.1.3. It seems that the 1.1 AAC decoder only outputs samples as AV_SAMPLE_FMT_FLTP. I therefore need to convert these to AV_SAMPLE_FMT_S16 before they can be played (via a platform API where integer samples are mandatory). I have implemented a naive C converter which works but it's not terribly efficient. I know there's optimized assembly routines in dsputils etc but damned if I can figure out how to use them. I've tried using FmtConvertContext but this expects input samples to be in the range -32K to +32K, whereas the codec outputs them in the range -1 to +1. Obviously I can scale them before using FmtConvertContext.float_to_int16() but then that's two passes over the same data, which isn't very cache efficient. What's the best way to do this? Thanks, Reuben Scratton -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Apr 9 23:41:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 9 Apr 2013 21:41:43 +0000 (UTC) Subject: [Libav-user] Efficient AAC decoding on ARM with FFmpeg 1.1.x References: Message-ID: Reuben Scratton writes: > I maintain a video player app on Android and recently had > occasion to upgrade it's FFmpeg from 0.8.6 to 1.1.3. Please update to 1.2 which is binary compatible and contains many bug fixes and features not present in 1.1. > It seems that the 1.1 AAC decoder only outputs samples as > AV_SAMPLE_FMT_FLTP. I therefore need to convert these to > AV_SAMPLE_FMT_S16 before they can be played Please use either libswresample or the aconvert audio filter (which uses libswresample) for the conversion. Carl Eugen From manojkpanghal at gmail.com Wed Apr 10 08:04:49 2013 From: manojkpanghal at gmail.com (manoj kumar) Date: Wed, 10 Apr 2013 11:34:49 +0530 Subject: [Libav-user] Hi, I am using the FFMPEg library (i.e. ffmpeg-20120622-git-c17808c-win32-shared) with PJSIP (i.e. open source SIP stack). In this case the PJSIP uses the FFMPEG for encoding decoding of video. Now my question is releated to H264 profile and setting for the same in FFMPEG. From PJSIP the H264 profile-level-id and profile-iop can be set, but only the profile-level-id gets reflected into the H264 packets generated by FFMPEg library, for example I set a profile like 42E01F, here both 42 (base profile) and 1F (i.e. profile-level-id 3.1) gets set but the profile-iop E0 doesn't gets reflected, the profile-iop seen in the H264 stream is C0.Same is case when I set 42801F, here as well the iop is seen as C0.Now Is there any limitation in FFMPEG to set different profile-iop with different/same profile-level-id? if not how can set it from and other software like PJSIP or does FFMPEG provide any API to do so? Message-ID: -------------- next part -------------- An HTML attachment was scrubbed... URL: From popa.bogdanp at gmail.com Wed Apr 10 10:54:55 2013 From: popa.bogdanp at gmail.com (Bogdan Popa) Date: Wed, 10 Apr 2013 11:54:55 +0300 Subject: [Libav-user] Problems converting raw camera frames Message-ID: <5017B35313444A7E81F5DE0CF13163E8@gmail.com> I'm receiving raw camera frames in the RGB32 little endian format and converting them to YUV420P frames which I then encode to H264 and it's working fine except for one thing: the colors are all messed up [1]. I'm a complete noob at this so I'm probably doing something very wrong. A stripped down version of the code I'm using is available here [2]. [1]: http://i.imgur.com/2EmLbPj.png [2]: http://pastebin.com/raw.php?i=UMvFQPiW -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Wed Apr 10 11:05:54 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 10 Apr 2013 09:05:54 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: Lars Hammarstrand writes: > 1) Distribute a prepackaged version of gas-processor.pl > that works, together with ffmpeg. Very, very definitely: No. > 2) At the very least, update the docs (docs/platform.texi) [...] Hm. 3) Write a mail to yuvi and ask him to merge the changes. (Done and done). Note that I originally wanted to write that I find it an incredibly bad idea that xbmc contains its own gas-preprocessor script. I agree now that the problem was not so simple but I still find it much, much better to have a link to upstream instead of a fork. Carl Eugen From cehoyos at ag.or.at Wed Apr 10 11:09:53 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 10 Apr 2013 09:09:53 +0000 (UTC) Subject: [Libav-user] Problems converting raw camera frames References: <5017B35313444A7E81F5DE0CF13163E8@gmail.com> Message-ID: Bogdan Popa writes: > I'm receiving raw camera frames in the RGB32 little > endian format and converting them to YUV420P frames > which I then encode to H264 and it's working fine > except for one thing: the colors are all messed up Instead of PIX_FMT_RGB32 (which depends on endianess), try the four native pix_fmts: AV_PIX_FMT_ARGB AV_PIX_FMT_ABGR AV_PIX_FMT_RGBA AV_PIX_FMT_BGRA (Sorry if you feel I should point out the right one immediately or at least mark the one that definitely does not work.) Generally, please don't use pastebin when posting here, post the complete information in your email. Carl Eugen From popa.bogdanp at gmail.com Wed Apr 10 11:27:55 2013 From: popa.bogdanp at gmail.com (Bogdan Popa) Date: Wed, 10 Apr 2013 12:27:55 +0300 Subject: [Libav-user] Problems converting raw camera frames In-Reply-To: References: <5017B35313444A7E81F5DE0CF13163E8@gmail.com> Message-ID: <854981BCE7924F6395BDC98E738D9B71@gmail.com> Hi Carl, Sorry for posting the code to pastebin, I hadn't realised that that was frowned upon. I just tried all four pixel formats that you mentioned and the results are as follows: AV_PIX_FMT_ARGB: http://i.imgur.com/zg7p9AT.png AV_PIX_FMT_ABGR: http://i.imgur.com/W2FISEX.png AV_PIX_FMT_RGBA: http://i.imgur.com/g6beWP4.png AV_PIX_FMT_BGRA: http://i.imgur.com/fbViLhj.png On Wednesday, April 10, 2013 at 12:09 PM, Carl Eugen Hoyos wrote: > Bogdan Popa writes: > > > I'm receiving raw camera frames in the RGB32 little > > endian format and converting them to YUV420P frames > > which I then encode to H264 and it's working fine > > except for one thing: the colors are all messed up > > > > > Instead of PIX_FMT_RGB32 (which depends on endianess), > try the four native pix_fmts: > AV_PIX_FMT_ARGB > AV_PIX_FMT_ABGR > AV_PIX_FMT_RGBA > AV_PIX_FMT_BGRA > (Sorry if you feel I should point out the right one > immediately or at least mark the one that definitely > does not work.) > > Generally, please don't use pastebin when posting here, > post the complete information in your email. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Wed Apr 10 17:26:08 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 10 Apr 2013 15:26:08 +0000 Subject: [Libav-user] Problems converting raw camera frames In-Reply-To: <854981BCE7924F6395BDC98E738D9B71@gmail.com> References: <5017B35313444A7E81F5DE0CF13163E8@gmail.com> <854981BCE7924F6395BDC98E738D9B71@gmail.com> Message-ID: On 4/10/13, Bogdan Popa wrote: > Hi Carl, > > Sorry for posting the code to pastebin, I hadn't realised that that was > frowned upon. > I just tried all four pixel formats that you mentioned and the results are > as follows: > > AV_PIX_FMT_ARGB: http://i.imgur.com/zg7p9AT.png > AV_PIX_FMT_ABGR: http://i.imgur.com/W2FISEX.png > AV_PIX_FMT_RGBA: http://i.imgur.com/g6beWP4.png > AV_PIX_FMT_BGRA: http://i.imgur.com/fbViLhj.png This all looks same to me, please do not top post. > > > On Wednesday, April 10, 2013 at 12:09 PM, Carl Eugen Hoyos wrote: > >> Bogdan Popa writes: >> >> > I'm receiving raw camera frames in the RGB32 little >> > endian format and converting them to YUV420P frames >> > which I then encode to H264 and it's working fine >> > except for one thing: the colors are all messed up >> > >> >> >> Instead of PIX_FMT_RGB32 (which depends on endianess), >> try the four native pix_fmts: >> AV_PIX_FMT_ARGB >> AV_PIX_FMT_ABGR >> AV_PIX_FMT_RGBA >> AV_PIX_FMT_BGRA >> (Sorry if you feel I should point out the right one >> immediately or at least mark the one that definitely >> does not work.) >> >> Generally, please don't use pastebin when posting here, >> post the complete information in your email. >> >> Carl Eugen >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org (mailto:Libav-user at ffmpeg.org) >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > > > From alexcohn at netvision.net.il Wed Apr 10 20:42:59 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 10 Apr 2013 21:42:59 +0300 Subject: [Libav-user] Problems converting raw camera frames In-Reply-To: References: <5017B35313444A7E81F5DE0CF13163E8@gmail.com> <854981BCE7924F6395BDC98E738D9B71@gmail.com> Message-ID: On 10 Apr 2013 12:28, "Bogdan Popa" wrote: > > Hi Carl, > > Sorry for posting the code to pastebin, I hadn't realised that that was frowned upon. > I just tried all four pixel formats that you mentioned and the results are as follows: > > AV_PIX_FMT_ARGB: http://i.imgur.com/zg7p9AT.png > AV_PIX_FMT_ABGR: http://i.imgur.com/W2FISEX.png > AV_PIX_FMT_RGBA: http://i.imgur.com/g6beWP4.png > AV_PIX_FMT_BGRA: http://i.imgur.com/fbViLhj.png Something may be wrong with your yuv420p. Please upload a raw image (without converting it to PNG) BR Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: From phuze9 at gmail.com Wed Apr 10 02:53:08 2013 From: phuze9 at gmail.com (phuzE) Date: Tue, 9 Apr 2013 17:53:08 -0700 (PDT) Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG Message-ID: <1365555188336-4657231.post@n4.nabble.com> I'm wanting to grab the pixels from the screen, and encode that into a video. The screenshot will save fine to a bmp file, but when I try and cast it to work with encoding into a video, I get a swscale() src image error in my output and the video file is just a blank white/gray screen. I made a topic on stackoverflow where you can see the source I'm using. -- View this message in context: http://libav-users.943685.n4.nabble.com/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231.html Sent from the libav-users mailing list archive at Nabble.com. From ggarra13 at gmail.com Thu Apr 11 02:01:42 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Wed, 10 Apr 2013 21:01:42 -0300 Subject: [Libav-user] Wrong playback of frames at start Message-ID: <5165FD66.3000909@gmail.com> In my viewer, I have a problem playing avi and mov files in that the second and third frame are not displayed and the second frame becomes the fourth continuing until end. The problem, however, does not show with wmv files. I'm guessing I have a pts/dts problem in my viewer but for the life of me cannot figure out what. I am wondering if someone faced something similar and what would be a good way to debug it. From ebersbac at hs-mittweida.de Thu Apr 11 07:41:01 2013 From: ebersbac at hs-mittweida.de (Steffen Ebersbach) Date: Thu, 11 Apr 2013 07:41:01 +0200 Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: <1365555188336-4657231.post@n4.nabble.com> References: <1365555188336-4657231.post@n4.nabble.com> Message-ID: <51664CED.9060206@hs-mittweida.de> > I'm wanting to grab the pixels from the screen, and encode that into a video. > The screenshot will save fine to a bmp file, but when I try and cast it to > work with encoding into a video, I get a swscale() src image error in my > output and the video file is just a blank white/gray screen. I made a topic > on stackoverflow > > where you can see the source I'm using. > I mad this for a longer time and now it works. I will look at my code later. But for the moment i think these two lines are wrong: |avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_BGR32, c->width, c->height); av_image_alloc(inpic->data, inpic->linesize, c->width, c->height, c->pix_fmt, 1);| you first copy the screenshot from pPixels to the AVpicture inpic, but then allocat the AVpicture, so a empty frame gots to the encoder. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Thu Apr 11 10:13:04 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 10:13:04 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: 2013/4/10 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > 1) Distribute a prepackaged version of gas-processor.pl > > that works, together with ffmpeg. > > Very, very definitely: > No. > > Ok, I take that as a No ;-) May I ask why? Another alternative solution could be using git submodule in the ffmpeg distro that points to a working version of gas-processor, would that be ok? > 3) Write a mail to yuvi and ask him to merge the > changes. > Mailed an update to ffmpeg-devel regarding the docs that David Conrad intercepted and the repo is now refreshed with Mans changes. Note that I originally wanted to write that I find it an incredibly bad > idea that xbmc contains its own gas-preprocessor script. > Well, first of all it's not xbmc's own gas-preprocessor but rather a copy of a version that (at that time) was compatible with ffmpeg 0.10.2. If you believe there is a better way, what do you suggest? > I still find it much, much better to have a link to upstream instead of a > fork. Like a git submodule or what do you suggest? -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From sendtofaraway at qq.com Thu Apr 11 11:08:26 2013 From: sendtofaraway at qq.com (=?ISO-8859-1?B?YW5kcm8=?=) Date: Thu, 11 Apr 2013 17:08:26 +0800 Subject: [Libav-user] how to mux MJPEG encoded data into AVI container Message-ID: I'm looking for a way to mux mjpeg (compressed) video data into a video container like mp4 or avi. (I'll also need to add audio in the future) . I do not want decode the MJpeg data first ,and then encode and mux it into AVI container . -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 11 11:32:19 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 09:32:19 +0000 (UTC) Subject: [Libav-user] how to mux MJPEG encoded data into AVI container References: Message-ID: andro writes: > I'm looking for a way to mux mjpeg (compressed) video > data into a video container like mp4 or avi. $ ffmpeg -i input -vcodec mjpeg out.avi > (I'll also need to add audio in the future) . $ ffmpeg -i input -vcodec mjpeg -acodec ac3 out.avi > I do not want decode the MJpeg data first ,and then > encode and mux it into AVI container . $ ffmpeg -i mjpeg -vcodec copy out.avi Generally, it is a good idea to test something before posting on this mailing list and report here if it does not work (includig failing command line and complete, uncut console output). Carl Eugen From cehoyos at ag.or.at Thu Apr 11 11:42:46 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 09:42:46 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: Lars Hammarstrand writes: > > 3) Write a mail to yuvi and ask him to merge the > > changes. > > Mailed an update to ffmpeg-devel regarding the docs > that David Conrad intercepted and the repo is now > refreshed with Mans changes. (Sorry: I had written a mail to him several days ago and when he merged I assumed it was because of my message, I had missed yours.) [...] > > I still find it much, much better to have a link > > to?upstream instead of a fork. > ? > Like a git submodule or what?do you suggest? A link to github as on http://ffmpeg.org/platform.html#Darwin-_0028Mac-OS-X_002c-iPhone_0029 Carl Eugen From praks411 at gmail.com Thu Apr 11 12:31:34 2013 From: praks411 at gmail.com (praks411) Date: Thu, 11 Apr 2013 03:31:34 -0700 (PDT) Subject: [Libav-user] Seeking encoded video (.avi) Message-ID: <1365676294036-4657245.post@n4.nabble.com> Hi, I'm writing a small application to convert between container formats for video files. My input is a video file (.flv, .mp4, .mov) and output is exactly same video in .avi container. I'm using muxing.c example for my reference. I'm just copying both input and output stream as it is, except that I'm changing the pts and dts of packets. The output file is generate properly and I'm able to play it on windows media player. But it has some issues. 1. If I play the output (.avi) file in vlc then I'm just able to play video there is no audio. 2. On windows media player I'm getting both audio and video but I'm not able to seek the file. Please post your suggestion what could be going wrong. Thanks and Regards, Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Seeking-encoded-video-avi-tp4657245.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Apr 11 13:10:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 11:10:05 +0000 (UTC) Subject: [Libav-user] Seeking encoded video (.avi) References: <1365676294036-4657245.post@n4.nabble.com> Message-ID: praks411 writes: > 1. If I play the output (.avi) file in vlc then > I'm just able to play video there is no audio. How does ffmpeg -i output.avi look like? (This sounds like a well-known bug in vlc.) Carl Eugen From praks411 at gmail.com Thu Apr 11 13:22:26 2013 From: praks411 at gmail.com (praks411) Date: Thu, 11 Apr 2013 04:22:26 -0700 (PDT) Subject: [Libav-user] Seeking encoded video (.avi) In-Reply-To: References: <1365676294036-4657245.post@n4.nabble.com> Message-ID: <1365679346082-4657247.post@n4.nabble.com> Hi Carl, Thanks for the reply, I'll check and let you know. Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Seeking-encoded-video-avi-tp4657245p4657247.html Sent from the libav-users mailing list archive at Nabble.com. From lars.hammarstrand at gmail.com Thu Apr 11 13:55:57 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 13:55:57 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: 2013/4/11 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > Like a git submodule or what do you suggest? > > A link to github as on > http://ffmpeg.org/platform.html#Darwin-_0028Mac-OS-X_002c-iPhone_0029 > > Well, I'm not sure a that just a link would make it more useful than having our own copy of gas-processor during the automatic configure process that xbmc conducts :) But read on... The link explains: *"Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from http://github.com/yuvi/gas-preprocessor to build the optimized assembler functions. Just download the Perl script and put it somewhere in your PATH, FFmpeg?s configure will pick it up automatically." * The line "put it somewhere in your PATH" is the reason why xbmc introduced a patch to make configure point out the gas-preprocessor with an absolute path thus make it able to override any potential erroneous or outdated versions of gas-preprocessor in the search path. I would rather see a different solution in the future and get rid of this tedious but still necessary xbmc patch so I'm open to any suggestions! One idea could be to add an "gas" option to configure , like " --gas=/abosolute/path/to/gas-preprocessor" (pls note that this does not work: "--as=/absolute/path/to/gas-preprocessor.pl /path/to/as..." ). As an addition to the above suggestion, a version control of gas-processor.pl during the configure process of ffmpeg would be a rather nice complement. Any ideas? Regard, Lars -- Ps.. 1. xbmc gas patch: https://github.com/xbmc/xbmc/blob/master/lib/ffmpeg/patches/0029-stop-forcing-gas-preprocessor-for-darwin.patch 2. not important but I would be most grateful if you were are able to answer some of my previous questions as well: > 1) Distribute a prepackaged version of gas-processor.pl > > that works, together with ffmpeg. > > Very, very definitely: > No. > > Ok, I take that as a No ;-) May I ask why? Another alternative solution could be using git submodule in the ffmpeg distro that points to a working version of gas-processor, would that be ok? > Note that I originally wanted to write that I find it an incredibly bad > idea that xbmc contains its own gas-preprocessor script. > Well, first of all it's not xbmc's own gas-preprocessor but rather a copy of a version that (at that time) was compatible with ffmpeg 0.10.2. If you believe there is a better way, what do you suggest? To be clear on this one: how du you suggest we should automatic configure and compile ffmpeg if xbmc should not contain it's own gas-preprocessor? -- -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 11 14:13:00 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 12:13:00 +0000 (UTC) Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: Lars Hammarstrand writes: > One idea could be to add an "gas" option to configure, > like "--gas=/abosolute/path/to/gas-preprocessor" This does already exist afaik. > (pls note that this?does not work:? > "--as=/absolute/path/to/gas-preprocessor.pl /path/to/as..."?). Please test "/path/to/gcc" > As an addition to the above suggestion, a version > control of gas-processor.pl during the configure > process of ffmpeg would be a rather nice complement. Patch (extremely) welcome! (My idea is to grep for the right syntax in configure, contrary to you I cannot test.) Regarding your other question: Simply do not provide a copy of anything that exists already, simply add a link. Carl Eugen From phuze9 at gmail.com Thu Apr 11 14:04:22 2013 From: phuze9 at gmail.com (phuzE) Date: Thu, 11 Apr 2013 05:04:22 -0700 (PDT) Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: <51664CED.9060206@hs-mittweida.de> References: <1365555188336-4657231.post@n4.nabble.com> <51664CED.9060206@hs-mittweida.de> Message-ID: Hmm, that makes sense...though when I switch the order of the instructions or remove av_image_alloc, I get an unhandled exception (at 0x6C9280EA avcodec-55.dll access violation reading 0x.....). Thank you for taking the time to help me by the way. On Thu, Apr 11, 2013 at 12:42 AM, Steffen Ebersbach-2 [via libav-users] < ml-node+s943685n4657240h24 at n4.nabble.com> wrote: > > I'm wanting to grab the pixels from the screen, and encode that into a video. > The screenshot will save fine to a bmp file, but when I try and cast it to > work with encoding into a video, I get a swscale() src image error in my > output and the video file is just a blank white/gray screen. I made a topic > on stackoverflow > where you can see the source I'm using. > > > > I mad this for a longer time and now it works. I will look at my code > later. But for the moment i think these two lines are wrong: > > avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_BGR32, c->width, c->height); > av_image_alloc(inpic->data, inpic->linesize, c->width, c->height, c->pix_fmt, 1); > > you first copy the screenshot from pPixels to the AVpicture inpic, but > then allocat the AVpicture, so a empty frame gots to the encoder. > > > > _______________________________________________ > 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/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657240.html > To unsubscribe from Encoding a screenshot into a video using FFMPEG, click > here > . > NAML > -- View this message in context: http://libav-users.943685.n4.nabble.com/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657249.html Sent from the libav-users mailing list archive at Nabble.com. From praks411 at gmail.com Thu Apr 11 14:08:55 2013 From: praks411 at gmail.com (praks411) Date: Thu, 11 Apr 2013 05:08:55 -0700 (PDT) Subject: [Libav-user] Seeking encoded video (.avi) In-Reply-To: <1365679346082-4657247.post@n4.nabble.com> References: <1365676294036-4657245.post@n4.nabble.com> <1365679346082-4657247.post@n4.nabble.com> Message-ID: <1365682135803-4657250.post@n4.nabble.com> Please the output of ffmpeg -i The output file is perfect. It is working in both windows and vlc and seeking is also fixed. So is this related to pts and dts setting? I still don't get what I'm missing in my code. in>ffmpeg.exe -i output.avi new_output.avi ffmpeg version N-51511-g599866f Copyright (c) 2000-2013 the FFmpeg developers built on Apr 1 2013 12:44:46 with gcc 4.8.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 24.100 / 52. 24.100 libavcodec 55. 2.100 / 55. 2.100 libavformat 55. 1.100 / 55. 1.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 48.105 / 3. 48.105 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, avi, from 'output.avi': Metadata: encoder : Lavf54.20.3 Duration: 00:05:13.89, start: 0.000000, bitrate: 317 kb/s Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuv420p, 320x130 [SAR 1 :1 DAR 32:13], 48 fps, 24 tbr, 48 tbn, 48 tbc Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, mono, fltp, 56 kb/s Output #0, avi, to 'new_output.avi': Metadata: ISFT : Lavf55.1.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 320x130 [SAR 1:1 DAR 32:13], q=2-31, 200 kb/s, 24 tbn, 24 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, mono, fltp Stream mapping: Stream #0:0 -> #0:0 (h264 -> mpeg4) Stream #0:1 -> #0:1 (aac -> libmp3lame) Press [q] to stop, [?] for help frame= 418 fps=0.0 q=4.3 size= 712kB time=00:00:17.42 bitrate= 334.6kbits/s frame= 854 fps=853 q=10.2 size= 1353kB time=00:00:35.60 bitrate= 311.2kbits/ frame= 1305 fps=869 q=9.6 size= 1983kB time=00:00:54.41 bitrate= 298.5kbits/s frame= 1751 fps=875 q=12.5 size= 2592kB time=00:01:12.98 bitrate= 291.0kbits/ frame= 2203 fps=881 q=12.7 size= 3226kB time=00:01:31.79 bitrate= 287.9kbits/ frame= 2660 fps=886 q=8.2 size= 3812kB time=00:01:50.83 bitrate= 281.7kbits/s frame= 3111 fps=889 q=8.7 size= 4380kB time=00:02:09.64 bitrate= 276.7kbits/s frame= 3559 fps=889 q=12.0 size= 4998kB time=00:02:28.32 bitrate= 276.0kbits/ frame= 4013 fps=892 q=10.7 size= 5647kB time=00:02:47.23 bitrate= 276.6kbits/ frame= 4469 fps=894 q=6.1 size= 6258kB time=00:03:06.22 bitrate= 275.3kbits/s frame= 4921 fps=895 q=10.3 size= 6885kB time=00:03:25.08 bitrate= 275.0kbits/ frame= 5373 fps=895 q=9.9 size= 7484kB time=00:03:43.89 bitrate= 273.8kbits/s frame= 5826 fps=896 q=7.0 size= 8103kB time=00:04:02.78 bitrate= 273.4kbits/s frame= 6281 fps=897 q=7.3 size= 8714kB time=00:04:21.72 bitrate= 272.8kbits/s frame= 6732 fps=897 q=5.6 size= 9329kB time=00:04:40.52 bitrate= 272.4kbits/s frame= 7185 fps=898 q=8.0 size= 9944kB time=00:04:59.41 bitrate= 272.1kbits/s frame= 7521 fps=900 q=2.8 Lsize= 10651kB time=00:05:13.88 bitrate= 278.0kbits/ s video:7716kB audio:2452kB subtitle:0 global headers:0kB muxing overhead 4.748217 % C:\vid_an2\ffmpeg-latest-win32-static\ffmpeg-20130401-git-599866f-win32-static\b in>^A -- View this message in context: http://libav-users.943685.n4.nabble.com/Seeking-encoded-video-avi-tp4657245p4657250.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Thu Apr 11 14:27:43 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 12:27:43 +0000 (UTC) Subject: [Libav-user] Seeking encoded video (.avi) References: <1365676294036-4657245.post@n4.nabble.com> <1365679346082-4657247.post@n4.nabble.com> <1365682135803-4657250.post@n4.nabble.com> Message-ID: praks411 writes: > The output file is perfect. It is working in both > windows and vlc It appears I misunderstood, I thought the file does not work with vlc. Sorry for the noise, Carl Eugen From carel.combrink at gmail.com Thu Apr 11 14:56:15 2013 From: carel.combrink at gmail.com (Carel Combrink) Date: Thu, 11 Apr 2013 14:56:15 +0200 Subject: [Libav-user] 16-Bit RAW Video Recording Problem Message-ID: Hi, I am using FFmpeg and an external open source library to record video to file. I want to record the RAW video to the file because I do not want to waste time to do compression and I can not afford to lose information. In most cases the video will be 1024x768 @ 40 fps ,16 bit greyscale. The external library that I am using is FLITr: https://code.google.com/p/flitr/ Using a previous version of FFmpeg this was working but after some updates on FFmpeg and subsequently updates on FLITr to support the changes, the recording is not working any more I have spoken to the developers of FLITr and we are not sure what we are doing wrong. I have an old recording recorded when everything still worked and I compare that to a recording made with the latest versions of the libraries and I get the following results: *Using ffplay:* Recording that works (recorded on 12 September 2012): >ffplay Recording_01.avi ffplay version N-51683-g9dc88ac Copyright (c) 2003-2013 the FFmpeg developers built on Apr 8 2013 21:22:02 with gcc 4.8.0 (GCC) configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 25.100 / 52. 25.100 libavcodec 55. 2.100 / 55. 2.100 libavformat 55. 1.100 / 55. 1.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 49.101 / 3. 49.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, matroska,webm, from 'LAB_OCON_Recording_01.avi':B f=0/0 Metadata: ENCODER : *Lavf54.25.104* Duration: 00:00:13.35, start: 0.000000, *bitrate: 503329 kb/s* Stream #0:0: Video: rawvideo *(Y1[0][16] / 0x10003159), gray16le,*1024x768, SAR 1:1 DAR 4:3, 40 fps, 40 tbr, 1k tbn, 1k tbc (default) 4.27 A-V: 0.000 fd= 14 aq= 0KB vq= 9216KB sq= 0B f=0/0 New Recording: >ffplay Recording.avi ffplay version N-51683-g9dc88ac Copyright (c) 2003-2013 the FFmpeg developers built on Apr 8 2013 21:22:02 with gcc 4.8.0 (GCC) configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 25.100 / 52. 25.100 libavcodec 55. 2.100 / 55. 2.100 libavformat 55. 1.100 / 55. 1.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 49.101 / 3. 49.101 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 nan A-V: 0.000 fd= 0 aq[rawvideo @ 01dc8c40] = Invalid pixel format. Last message repeated 1 times/ 0 L a s Input #0, matroska,webm, from 'Recording.avi': Metadata: ENCODER : *Lavf55.1.100* Duration: 00:00:00.70, start: 0.000000, *bitrate: N/A* Stream #0:0: Video: rawvideo, 1024x768, SAR 1:1 DAR 4:3, 40 fps, 40 tbr, 1k tbn, 1k tbc (default) [rawvideo @ 01dc8c40] Invalid pixel format. *Recording.avi: could not open codecs* In *bold *I have marked the things that are very different on the 2 recordings. It appears that the header of the new recording is not set up correctly. Is there something that we are doing wrong when creating the recording or is this a problem with FFmpeg? PS: To look at the source code that starts the recording look at the following file in FLITr: https://code.google.com/p/flitr/source/browse/trunk/src/flitr/ffmpeg_writer.cpp As mentioned, in the end I am using AV_CODEC_ID_RAWVIDEO as the codec and the pixel format is chosen by FLITr as gray16le Any help will be appreciated. Regards, Carel -------------- next part -------------- An HTML attachment was scrubbed... URL: From praks411 at gmail.com Thu Apr 11 15:14:42 2013 From: praks411 at gmail.com (praks411) Date: Thu, 11 Apr 2013 06:14:42 -0700 (PDT) Subject: [Libav-user] Seeking encoded video (.avi) In-Reply-To: References: <1365676294036-4657245.post@n4.nabble.com> <1365679346082-4657247.post@n4.nabble.com> <1365682135803-4657250.post@n4.nabble.com> Message-ID: <1365686082571-4657254.post@n4.nabble.com> No, the output file which i'm generating is not working. However it works when I again encode it with ffmpeg. So I'm looking for some help what I'm doing wrong. Please find below the snippet of code which I'm using av_register_all(); //if ( av_open_input_file( &m_data->formatCtx, cfilename, 0, 0, 0) != 0 ) if ( (ret = avformat_open_input( &informat, sourcefile, 0, 0)) != 0 ) { av_strerror(ret,errbuf,sizeof(errbuf)); PRINT_VAL("Not able to Open file;; ", errbuf) std::getchar(); return -1; } else { PRINT_MSG("Opened File ") } if ((ret = avformat_find_stream_info(informat, 0)) < 0 ) { av_strerror(ret,errbuf,sizeof(errbuf)); PRINT_VAL("Not Able to find stream info:: ", errbuf) std::getchar(); return -1; } else { PRINT_MSG("Got stream Info ") } av_dump_format(informat, 0, sourcefile, 0); for(unsigned int i = 0; inb_streams; i++) { if(informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { PRINT_MSG("Found Video Stream ") in_vid_strm_idx = i; in_vid_strm = informat->streams[i]; } if(informat->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { PRINT_MSG("Found Audio Stream ") in_aud_strm_idx = i; in_aud_strm = informat->streams[i]; } } if(in_vid_strm != NULL) { in_vid_codec_ctx = in_vid_strm->codec; in_vid_codec = avcodec_find_decoder(in_vid_strm->codec->codec_id); if(in_vid_codec == NULL) { PRINT_MSG("Unable to find Video codec ") } else { PRINT_MSG("Found Vid Decoder Opening it ") if(need_decoding) { if((ret = avcodec_open2(in_vid_codec_ctx, in_vid_codec, NULL))< 0) { av_strerror(ret,errbuf,sizeof(errbuf)); PRINT_VAL("No Video Decoder:: ", errbuf) std::getchar(); return -1; } else { PRINT_MSG("Opened Video Decoder ") } } } } if(in_aud_strm != NULL) { in_aud_codec_ctx = in_aud_strm->codec; in_aud_codec = avcodec_find_decoder(in_aud_strm->codec->codec_id); if(in_aud_codec == NULL) { PRINT_MSG("Unable to find Audio Codec ") } else { PRINT_MSG("Found Aud Decoder Opening it ") if(need_decoding) { if((ret = avcodec_open2(in_aud_codec_ctx, in_aud_codec, NULL))< 0) { av_strerror(ret,errbuf,sizeof(errbuf)); PRINT_VAL("Not Able to find Audio Decoder:: ", errbuf) std::getchar(); return -1; } else { PRINT_MSG("Opened Audio Decoder ") } } } } if(need_encoding) { AVCodecContext * c1, *c2; outfmt = av_guess_format(NULL, (const char*)outfile, NULL); if(NULL == outfmt) { PRINT_MSG("Not able to Guess Output format ") std::getchar(); } else { outformat = avformat_alloc_context(); if(outformat) { PRINT_MSG("Got Output context ") outformat->oformat = outfmt; _snprintf(outformat->filename, sizeof(outformat->filename), "%s", (const char*)outfile); if(outfmt->video_codec != AV_CODEC_ID_NONE) { out_vid_codec = avcodec_find_encoder(outfmt->video_codec); if(NULL == out_vid_codec) { PRINT_MSG("Could Not Find Vid Encoder") } else { PRINT_MSG("Found Out Vid Encoder ") out_vid_strm = avformat_new_stream(outformat, out_vid_codec); if(NULL == out_vid_strm) { PRINT_MSG("Failed to Allocate Output Vid Strm ") } else { PRINT_MSG("Allocated Video Stream ") if(avcodec_copy_context(out_vid_strm->codec, in_vid_codec_ctx) != 0) { PRINT_MSG("Failed to Copy Context ") } else { PRINT_MSG("Copied Context ") out_vid_strm->codec->codec_id = in_vid_strm->codec->codec_id; out_vid_strm->sample_aspect_ratio.den = 1; out_vid_strm->sample_aspect_ratio.num = 1; out_vid_strm->time_base.num = in_vid_strm->time_base.num; out_vid_strm->time_base.den = in_vid_strm->time_base.den; out_vid_strm->r_frame_rate.den = in_vid_strm->r_frame_rate.den; out_vid_strm->r_frame_rate.num = in_vid_strm->r_frame_rate.num; out_vid_strm->avg_frame_rate.den = in_vid_strm->avg_frame_rate.den; out_vid_strm->avg_frame_rate.num = in_vid_strm->avg_frame_rate.num; } } } } if(outfmt->audio_codec != AV_CODEC_ID_NONE) { out_aud_codec = avcodec_find_encoder(outfmt->audio_codec); if(NULL == out_aud_codec) { PRINT_MSG("Could Not Find Out Aud Encoder ") } else { PRINT_MSG("Found Out Aud Encoder ") out_aud_strm = avformat_new_stream(outformat, out_aud_codec); if(NULL == out_aud_strm) { PRINT_MSG("Failed to Allocate Out Vid Strm ") } else { if(avcodec_copy_context(out_aud_strm->codec, in_aud_codec_ctx) != 0) { PRINT_MSG("Failed to Copy Context ") } else { PRINT_MSG("Copied Context ") // out_aud_strm->id = 1; out_aud_strm->codec->codec_id = in_aud_strm->codec->codec_id; out_aud_strm->pts = in_aud_strm->pts; out_aud_strm->duration = in_aud_strm->duration; out_aud_strm->time_base.num = in_aud_strm->time_base.num; out_aud_strm->time_base.den = in_aud_strm->time_base.den; } } } } } } } if(need_encoding) { //av_dump_format(outformat, 0, outfile, 0); if (!(outfmt->flags & AVFMT_NOFILE)) { if (avio_open2(&outformat->pb, outfile, AVIO_FLAG_WRITE,NULL, NULL) < 0) { PRINT_VAL("Could Not Open File ", outfile) std::getchar(); return 1; } } /* Write the stream header, if any. */ if (avformat_write_header(outformat, NULL) < 0) { PRINT_VAL("Error Occurred While Writing Header ", outfile) std::getchar(); return 1; } else { PRINT_MSG("Written Output header ") } } AVFrame *pframeT, *pframe; pframeT = pframe = NULL; pframeT = avcodec_alloc_frame(); pframe = avcodec_alloc_frame(); uint8_t *buffer_pic = NULL; int num_bytes = 0, pic_sz = 0; num_bytes = avpicture_get_size(PIX_FMT_RGB24, in_vid_strm->codec->width, in_vid_strm->codec->height); if(num_bytes != 0) { PRINT_VAL("Number of Bytes ", num_bytes) buffer_pic = (uint8_t*)av_malloc(num_bytes); if(buffer_pic == NULL) { PRINT_MSG("Failed to allocate Buffer ") } } pic_sz = avpicture_fill((AVPicture*)pframe,buffer_pic, PIX_FMT_RGB24, in_vid_strm->codec->width, in_vid_strm->codec->height); if(0 == pic_sz) { PRINT_MSG("avpicture_fill failed ") } else { PRINT_VAL("Total Pic size ", pic_sz) } PRINT_MSG("==============================================================") PRINT_VAL("In Vid Codec Time Base:: NUM :: ", in_vid_strm->codec->time_base.num) PRINT_VAL("In Vid Codec Time Base:: DEN :: ", in_vid_strm->codec->time_base.den) PRINT_VAL("In Vid Stream Time Base:: NUM :: ", in_vid_strm->time_base.num) PRINT_VAL("In Vid Stream Time Base:: DEN :: ", in_vid_strm->time_base.den) PRINT_VAL("In Aud Codec Time Base:: NUM :: ", in_aud_strm->codec->time_base.num) PRINT_VAL("In Aud Codec Time Base:: DEN :: ", in_aud_strm->codec->time_base.den) PRINT_VAL("In Aud Stream Time Base:: NUM :: ", in_aud_strm->time_base.num) PRINT_VAL("In Aud Stream Time Base:: DEN :: ", in_aud_strm->time_base.den) PRINT_MSG("==============================================================") PRINT_VAL("Out Vid Codec Time Base:: NUM :: ", out_vid_strm->codec->time_base.num) PRINT_VAL("Out Vid Codec Time Base:: DEN :: ", out_vid_strm->codec->time_base.den) PRINT_VAL("Out Vid Stream Time Base:: NUM :: ", out_vid_strm->time_base.num) PRINT_VAL("Out Vid Stream Time Base:: DEN :: ", out_vid_strm->time_base.den) PRINT_VAL("Out Aud Codec Time Base:: NUM :: ", out_aud_strm->codec->time_base.num) PRINT_VAL("Out Aud Codec Time Base:: DEN :: ", out_aud_strm->codec->time_base.den) PRINT_VAL("Out Aud Stream Time Base:: NUM :: ", out_aud_strm->time_base.num) PRINT_VAL("Out Aud Stream Time Base:: DEN :: ", out_aud_strm->time_base.den) PRINT_MSG("==============================================================") AVPacket pkt; AVPacket outpkt; //int64_t aud_pts = -1, vid_pts = -1; int num_aud_pkt, num_vid_pkt, num_total_pkt, num_unkwn_pkt; num_aud_pkt = num_vid_pkt = num_total_pkt = num_unkwn_pkt = 0; int got_vid_pkt = 0, num_vid_dec = 0, num_aud_dec = 0; int64_t aud_pts = -1, vid_pts = -1, aud_dts = -1, vid_dts = -1; while(av_read_frame(informat, &pkt) >= 0) { if(pkt.stream_index == in_vid_strm_idx) { //PRINT_MSG("Got Video Frame ") PRINT_VAL("VID Pkt PTS ", pkt.pts) PRINT_VAL("VID Pkt DTS ", pkt.dts) num_vid_pkt++; if(need_decoding) { avcodec_decode_video2(in_vid_codec_ctx, pframeT, &got_vid_pkt, &pkt); if(got_vid_pkt) { // PRINT_MSG("Decode Video Pkt ") num_vid_dec++; } got_vid_pkt = 0; } #if 1 if(need_encoding) { av_init_packet(&outpkt); if(pkt.pts != AV_NOPTS_VALUE) { outpkt.pts = av_rescale_q(pkt.pts, in_vid_strm->time_base, out_vid_strm->time_base); //outpkt.pts = av_rescale_q(pkt.pts, out_vid_strm->time_base,out_vid_strm->codec->time_base); PRINT_VAL("ReScaled VID Pts ", outpkt.pts) vid_pts = outpkt.pts; } else { outpkt.pts = AV_NOPTS_VALUE; } if(pkt.dts == AV_NOPTS_VALUE) { //outpkt.dts = av_rescale_q(in_vid_strm->cur_dts, AV_TIME_BASE_Q, out_vid_strm->time_base); outpkt.dts = AV_NOPTS_VALUE; } else { outpkt.dts = av_rescale_q(pkt.dts, in_vid_strm->time_base, out_vid_strm->time_base); //outpkt.dts = av_rescale_q(pkt.dts, out_vid_strm->time_base, out_vid_strm->codec->time_base); PRINT_VAL("ReScaled VID Dts ", outpkt.dts) PRINT_MSG("=======================================") vid_dts = outpkt.dts; } outpkt.duration = av_rescale_q(pkt.duration, in_vid_strm->time_base, out_vid_strm->time_base); // outpkt.duration = av_rescale_q(pkt.duration,out_vid_strm->time_base,out_vid_strm->codec->time_base); outpkt.data = pkt.data; outpkt.size = pkt.size; outpkt.flags = pkt.flags; outpkt.stream_index = pkt.stream_index; if(av_interleaved_write_frame(outformat, &outpkt) < 0) { PRINT_MSG("Failed Video Write ") } else { // PRINT_MSG("Writted Video Frame ") out_vid_strm->codec->frame_number++; } } #endif } else if(pkt.stream_index == in_aud_strm_idx) { //PRINT_MSG("Got Audio Frame ") PRINT_VAL("AUD Pkt PTS ", pkt.pts) PRINT_VAL("AUD Pkt DTS ", pkt.dts) num_aud_pkt++; if(need_decoding) { avcodec_decode_audio4(in_aud_codec_ctx, pframeT, &got_vid_pkt, &pkt); if(got_vid_pkt) { //PRINT_MSG("Decoded Audio Pkt ") num_aud_dec++; } got_vid_pkt = 0; } #if 1 if(need_encoding) { av_init_packet(&outpkt); #if 1 if(pkt.pts != AV_NOPTS_VALUE) { //outpkt.pts = av_rescale_q(pkt.pts, out_aud_strm->codec->time_base, out_aud_strm->time_base) ; // outpkt.pts = av_rescale_q(pkt.pts,out_aud_strm->time_base,out_aud_strm->codec->time_base) ; outpkt.pts = av_rescale_q(pkt.pts, in_aud_strm->time_base, out_aud_strm->time_base); PRINT_VAL("ReScaled AUD PTS ", outpkt.pts) //outpkt.pts = aud_pts++; //PRINT_VAL("Aud PTS ", outpkt.dts) aud_pts = outpkt.pts; //PRINT_VAL("New Aud PTS ", outpkt.pts) } else { outpkt.pts = AV_NOPTS_VALUE; } if(pkt.dts == AV_NOPTS_VALUE) { outpkt.dts = AV_NOPTS_VALUE; } else { // outpkt.dts = av_rescale_q(pkt.dts, out_aud_strm->codec->time_base, out_aud_strm->time_base) ; // outpkt.dts = av_rescale_q(pkt.dts, out_aud_strm->time_base, out_aud_strm->codec->time_base) ; outpkt.dts = av_rescale_q(pkt.dts, in_aud_strm->time_base, out_aud_strm->time_base); PRINT_VAL("ReScaled AUD DTS ", outpkt.dts) PRINT_MSG("====================================") //PRINT_VAL("Aud DTS ", outpkt.dts) aud_dts = outpkt.dts; //PRINT_VAL("New Aud DTS ", outpkt.dts) } //outpkt.duration = av_rescale_q(pkt.duration, out_aud_strm->codec->time_base, out_aud_strm->time_base) ; // outpkt.duration = av_rescale_q(pkt.duration, out_aud_strm->codec->time_base,out_aud_strm->time_base ) ; outpkt.duration = av_rescale_q(pkt.duration, in_aud_strm->time_base, out_aud_strm->time_base) ; outpkt.data = pkt.data; outpkt.size = pkt.size; outpkt.flags = pkt.flags; outpkt.stream_index = pkt.stream_index; if(av_interleaved_write_frame(outformat, &outpkt) < 0) // if(av_write_frame(outformat, &pkt) < 0) { PRINT_MSG("Faile Audio Write ") } else { // PRINT_MSG("Written Audio Frame ") out_aud_strm->codec->frame_number++; } } #endif } else { PRINT_MSG("Got Unknown Pkt ") num_unkwn_pkt++; } num_total_pkt++; } if(need_encoding) { av_write_trailer(outformat); } PRINT_VAL("Total Pkt Read ",num_total_pkt) PRINT_VAL("Total Vid Read ",num_vid_pkt) PRINT_VAL("Total Aud Read ",num_aud_pkt) PRINT_VAL("Total Unknown Read ",num_unkwn_pkt) PRINT_VAL("Total Vid Decoded ",num_vid_dec) PRINT_VAL("Total Aud Decoded ",num_aud_dec) av_free_packet(&pkt); av_close_input_file(informat); if(pframe) { avcodec_free_frame(&pframe); } if(pframeT) { avcodec_free_frame(&pframeT); } #if 0 if(informat) { avformat_free_context(informat); } if(buffer_pic) { av_free(buffer_pic); } if(pframe) { avcodec_free_frame(&pframe); } if(pframeT) { avcodec_free_frame(&pframeT); } #endif -- View this message in context: http://libav-users.943685.n4.nabble.com/Seeking-encoded-video-avi-tp4657245p4657254.html Sent from the libav-users mailing list archive at Nabble.com. From wagner.patriota at gmail.com Thu Apr 11 15:42:18 2013 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Thu, 11 Apr 2013 10:42:18 -0300 Subject: [Libav-user] Why ffmpeg doesn't decode some frames? Message-ID: I have this movie as a sample https://www.dropbox.com/s/t2a6bz1ynnvnrfc/test.mp4 I plays fine on any player... When I decode it using ffmpeg [with de "demuxer" demo] I just can get the first 9 frames... after it av_read_frame() doesn't return me any more frames... why? -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 11 16:09:01 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 14:09:01 +0000 (UTC) Subject: [Libav-user] 16-Bit RAW Video Recording Problem References: Message-ID: Carel Combrink writes: > ? ? [rawvideo 01dc8c40] = Invalid pixel format. > ? ? Last message repeated 1 times > Input #0, matroska,webm, from 'Recording.avi': > ? Metadata: > ? ? ENCODER ? ? ? ? : Lavf55.1.100 > ? Duration: 00:00:00.70, start: 0.000000, bitrate: N/A > ? ? Stream #0:0: Video: rawvideo, 1024x768, SAR 1:1 DAR 4:3 While this does indeed look like a regression, I wonder if it was intended behaviour at any time: Afaik, matroska does not define gray16 rawvideo, so I wonder if it was a good idea to choose mkv as output format. (And the name you chose for the file does not increase confidence that you know exactly what you are doing.) I suggest to use nut instead, it contains definitions for the format. Carl Eugen From wagner.patriota at gmail.com Thu Apr 11 16:24:46 2013 From: wagner.patriota at gmail.com (Wagner Patriota) Date: Thu, 11 Apr 2013 11:24:46 -0300 Subject: [Libav-user] Why ffmpeg doesn't decode some frames? In-Reply-To: References: Message-ID: Nevermind, I forgot to get the "cached frames!" :-/ On Thu, Apr 11, 2013 at 10:42 AM, Wagner Patriota wrote: > I have this movie as a sample > https://www.dropbox.com/s/t2a6bz1ynnvnrfc/test.mp4 > > I plays fine on any player... > > When I decode it using ffmpeg [with de "demuxer" demo] I just can get the > first 9 frames... after it av_read_frame() doesn't return me any more > frames... why? > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Thu Apr 11 16:32:23 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 16:32:23 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: 2013/4/11 Carl Eugen Hoyos > Lars Hammarstrand writes: > > > One idea could be to add an "gas" option to configure, > > like "--gas=/abosolute/path/to/gas-preprocessor" > > This does already exist afaik. 1. Sorry, not at least in version n1.2. Here is "configure --help" output for ffmpeg version n1.2: http://pastebin.com/vKHiZvv5. I've also checked the configure code. > > (pls note that this does not work: > > "--as=/absolute/path/to/gas-preprocessor.pl /path/to/as..." ). > > Please test "/path/to/gcc" > > 2. I'm afraid it doesn't matter if you are using gcc, as or "whatever compiler", the problem lies in the ffmpeg configure program *which always defaults to the gas-preproc in the search path* because of the root cause described at point 2.2 below. 2.1. For example, If you configure ffmpeg with: --as='/Users/Shared/xbmc-depends/buildtools-native/bin/gas-preprocessor.pl/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' 2.2. The basic problem lies in configure, line 3247 which is the line that is commented out by the xbmc patch: 3246: darwin) 3247: gas="gas-preprocessor.pl $cc" | | +---- Wrong path!! 2,2. Configure will produce the following config.mak ( http://pastebin.com/xB0GCEJd) # config.mak - Automatically generated by configure - do not modify! AS=gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/ iPhoneOS.platform/Developer/usr/bin/gcc | | +---- Wrong path!! 2.4. Thus, the end result when running make will still always be: gas-preprocessor.pl/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -I. -I./ [....] "Unable to identify target architecture at */usr/local/bin/ gas-preprocessor.pl* line 82." (forced error) | | +---- Wrong path!! Patch (extremely) welcome! > (My idea is to grep for the right syntax in configure, > contrary to you I cannot test.) > > 3. Ok, I'll check with Mans Rullgard to see what can be done about it... -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Thu Apr 11 17:03:47 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 17:03:47 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: Btw, think about the following not entirely impossible scenario: Picture an legacy installation of ffmpeg with an old version of gas-preprocessor installed in /usr/local/bin. We would now like to configure a new application embedded version of ffmpeg that requires a new but incompatible version of gas-preprocessor. What to do? -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Thu Apr 11 17:16:42 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 17:16:42 +0200 Subject: [Libav-user] Reference app with ffmpeg n1.2 libs that works on IOS ? In-Reply-To: References: <6D103696EA6A4C7F8471F6A2364F9750@mlsdev.com> Message-ID: 2013/4/11 Carl Eugen Hoyos > Lars Hammarstrand writes: > > 2.2. The basic problem lies in configure, line 3247 which is the line > that is commented out by the xbmc patch: > 3246: darwin) > 3247: gas="gas-preprocessor.pl $cc" > | > | > +---- Wrong path!! > > Forgot to add: what happens when you disable gas in the line above is that configure will fallback to the "--as=" setting through the following lines: 3716: if enabled asm; then 3717: as=${gas:=$as} # when no gas, use $as (--as=) What do you say, shall we submit the xbmx patch to FFmpeg-devel or do you think there is a better solution to this problem? -------------- next part -------------- An HTML attachment was scrubbed... URL: From reuben.scratton at gmail.com Thu Apr 11 18:34:31 2013 From: reuben.scratton at gmail.com (Reuben Scratton) Date: Thu, 11 Apr 2013 17:34:31 +0100 Subject: [Libav-user] Runtime ARM Neon detection? Message-ID: Hi, How can I get FFmpeg to detect and use ARM Neon code at runtime? Problem: If I compile with -mfpu=neon then FFmpeg blows up with SIGILL (ILLOPTPC) when run on a non-Neon CPU. If I compile with -mfpu=vfvp3 then FFmpeg runs fine, but presumably without the optimized code because this is what I currently have and I am getting performance complaints... Would it be possible for FFmpeg to detect Neon at runtime? This is for Android and the Android NDK does includes a demo project that shows how to do CPU feature detection at runtime... that's the easy bit. I don't know how or where to begin updating FFmpeg to use it. Thanks, Reuben -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 11 18:48:55 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 16:48:55 +0000 (UTC) Subject: [Libav-user] Runtime ARM Neon detection? References: Message-ID: Reuben Scratton writes: > If I compile with -mfpu=neon then FFmpeg blows up > with SIGILL (ILLOPTPC) when run on a non-Neon CPU.? > If I compile with -mfpu=vfvp3 then FFmpeg runs fine, > but presumably without the optimized code Did you test this? (with a debugger) I don't know but it seems very unlikely to me that a compiler option ("-mfpu=vfvp3") affects FFmpeg asm optimizations. [...] > Would it be possible for FFmpeg to detect Neon at runtime? Looking at ff_dsputil_init_arm() in libavcodec/arm/dsputil_init_arm.c, that is exactly what it currently does. Carl Eugen From praks411 at gmail.com Thu Apr 11 18:30:12 2013 From: praks411 at gmail.com (praks411) Date: Thu, 11 Apr 2013 09:30:12 -0700 (PDT) Subject: [Libav-user] Seeking encoded video (.avi) In-Reply-To: <1365686082571-4657254.post@n4.nabble.com> References: <1365676294036-4657245.post@n4.nabble.com> <1365679346082-4657247.post@n4.nabble.com> <1365682135803-4657250.post@n4.nabble.com> <1365686082571-4657254.post@n4.nabble.com> Message-ID: <1365697812548-4657261.post@n4.nabble.com> It is working now for me. Thanks. Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Seeking-encoded-video-avi-tp4657245p4657261.html Sent from the libav-users mailing list archive at Nabble.com. From ggarra13 at gmail.com Thu Apr 11 19:14:40 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Thu, 11 Apr 2013 14:14:40 -0300 Subject: [Libav-user] AVI and MOV playback wrong but WMV right Message-ID: <5166EF80.5090006@gmail.com> I have written an open source viewer (mrViewer under sourceforge) that works with frames. All is fine except playback of AVI and MOV files. WMV movies play just fine. With avis or mov formats seeking to the beginning of the movie will offset all frames by two frames and will not allow to display/decode the last two frames. I'm wondering if someone could shed some light on why this could be so and things I could try. From lars.hammarstrand at gmail.com Thu Apr 11 19:36:43 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Thu, 11 Apr 2013 19:36:43 +0200 Subject: [Libav-user] Runtime ARM Neon detection? In-Reply-To: References: Message-ID: 2013/4/11 Reuben Scratton > Hi, > > How can I get FFmpeg to detect and use ARM Neon code at runtime? > > If I compile with -mfpu=neon then FFmpeg blows up with SIGILL (ILLOPTPC) > when run on a non-Neon CPU. > If I compile with -mfpu=vfvp3 then FFmpeg runs fine, but presumably > without the optimized code because this is what I currently have and I am > getting performance complaints... > > > Would it be possible for FFmpeg to detect Neon at runtime? This is for > Android and the Android NDK does includes a demo project that shows how to > do CPU feature detection at runtime... that's the easy bit. I don't know > how or where to begin updating FFmpeg to use it. > > > We had similar problems with optimized code for ARM that was caused by an outdated gas-preprocessor.pl. Try to update it from https://github.com/mansr/gas-preprocessor and recompile. A good indicator if you need to update your gas-preproc is that you get a lot of warnings like this: ld: warning: ARM function not 4-byte aligned: empty_row from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: end_of_row_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: start_column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: column_loop from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: empty_odd_column from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: the_end from libavcodec/libavcodec.a(jrevdct_arm.o) ld: warning: ARM function not 4-byte aligned: __b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_b_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __a_evaluation from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __almost_empty_row from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_row_loop from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_b_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __a_evaluation2 from libavcodec/libavcodec.a(simple_idct_arm.o) ld: warning: ARM function not 4-byte aligned: __end_simple_idct_arm from libavcodec/libavcodec.a(simple_idct_arm.o) *ld: in libavcodec/libavcodec.a(h264qpel_neon.o), in section __TEXT,__text reloc 12: R_ABS reloc but no absolute symbol at target address for architecture armv7* * * -------------- next part -------------- An HTML attachment was scrubbed... URL: From reuben.scratton at gmail.com Thu Apr 11 21:59:12 2013 From: reuben.scratton at gmail.com (Reuben Scratton) Date: Thu, 11 Apr 2013 20:59:12 +0100 Subject: [Libav-user] Runtime ARM Neon detection? In-Reply-To: References: Message-ID: >> If I compile with -mfpu=neon then FFmpeg blows up >> with SIGILL (ILLOPTPC) when run on a non-Neon CPU. >> If I compile with -mfpu=vfvp3 then FFmpeg runs fine, >> but presumably without the optimized code > Did you test this? (with a debugger) > I don't know but it seems very unlikely to me that a > compiler option ("-mfpu=vfvp3") affects FFmpeg asm > optimizations. Not with a debugger - I'm not too handy with gdb - just by turning compiler options on and off in the hope of squeezing better performance from slower devices. I could be wrong but since -mfpu=neon always results in ILLOPTPC and other -mfpu options don't, it seemed logical to connect the two. Here's my configuration and build output for Android's armeabi-v7a ABI ... perhaps I'm using a wrong combination of options? # ./configure --target-os=linux --arch=arm --cross-prefix=/Users/reuben/android/ndk/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi- --sysroot=/Users/reuben/android/ndk/platforms/android-8/arch-arm --disable-everything --enable-shared --disable-symver --enable-static --enable-gpl --enable-nonfree --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-encoders --disable-muxers --disable-devices --disable-protocols --enable-asm --arch=arm5te --enable-armv5te --enable-avfilter --enable-parser=mpeg4video --enable-parser=mpegaudio --enable-parser=mpegvideo --enable-demuxer=m4v --enable-parser=mov --enable-demuxer=avi --enable-demuxer=mov --enable-decoder=h264 --enable-parser=h264 --enable-demuxer=h264 --enable-decoder=aac --enable-parser=aac --enable-demuxer=aac --enable-decoder=mp3 --enable-demuxer=mp3 --enable-avresample --enable-filter=aconvert --enable-filter=atempo --enable-neon --prefix=/Users/reuben/work/pluralsight/android/app/jni/build/ffmpeg/armeabi-v7a --disable-doc --extra-cflags='-fPIC -DANDROID -DANDROID_NDK -std=c99 -march=armv7-a -mtune=cortex-a8 -mfpu=vfpv3 -O3 -Os -Wno-sign-compare -Wno-switch -Wno-pointer-sign' --extra-ldflags= C compiler /Users/reuben/android/ndk/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc ARCH arm (armv7-a) big-endian no runtime cpu detection yes ARMv5TE enabled yes ARMv6 enabled yes ARMv6T2 enabled yes VFP enabled yes NEON enabled yes THUMB enabled no debug symbols yes strip symbols yes optimize for size no optimizations yes static yes shared yes postprocessing support yes new filter support yes network support no threading support pthreads safe bitstream reader yes SDL support no texi2html enabled no perl enabled yes pod2man enabled yes makeinfo enabled yes External libraries: zlib Enabled decoders: aac h264 mp3 Enabled encoders: Enabled hwaccels: Enabled parsers: aac mpeg4video mpegvideo h264 mpegaudio Enabled demuxers: aac h264 mov avi m4v mp3 Enabled muxers: Enabled protocols: Enabled filters: aconvert atempo Enabled bsfs: Enabled indevs: Enabled outdevs: License: nonfree and unredistributable Creating config.mak and config.h... libavutil/avconfig.h is unchanged WARNING: /Users/reuben/android/ndk/toolchains/arm-linux-androideabi-4.7/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-pkg-config not found, library detection may fail. CC libavdevice/alldevices.o ... On Thu, Apr 11, 2013 at 5:48 PM, Carl Eugen Hoyos wrote: > Reuben Scratton writes: > > > If I compile with -mfpu=neon then FFmpeg blows up > > with SIGILL (ILLOPTPC) when run on a non-Neon CPU. > > > If I compile with -mfpu=vfvp3 then FFmpeg runs fine, > > but presumably without the optimized code > > Did you test this? (with a debugger) > I don't know but it seems very unlikely to me that a > compiler option ("-mfpu=vfvp3") affects FFmpeg asm > optimizations. > > [...] > > > Would it be possible for FFmpeg to detect Neon at runtime? > > Looking at ff_dsputil_init_arm() in > libavcodec/arm/dsputil_init_arm.c, that is exactly what it > currently does. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Thu Apr 11 23:57:38 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 21:57:38 +0000 (UTC) Subject: [Libav-user] Runtime ARM Neon detection? References: Message-ID: Reuben Scratton writes: > License: nonfree and unredistributable But this is certainly not the configure line you use for the version that your Android users tested and protested performance-wise or am I wrong? Carl Eugen From reuben.scratton at gmail.com Fri Apr 12 00:14:20 2013 From: reuben.scratton at gmail.com (Reuben Scratton) Date: Thu, 11 Apr 2013 23:14:20 +0100 Subject: [Libav-user] Runtime ARM Neon detection? In-Reply-To: References: Message-ID: >> License: nonfree and unredistributable > > But this is certainly not the configure line you > use for the version that your Android users > tested and protested performance-wise or am I > wrong? You're not wrong, this is indeed the version being protested performance-wise. I hadn't noticed the --enable-nonfree option in the makefile (which I adapted from a stackoverflow post), and it doesn't appear to be necessary for this app which only needs basic H264 & AAC decoding features. Certainly it builds and runs fine without the option. On Thu, Apr 11, 2013 at 10:57 PM, Carl Eugen Hoyos wrote: > Reuben Scratton writes: > > > License: nonfree and unredistributable > > But this is certainly not the configure line you > use for the version that your Android users > tested and protested performance-wise or am I > wrong? > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Apr 12 00:28:10 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Thu, 11 Apr 2013 22:28:10 +0000 (UTC) Subject: [Libav-user] Runtime ARM Neon detection? References: Message-ID: Reuben Scratton writes: >>> License: nonfree and unredistributable (If you believe something is unclear about above message and that it does not explain that you may not legally distribute the resulting binary, please tell us!) >> But this is certainly not the configure line you >> use for the version that your Android users >> tested and protested performance-wise or am I >> wrong? > > You're not wrong, this is indeed the version > being protested performance-wise. Then please remove the option --enable-nonfree from your configure line. It is a copyright violation to distribute FFmpeg binaries that were built with this option. Carl Eugen From reuben.scratton at gmail.com Fri Apr 12 00:44:23 2013 From: reuben.scratton at gmail.com (Reuben Scratton) Date: Thu, 11 Apr 2013 23:44:23 +0100 Subject: [Libav-user] Runtime ARM Neon detection? In-Reply-To: References: Message-ID: >>>> License: nonfree and unredistributable > (If you believe something is unclear about > above message and that it does not explain > that you may not legally distribute the > resulting binary, please tell us!) I imagine I missed it because it gets buried in the metric ton of compilation output (warnings etc) that results from building FFmpeg with GCC. > Then please remove the option --enable-nonfree > from your configure line. Already done. > It is a copyright violation to distribute > FFmpeg binaries that were built with this > option. Fortunately for me this version of the app isn't yet published. The current market version relies on very buggy platform support to play video, which is a different world of hurt but at least it's legally clear. Thanks for the legal advice, I guess. On Thu, Apr 11, 2013 at 11:28 PM, Carl Eugen Hoyos wrote: > Reuben Scratton writes: > > >>> License: nonfree and unredistributable > > (If you believe something is unclear about > above message and that it does not explain > that you may not legally distribute the > resulting binary, please tell us!) > > >> But this is certainly not the configure line you > >> use for the version that your Android users > >> tested and protested performance-wise or am I > >> wrong? > > > > You're not wrong, this is indeed the version > > being protested performance-wise. > > Then please remove the option --enable-nonfree > from your configure line. > It is a copyright violation to distribute > FFmpeg binaries that were built with this > option. > > Carl Eugen > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin-zhao at qq.com Fri Apr 12 06:25:43 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Fri, 12 Apr 2013 12:25:43 +0800 Subject: [Libav-user] AAC encoding error Message-ID: Hello, Now, I have already called the avcodec_open2 function successfully by calling av_dict_set(&opts, "strict", "experimental", 0) firstly. But now I run into an other problem again: when I call the avcodec_encode_audio2(c, &pkt, frame, &got_output) firstly, it returned 0 and the got_output is 0 too, and when I call the avcodec_encode_audio2(c, &pkt, frame, &got_output) secondly, it'll incur an address accessing error: read 0xFFFFFFFF. I don't know what I have made mistake, and I have no any way now. I'll very appreciate anyone who can help me, thanks very much. the program is attached as following, here the srcdata is a pointer array, srcdata[1] = srcdata[0] + 4096, and they all have been filled original audio data befor the while loop. I have try to replace the avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, (const uint8_t*)pCurSource, m_SrcBuffLen, 0); with frame->data[0] = srcdata[0]; frame->data[1] = srcdata[1]; but the problem still exists. note: I used the ffmpeg native AAC encoder, and I have found and opened the encoder successfully. =============program============== got_output = 0; offset = 0; while(i<10) { i++; av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; pCurSource = srcdata[0]; ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, (const uint8_t*)pCurSource, m_SrcBuffLen, 0); /* encode the samples */ ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); if (ret >= 0 && pDest != NULL && got_output && pkt.data != NULL && pkt.size > 0) { memcpy(pDest + destLen, pkt.data, pkt.size); destLen = destLen + pkt.size; av_free_packet(&pkt); } } ------------------ Justin ------------------ Original ------------------ From: "Justin"; Date: Tue, Apr 9, 2013 05:54 PM To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error I have done as your way, and pleasantly found that it really worked sucessfully. I very appreciate you, thank you very much again. ------------------ Best Regards, Justin ------------------ Original ------------------ From: "Andrey Utkin"; Date: Tue, Apr 9, 2013 07:42 AM To: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error 2013/4/8 Justin : > But, how can I set the additional flag? thank you very much. This way: AVDictionary *opts = NULL; av_dict_set(&opts, "strict", "experimental", 0); int ret = avcodec_open2(encoder_context, codec, &opts); av_dict_free(&opts); _______________________________________________ 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 justin-zhao at qq.com Fri Apr 12 06:50:10 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Fri, 12 Apr 2013 12:50:10 +0800 Subject: [Libav-user] x264 encoding error Message-ID: Hi, I want to use the x264 to encode video data in ffmpeg library, the compiling configuration are listed as following. the x264 compiling configuration: ./configure --enable-shared --enable-win32thread --system-libx264 --disable-asm the ffmpeg compiling configuration: ./configure --disable-programs --enable-shared --disable-static --enable-memalign-hack --disable-debug --enable-gpl --enable-libx264 --enable-runtime-cpudetect --enable-pthreads The encoding program will work very OK if they are configured as above, but if I remove the --disable-asm in x264 configuration(I want to use asm to improve the encoder performance), the encoding program will incur address accessing error after 10-15 times calling encode function. I don't know what mistake I have made, I'll very appreciate anyone who can help me, thanks very much. note: I have added the yasm.exe into the bin directory, and I suppose it shoud work successfully because the compiling has no any error and the ffmpeg's configuration has no disable-asm parameter. ------------------ Best Regards, Justin -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Apr 12 10:59:08 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 12 Apr 2013 08:59:08 +0000 (UTC) Subject: [Libav-user] x264 encoding error References: Message-ID: Justin writes: > the ffmpeg's configuration has no disable-asm parameter. This is not correct. Carl Eugen From justin-zhao at qq.com Fri Apr 12 11:11:28 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Fri, 12 Apr 2013 17:11:28 +0800 Subject: [Libav-user] x264 encoding error Message-ID: Hi, Thank you firstly. I think you didn't understand my words. The program actually works very well when x264 is configured with --disable-asm and ffmpeg is configured without --disable-asm. But if x264 and ffmpeg both are configured without --disable-asm, the program will crash. ------------------ Best Regards, Justin ------------------ Original ------------------ From: "Carl Eugen Hoyos"; Date: Fri, Apr 12, 2013 04:59 PM To: "libav-user"; Subject: Re: [Libav-user] x264 encoding error Justin writes: > the ffmpeg's configuration has no disable-asm parameter. This is not correct. 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 Steffen.Roeber at hella.com Fri Apr 12 12:04:19 2013 From: Steffen.Roeber at hella.com (Steffen.Roeber at hella.com) Date: Fri, 12 Apr 2013 12:04:19 +0200 Subject: [Libav-user] pts problem Message-ID: I read many hours to understand pts in libav. But it seems there is no common simple way to retrieve. I used the method from http://dranger.com/ffmpeg/. I do something like: avcodec_decode_video2 (codecContext, frame, &got_picture_ptr, &p); uint64 pts = p.dts; if(pts == AV_NOPTS_VALUE && frame->opaque) pts = *(uint64_t *)frame->opaque; if (pts == AV_NOPTS_VALUE) pts = 0; This approach works in some videos. But in my .divx videos I get a pts of 3 in the first displayable frame., which is confusing for users which work on frame level. So, does anybody know a better approach? 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 andrey.krieger.utkin at gmail.com Fri Apr 12 14:30:25 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Fri, 12 Apr 2013 15:30:25 +0300 Subject: [Libav-user] AAC encoding error In-Reply-To: References: Message-ID: It would be easier to help you if you provide short but complete compilable (i.e. with main() and so on) snippet reproducing your problem. From cehoyos at ag.or.at Fri Apr 12 17:37:50 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 12 Apr 2013 15:37:50 +0000 (UTC) Subject: [Libav-user] pts problem References: Message-ID: writes: > I read many hours to understand pts in libav. > But it seems there is no common simple way to retrieve. > I used the method from http://dranger.com/ffmpeg/. This is quite outdated, please have a look at the examples in doc/examples. [...] > Dieses Dokument ist vertraulich zu behandeln. Please understand that this makes absolutely no sense when sending an email to a public email list that is mirrored several times on the internet. Carl Eugen From justin-zhao at qq.com Sat Apr 13 09:14:35 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Sat, 13 Apr 2013 15:14:35 +0800 Subject: [Libav-user] AAC encoding error Message-ID: Hi, The following short program can reproduce the problem. Problem description: The avcodec_encode_audio2 firstly can be called sucessfully and return 0, but the got_output is 0 too. The second invoking avcodec_encode_audio2 will incur address accessing error. I very appreciates anyone who can help me, thanks very much. ====================program========================= #include "libavutil\Rational.h" #include "libavutil\opt.h" #include "libavutil\Imgutils.h" #include "libswscale\Swscale.h" #include "libavcodec\avcodec.h" #include "libswresample\Swresample.h" main() { //=============================================================================================== int i, ret, got_output; AVCodec *codec; AVCodecContext *c; AVFrame *frame; AVPacket pkt; AVDictionary *opts = NULL; uint8_t *srcdata[2]; avcodec_register_all(); codec = avcodec_find_encoder(AV_CODEC_ID_AAC); if (!codec) return; //avcodec_register(codec); c = avcodec_alloc_context3(codec); if (!c) return; c->bit_rate = 32000; c->sample_rate = 22050; c->channel_layout = AV_CH_LAYOUT_STEREO; c->channels = av_get_channel_layout_nb_channels(c->channel_layout); //c->frame_size = 1024; c->sample_fmt = AV_SAMPLE_FMT_FLTP; // open it av_dict_set(&opts, "strict", "experimental", 0); ret = avcodec_open2(c, codec, &opts); if (ret < 0) return; av_dict_free(&opts); frame = avcodec_alloc_frame(); if (!frame) return; frame->nb_samples = c->frame_size; frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; srcdata[0] = (uint8_t *)malloc(4*c->frame_size); srcdata[1] = (uint8_t *)malloc(4*c->frame_size); memset(srcdata[0], 0, 4*c->frame_size); memset(srcdata[1], 0, 4*c->frame_size); frame->data[0] = srcdata[0]; frame->data[1] = srcdata[1]; for(i=0; i<2; i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; /* encode the samples */ ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); av_free_packet(&pkt); } } ------------------ Best Regards, Justin ------------------ Original ------------------ From: "andrey.krieger.utkin"; Date: Fri, Apr 12, 2013 08:30 PM To: "Justin"; Cc: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error It would be easier to help you if you provide short but complete compilable (i.e. with main() and so on) snippet reproducing your problem. _______________________________________________ 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 Steffen.Roeber at hella.com Sat Apr 13 20:09:58 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Sat, 13 Apr 2013 11:09:58 -0700 (PDT) Subject: [Libav-user] pts problem In-Reply-To: References: Message-ID: <1365876598708-4657279.post@n4.nabble.com> I took a look at the decoding examples. There the AVFRame->pts field is used. But I have some videos where this field is always 0. So which structure and which field do I have to use if I need the pts of the current decoded frame. And, does ffmpeg or libav provide the current frame index anywhere in its structures? I need both value in my video streaming application here I have to provide frame accurate processing. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-pts-problem-tp4657275p4657279.html Sent from the libav-users mailing list archive at Nabble.com. From ggarra13 at gmail.com Sun Apr 14 18:31:59 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Sun, 14 Apr 2013 13:31:59 -0300 Subject: [Libav-user] Cached frames and viewer Message-ID: <516AD9FF.1080109@gmail.com> I looked at the latest ffmpeg and the demuxing example has a section for "cached" frames, which get decoded with an empty pkt. I was wondering how ffplay does without this or how a player is supposed to be coded to support these cached frames. From andrey.krieger.utkin at gmail.com Sun Apr 14 23:37:04 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Mon, 15 Apr 2013 00:37:04 +0300 Subject: [Libav-user] AAC encoding error In-Reply-To: References: Message-ID: Hi Justin, I have just tried your code. With trivial changes to make it compile at work fine at my linux installation, it looks as posted below. I have to say it doesn't fail for me, it runs cleanly and returns normal retcode 0. Valgrind does not find any failures, too. So i won't further investigate this, as i am not really into windows. Good luck investigating your issue. #include "libavutil/rational.h" #include "libavutil/opt.h" #include "libavutil/imgutils.h" #include "libswscale/swscale.h" #include "libavcodec/avcodec.h" #include "libswresample/swresample.h" #include "libavutil/log.h" // gcc -O0 -g -ggdb justin.c -lavcodec -o justin main() { int i, ret, got_output; AVCodec *codec; AVCodecContext *c; AVFrame *frame; AVPacket pkt; AVDictionary *opts = NULL; uint8_t *srcdata[2]; av_log_set_level(AV_LOG_DEBUG); avcodec_register_all(); codec = avcodec_find_encoder_by_name("aac"); if (!codec) return 1; c = avcodec_alloc_context3(codec); if (!c) return 1; c->bit_rate = 32000; c->sample_rate = 22050; c->channel_layout = AV_CH_LAYOUT_STEREO; c->channels = av_get_channel_layout_nb_channels(c->channel_layout); c->sample_fmt = AV_SAMPLE_FMT_FLTP; // open it av_dict_set(&opts, "strict", "experimental", 0); ret = avcodec_open2(c, codec, &opts); if (ret < 0) return 1; av_dict_free(&opts); frame = avcodec_alloc_frame(); if (!frame) return 1; frame->nb_samples = c->frame_size; frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; srcdata[0] = (uint8_t *)malloc(4*c->frame_size); srcdata[1] = (uint8_t *)malloc(4*c->frame_size); memset(srcdata[0], 0, 4*c->frame_size); memset(srcdata[1], 0, 4*c->frame_size); frame->data[0] = srcdata[0]; frame->data[1] = srcdata[1]; for(i=0; i<2; i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; /* encode the samples */ ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); av_free_packet(&pkt); } return 0; } From andrey.krieger.utkin at gmail.com Sun Apr 14 23:43:05 2013 From: andrey.krieger.utkin at gmail.com (Andrey Utkin) Date: Mon, 15 Apr 2013 00:43:05 +0300 Subject: [Libav-user] AAC encoding error In-Reply-To: References: Message-ID: My (x86) workstation has ffmpeg build from git revision e7692a9 on 3rd of April which looks quite recent to me. You should give a try with git HEAD build, too. From phuze9 at gmail.com Mon Apr 15 03:45:38 2013 From: phuze9 at gmail.com (phuze koj) Date: Sun, 14 Apr 2013 20:45:38 -0500 Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: References: <1365555188336-4657231.post@n4.nabble.com> <51664CED.9060206@hs-mittweida.de> Message-ID: I've made some progress, here is the new code that sort-of works: for(i=0;i<77;i++) { fflush(stdout); uint8_t *pPixels = new uint8_t[screenWidth*screenHeight*(32 >> 3)]; pPixels = screenCap(); //getting the screenshot by the same method posted earlier int nbytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height); uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes*sizeof(uint8_t)); outpic->pts = (int64_t)((float)i * (1000.0/((float)(c->time_base.den))) * 90); avpicture_fill((AVPicture*)inpic, pPixels, PIX_FMT_RGB32, c->width, c->height); // Fill picture with image avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, c->height); av_image_alloc(outpic->data,outpic->linesize,c->width,c->height,c->pix_fmt,1); inpic->data[0] += inpic->linesize[0]*(screenHeight-1); // Flipping frame inpic->linesize[0] = -inpic->linesize[0]; // Flipping frame struct SwsContext* fooContext = sws_getContext(c->width, c->height, PIX_FMT_RGB32, c->width, c->height, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); sws_scale(fooContext, inpic->data, inpic->linesize, 0, c->height, outpic->data, outpic->linesize); printf("Image scaled\n"); // encode the image out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic); printf("Encoding frame %3d (size=%5d)\n", i, out_size); fwrite(outbuf, 1, out_size, f); delete [] pPixels; } This is giving me *some *output, but not quite usable still. Here is a picture of the new code's output video, which shows the console (and should have visual studio behind it). Does this gray background indicate that I'm using the wrong input pixel format for the screenshot? -------------- next part -------------- An HTML attachment was scrubbed... URL: From justin-zhao at qq.com Mon Apr 15 04:02:40 2013 From: justin-zhao at qq.com (=?ISO-8859-1?B?SnVzdGlu?=) Date: Mon, 15 Apr 2013 10:02:40 +0800 Subject: [Libav-user] AAC encoding error Message-ID: Anyway, I very appreciates you firstly. I'll continue to investigate it and expect a good luck. ------------------ Best Regards, Justin ------------------ Original ------------------ From: "andrey.krieger.utkin"; Date: Mon, Apr 15, 2013 05:37 AM To: "Justin"; Cc: "This list is about using libavcodec, libavformat, libavutil,libavdevice and libavfilter."; Subject: Re: [Libav-user] AAC encoding error Hi Justin, I have just tried your code. With trivial changes to make it compile at work fine at my linux installation, it looks as posted below. I have to say it doesn't fail for me, it runs cleanly and returns normal retcode 0. Valgrind does not find any failures, too. So i won't further investigate this, as i am not really into windows. Good luck investigating your issue. #include "libavutil/rational.h" #include "libavutil/opt.h" #include "libavutil/imgutils.h" #include "libswscale/swscale.h" #include "libavcodec/avcodec.h" #include "libswresample/swresample.h" #include "libavutil/log.h" // gcc -O0 -g -ggdb justin.c -lavcodec -o justin main() { int i, ret, got_output; AVCodec *codec; AVCodecContext *c; AVFrame *frame; AVPacket pkt; AVDictionary *opts = NULL; uint8_t *srcdata[2]; av_log_set_level(AV_LOG_DEBUG); avcodec_register_all(); codec = avcodec_find_encoder_by_name("aac"); if (!codec) return 1; c = avcodec_alloc_context3(codec); if (!c) return 1; c->bit_rate = 32000; c->sample_rate = 22050; c->channel_layout = AV_CH_LAYOUT_STEREO; c->channels = av_get_channel_layout_nb_channels(c->channel_layout); c->sample_fmt = AV_SAMPLE_FMT_FLTP; // open it av_dict_set(&opts, "strict", "experimental", 0); ret = avcodec_open2(c, codec, &opts); if (ret < 0) return 1; av_dict_free(&opts); frame = avcodec_alloc_frame(); if (!frame) return 1; frame->nb_samples = c->frame_size; frame->format = c->sample_fmt; frame->channel_layout = c->channel_layout; srcdata[0] = (uint8_t *)malloc(4*c->frame_size); srcdata[1] = (uint8_t *)malloc(4*c->frame_size); memset(srcdata[0], 0, 4*c->frame_size); memset(srcdata[1], 0, 4*c->frame_size); frame->data[0] = srcdata[0]; frame->data[1] = srcdata[1]; for(i=0; i<2; i++) { av_init_packet(&pkt); pkt.data = NULL; // packet data will be allocated by the encoder pkt.size = 0; /* encode the samples */ ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); av_free_packet(&pkt); } return 0; } -------------- next part -------------- An HTML attachment was scrubbed... URL: From sendtofaraway at qq.com Mon Apr 15 04:09:13 2013 From: sendtofaraway at qq.com (=?gb18030?B?YW5kcm8=?=) Date: Mon, 15 Apr 2013 10:09:13 +0800 Subject: [Libav-user] how to mux MJPEG encoded data into AVI container Message-ID: Thanks! I have try all the command you have given, It worked well . But If I want to write a little program using libav* library to do the work . What should I do ? can you give me some clue ? A little sample code would be better . ------------------ Original ------------------ From: "Carl Eugen Hoyos"; Date: Thu, Apr 11, 2013 05:32 PM To: "libav-user"; Subject: Re: [Libav-user] how to mux MJPEG encoded data into AVI container andro writes: > I'm looking for a way to mux mjpeg (compressed) video > data into a video container like mp4 or avi. $ ffmpeg -i input -vcodec mjpeg out.avi > (I'll also need to add audio in the future) . $ ffmpeg -i input -vcodec mjpeg -acodec ac3 out.avi > I do not want decode the MJpeg data first ,and then > encode and mux it into AVI container . $ ffmpeg -i mjpeg -vcodec copy out.avi Generally, it is a good idea to test something before posting on this mailing list and report here if it does not work (includig failing command line and complete, uncut console output). Carl Eugen _______________________________________________ Libav-user mailing list Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Apr 15 09:45:18 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 15 Apr 2013 07:45:18 +0000 (UTC) Subject: [Libav-user] how to mux MJPEG encoded data into AVI container References: Message-ID: andro writes: > But If I want to write a little program using > libav* library to do the work . Please look at the example code in doc/examples in your git checkout. Please do not top-post here, Carl Eugen From cehoyos at ag.or.at Mon Apr 15 09:49:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 15 Apr 2013 07:49:06 +0000 (UTC) Subject: [Libav-user] pts problem References: <1365876598708-4657279.post@n4.nabble.com> Message-ID: Steffen writes: > I took a look at the decoding examples. There the > AVFRame->pts field is used. > But I have some videos where this field is always 0. What kind of videos? You can use -debug_ts to see if FFmpeg (the application) sees the correct pts (and where it comes from). Carl Eugen From Steffen.Roeber at hella.com Mon Apr 15 11:57:22 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Mon, 15 Apr 2013 02:57:22 -0700 (PDT) Subject: [Libav-user] pts problem In-Reply-To: References: <1365876598708-4657279.post@n4.nabble.com> Message-ID: <1366019842117-4657288.post@n4.nabble.com> I meanwhile use the following: uint64 pts = frame->pkt_pts; if(pts == AV_NOPTS_VALUE) { pts = frame->pts; if(pts == AV_NOPTS_VALUE) { pts = frame->pkt_dts; } } That works in my example cases. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-pts-problem-tp4657275p4657288.html Sent from the libav-users mailing list archive at Nabble.com. From brado at bighillsoftware.com Mon Apr 15 19:08:15 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 15 Apr 2013 10:08:15 -0700 Subject: [Libav-user] Accessing coded frame pts for audio Message-ID: <6CC349FA-DFF4-4AA3-B0FE-C8B6F422F746@bighillsoftware.com> Hello, In a processing workflow that includes first encoding a video / audio frame followed by writing that frame to a file/network stream, it is required to set the packet pts prior to encoding. The subsequent encoding operation then returns an output value (gotPacket) indicating whether a packet was returned, e.g.: returnVal = avcodec_encode_audio2(codecCtx, &_avPacket, _streamAudioFrame, &gotPacket); A packet might not have been returned, but if one has been returned, there are two notable characteristics about it: 1. it is not necessarily the same packet that was encoded; i.e. the encoder can return a different packet (presumably due to reordering as necessary, etc.). 2. The returned packet does not have an accurate pts set, and so this must be manually set in the code. When dealing with a video stream, the general approach to setting packet pts is to grab the AVCodecContext's pts of its coded frame, and then rescale it from a value relative to the context's time_base (that's the one based on frame rate) to one relative to the stream's time_base (the one based on time), as such: _avPacket.pts = av_rescale_q(codecCtx->coded_frame->pts, codecCtx->time_base, _videoStream->time_base); The key point there is that the pts of the frame involved with the packet returned is accessible in the context's coded_frame, i.e.: videoCodecCtx->coded_frame->pts That's great for video. But when processing audio, coded_frame->pts is consistently junk, always valued -9223372036854775808. So my question is after encoding, if the avcodec_encode_audio2 indeed returns a packet how to access the pts for the encoded frame (or in the case of audio, it would probably be more proper to say the encoded samples)? Again, given that the packet returned by the encoder isn't necessarily the one that was encoded, we need the pts of the packet when it was encoded. How do I access this value? Thanks, Brad From brado at bighillsoftware.com Mon Apr 15 20:09:48 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Mon, 15 Apr 2013 11:09:48 -0700 Subject: [Libav-user] Suggestions on pts / dts Message-ID: <410A4B6C-39C0-4039-9540-FA583A00B5B7@bighillsoftware.com> Hello, I've been on the FFmpeg-user and Libav-user mailing lists for over a year now, and from the problems I've both had myself and those others have posted, if stats were kept, I'd wager that by far, most of the problems encountered on both lists deal with timing issues, related to pts / dts. The general understanding and documentation surrounding pts / dts on the coding side is scant to non-existent, and after literally weeks of testing pts and dts issues, I have a few comments / suggestions which hopefully might make the situation a little better for those trying to use FFmpeg and understand how it works. Note that I'm still in the dark about the finer points myself, and may have misconceptions, but these comments come out of my direct experience having to solve specific problems with the libraries. 1. It seems apparent from testing I've done that pts used in encoding is relative to a time_base based on pre-configured / desired frame rate, while the pts used in writing/streaming is relative to a time_base based on time -- the stream's time_base.den was 1000 by default, so I assume this is a measure of milliseconds. So to sum up, when feeding frames to the encoder, pts indicates what frame/sample the packet contains (by which the timing is derived), while when feeding packets for writing, pts indicates an actual time increment. The former scenario with encoding is a fairly optimistic scenario, assuming an exact frame rate and no gap in frames. That is fine for processing existing videos, but not particularly good for live capture scenarios -- as a suggestion it would be better if the encoding pts was more like the writing pts. Regardless, it would be very helpful if there were documentation out there which explained the differences in the nature of pts prior to encoding vs. pts prior to writing, and the conversion between the two. Code snippets and discussions around the Internet are all over the map on this, with disagreement. 2. When invoking avcodec_encode_audio2 and it returns a packet, I haven't been able to figure out why the packet returned by the encoder doesn't have the pts set properly. The encoder has all the information necessary to know what the pts should be for the returned packet. So as a manner of suggestion, why not set this packet's pts in the encoder, rather than pushing that onto the implementer? I suppose there's the argument that you don't necessarily know what the returned packet will be used for, but will it ever *not* need to be set to the proper pts for writing anyway? And if not, why not add both encoded pts and write pts to the packet, if both are necessary for different scenarios? 3. I would suggest either revising the muxing.c example, or adding a muxing2.c example which addresses the actual issues encountered in an encoding / writing scenario with pts / dts. The muxing.c example might even be adding to the confusion -- it did in my case. There are a number of things which this example does not address, which were required in my use case, and if other posts on the mailing list are any indication, common to others' as well: - Muxing.c does not set the time_base for audio. - Muxing.c does not set a pts (ever) for audio packets, either prior to encoding or writing - Muxing.c does not set a pts for video packets prior to writing. It sets pts on the video frame *after* writing, which effectively means before encoding (in a loop). But it doesn't appear to ever deal with pts prior to writing. - Muxing.c has a guaranteed constant frame rate fed to the encoder (consistent with time_base.den) -- again, fine for generated and pre-existing content, but doesn't work for capture scenarios, where frames may drop. Some of the past responses to questions I had about this commented that setting the proper pts regardless would solve the problem. In my testing, this was not the case. You can set the proper pts for a video frame, but if you do not send the exact number of frames to the encoder to maintain the frame rate configured in your codec context's time_base.den value, your pts will *not* correct that problem. Your video timing will not be right. So in other words, if you configure a time_base.den of 30, and then feed it 15 fps, *even if this pts values are accurate for each of the 15 frames* (and that's taking into account half the frame rate), your encoded video will end up playing at twice the rate (in half the time). The pts value does not solely determine timing and playback -- your pts values can be accurate and your playback timing STILL off. The solution is that you must guarantee the frame rate configured in time_base.den, and so this requires compensating by re-encoding the last frame or encoding the current frame multiple times if necessary. Muxing.c really needs to address this scenario -- generating faux video and audio sidesteps this reality completely. - Muxing.c does not address network streaming, which apparently has different nuances which impact encoding / writing. I cannot say exactly why, as I do not know the internals of the encoder or stream writing code, but there is a difference between writing a local file and streaming, with respect to required pts and dts values. I was able to successfully encode/write perfect video only, audio only, and video/audio together into local video files and play them back without a problem, but when pushing the exact same data across a network stream, it resulted in bad video, bad audio, or video / audio syncing problems. It was thanks to the server-side logging of the system I used (Wowza 3.5.x) which told me that timecodes being received weren't right (and also fingered the encoder as the problem) -- however, this didn't have any negative effect on writing a local video file and play it back -- I didn't even know the problem existed until I streamed across the network. The problem was completely solved by changing pts / dts values -- if these values are bad, I'm not sure why they would be considered good in a local writing scenario but bad in a streaming scenario -- I would think that pts / dts should be either good or bad no matter where it is written, and either scenario would generate like errors. I also encountered one additional problem, using the av_write_frame call worked fine for audio only and video only, but would crash the stream if both audio and video where written. I had to switch to av_interleaved_write_frame. Perhaps this is expected behavior, but I was unaware of it and why -- if it is, this would be good to document. So to sum up -- , FWIW from the issues I am seeing appear on the mailing list, my weeks of addressing this, and coming across all manner of opinions on what it all means and how to handle it, I'd suggest addressing pts/dts and its specific usage and intent with AVPacket both prior to encoding and prior to writing -- documentation and an example which addresses this stuff -- I think it might help a lot of people both understand what FFmpeg is doing in regards to pts/dts and get their code working. Thanks for all of your help.... Cheers, Brad From sendtofaraway at foxmail.com Mon Apr 15 04:08:40 2013 From: sendtofaraway at foxmail.com (=?gb18030?B?YW5kcm8=?=) Date: Mon, 15 Apr 2013 10:08:40 +0800 Subject: [Libav-user] how to mux MJPEG encoded data into AVI container Message-ID: Thanks! I have try all the command you have given, It worked well . But If I want to write a little program using libav* library to do the work . What should I do ? can you give me some clue ? A little sample code would be better . ------------------ Original ------------------ From: "Carl Eugen Hoyos"; Date: Thu, Apr 11, 2013 05:32 PM To: "libav-user"; Subject: Re: [Libav-user] how to mux MJPEG encoded data into AVI container andro writes: > I'm looking for a way to mux mjpeg (compressed) video > data into a video container like mp4 or avi. $ ffmpeg -i input -vcodec mjpeg out.avi > (I'll also need to add audio in the future) . $ ffmpeg -i input -vcodec mjpeg -acodec ac3 out.avi > I do not want decode the MJpeg data first ,and then > encode and mux it into AVI container . $ ffmpeg -i mjpeg -vcodec copy out.avi Generally, it is a good idea to test something before posting on this mailing list and report here if it does not work (includig failing command line and complete, uncut console output). 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 chisholm at mitre.org Mon Apr 15 21:19:04 2013 From: chisholm at mitre.org (Michael Chisholm) Date: Mon, 15 Apr 2013 15:19:04 -0400 Subject: [Libav-user] Accessing coded frame pts for audio In-Reply-To: <6CC349FA-DFF4-4AA3-B0FE-C8B6F422F746@bighillsoftware.com> References: <6CC349FA-DFF4-4AA3-B0FE-C8B6F422F746@bighillsoftware.com> Message-ID: <516C52A8.4000901@mitre.org> On 4/15/2013 1:08 PM, Brad O'Hearne wrote: > Hello, > > In a processing workflow that includes first encoding a video / audio frame followed by writing that frame to a file/network stream, it is required to set the packet pts prior to encoding. The subsequent encoding operation then returns an output value (gotPacket) indicating whether a packet was returned, e.g.: > > returnVal = avcodec_encode_audio2(codecCtx, &_avPacket, _streamAudioFrame, &gotPacket); > > A packet might not have been returned, but if one has been returned, there are two notable characteristics about it: > > 1. it is not necessarily the same packet that was encoded; i.e. the encoder can return a different packet (presumably due to reordering as necessary, etc.). > > 2. The returned packet does not have an accurate pts set, and so this must be manually set in the code. > > When dealing with a video stream, the general approach to setting packet pts is to grab the AVCodecContext's pts of its coded frame, and then rescale it from a value relative to the context's time_base (that's the one based on frame rate) to one relative to the stream's time_base (the one based on time), as such: > > _avPacket.pts = av_rescale_q(codecCtx->coded_frame->pts, codecCtx->time_base, _videoStream->time_base); > > The key point there is that the pts of the frame involved with the packet returned is accessible in the context's coded_frame, i.e.: > > videoCodecCtx->coded_frame->pts > > That's great for video. But when processing audio, coded_frame->pts is consistently junk, always valued -9223372036854775808. So my question is after encoding, if the avcodec_encode_audio2 indeed returns a packet how to access the pts for the encoded frame (or in the case of audio, it would probably be more proper to say the encoded samples)? Again, given that the packet returned by the encoder isn't necessarily the one that was encoded, we need the pts of the packet when it was encoded. > > How do I access this value? > I can't address everything here, but I can contribute a couple things: -9223372036854775808 is not technically "junk". It is AV_NOPTS_VALUE, which is a deliberately chosen value with a specific meaning: there is no pts. It is the minimum value of a signed 64-bit integer. Over the years I've learned to recognize -2^31, but -2^63 is a more recent animal... so I have missed this myself ;) What I've been doing to get timestamps of encoded frames in the face of codec caching is maintain a timestamp queue. You push the pts of your frame onto the queue each time you encode a frame; you only pop a timestamp off if you got an encoded frame back. The first frame out of the codec has to be the first one you put in, and it will match first timestamp popped off the queue. Unless the codec is eating frames, the timestamps you pop off the queue _must_ match the frames you're getting out of the codec. Pseudocode is something like: tsQueue.push(frame.pts); encode(frame); if (got_an_encoded_frame_back) { encoded_frame_pts = tsQueue.pop(); // do whatever with the encoded frame and its pts } The queue will naturally size itself to the latency of the codec, so you can "autodetect" the latency of codecs by checking the size of your timestamp queue. If there is no latency, you'll just be popping off the timestamp immediately after pushing it on, which might be seen as a waste of time, but the technique still works. Andy From goverall at hotmail.com Wed Apr 17 04:15:06 2013 From: goverall at hotmail.com (Gary Overall) Date: Tue, 16 Apr 2013 22:15:06 -0400 Subject: [Libav-user] iOS: Converting AVFrame to UIImage Message-ID: I am working on an iOS app and have been researching and seen different approaches of converting video frames from sws_scale() to a UIImage, for placement in a UIImageView. I am presently attempting to play my video by successively altering the contents of my UIImageView. I retrieve a frame like this: AVFrame *pFrame; AVFrame *pFrameRGB = NULL; // allocate a video frame pFrame=avcodec_alloc_frame(); // Allocate an AVFrame structure pFrameRGB=avcodec_alloc_frame(); sws_ctx = sws_getContext ( pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL ); /* In a loop I do this */ len=avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished,&packet); if(frameFinished) { // Convert the image from its native format to RGB sws_scale(sws_ctx,(uint8_t const * const *)pFrame->data,pFrame->linesize,0,pCodecCtx->height,pFrameRGB->data,pFrameRGB->linesize); I then want to take pFrame and convert it to a UIImage so that I can update the UIImageView.Can someone please point me in a really good direction of how to do this conversion? Thank You In Advance -------------- next part -------------- An HTML attachment was scrubbed... URL: From nitinmittal84 at gmail.com Wed Apr 17 09:25:31 2013 From: nitinmittal84 at gmail.com (nitin mittal) Date: Wed, 17 Apr 2013 12:55:31 +0530 Subject: [Libav-user] develop a stream in and stream out application using custom IO context Message-ID: Hi , I am trying to develop a application which reads from a buffer, transforms into different format and writes into a different buffer. I am trying to use the custom IO context. my code for writing into stream is as follows: filename = "output_file.flv"; fmt = av_guess_format("flv", filename, NULL); // allocate the output media context oc = avformat_alloc_context(); unsigned char *buffer = (unsigned char *)av_malloc(bsize); FILE *fr = fopen(filename,"w"); pb2 = avio_alloc_context(buffer, bsize, 1, fr, NULL, write_packet2, NULL); oc->pb = pb2; pb2->write_flag =1; oc->flags = AVFMT_FLAG_CUSTOM_IO; oc->oformat = fmt; if((avformat_open_input(&oc,0, 0, 0)) != 0) { printf("format could not open input"); exit(0); } . . . my write packet function: int write_packet2(void *opaque, uint8_t *buf, int buf_size) { FILE* f= (FILE *)opaque; return fwrite(buf,1, buf_size,f); } This gets stuck in avformat_open_input function and never comes out of it. So please tell what is the problem. Or if there is some sample code for similar work. Regards, Nitin -------------- next part -------------- An HTML attachment was scrubbed... URL: From amir.rouhi at rmit.edu.au Wed Apr 17 10:09:40 2013 From: amir.rouhi at rmit.edu.au (Amir Hossein Rouhi) Date: Wed, 17 Apr 2013 18:09:40 +1000 Subject: [Libav-user] How to activate SEI timing in H264 Message-ID: Hi Who knows how to activate SEI timing in a H264 video encoded by FFMPEG. I encode video just by simple encoding command and the SEI values are all zero.:the command which i used is: ffmpeg -i C:\1.mpg -r 25 -an -vcodec libx264 -threads 0 -f h264 -r 25 -g 0 C:\1.264 Cheers Amir -------------- next part -------------- An HTML attachment was scrubbed... URL: From ebersbac at hs-mittweida.de Wed Apr 17 10:48:43 2013 From: ebersbac at hs-mittweida.de (Steffen Ebersbach) Date: Wed, 17 Apr 2013 10:48:43 +0200 Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: References: <1365555188336-4657231.post@n4.nabble.com> <51664CED.9060206@hs-mittweida.de> Message-ID: <516E61EB.4090406@hs-mittweida.de> Hi this is my code for making a video from a screenshot. I do not use the hbitmap directly, but rather a gdi element. But i think this is not necessary i do this or other reasons. One Idea, because in your last picture the shell window is shown but the visual studio window is missing, can be that the copy desktop / window function from windows can't capy elements from directx and so on , only nativ stuff. This is because in most remote control softwares, no video is transmitted. I hope the codes help you. Steffen -------------------------------------------------- HWND window; // get hwnd from your window / desktop / ... srcDC = GetDC(window); tarDC = CreateCompatibleDC(srcDC); m_pal = (HPALETTE) GetCurrentObject(srcDC, OBJ_PAL); //colors HBITMAP obmp, hbmp = CreateCompatibleBitmap(srcDC, pwidth , pheight); obmp = (HBITMAP) SelectObject(tarDC, hbmp); //connect hbmp to DC res = SendMessage(window,WM_PRINT, (WPARAM)tarDC,(LPARAM) PRF_CLIENT | ~PRF_ERASEBKGND); // Copy BMP tarbmp = Gdiplus::Bitmap::FromHBITMAP(hbmp,m_pal); SelectObject(tarDC,obmp); DeleteObject(hbmp); //Stream and encoder av_register_all(); avcodec_init(); AVFormatContext *focontext; AVStream *videostm; AVCodec *videocodec; AVCodecContext *videocontext; AVFrame *aktframe; uint8_t *framebuf1; SwsContext *imgconvctx; //container focontext = av_alloc_format_context(); //videostream videostm = av_new_stream(focontext,0); // define your parameters here videocodec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO); avcodec_open(videocontext, videocodec); focontext->video_codec_id = videocontext->codec_id; av_set_parameters(focontext,0); //frame aktframe = avcodec_alloc_frame(); picsize = avpicture_get_size(PIX_FMT_YUV420P, width, height); framebuf1 = (uint8_t*) av_malloc(picsize); avpicture_fill( (AVPicture*)aktframe, framebuf1, PIX_FMT_YUV420P, width, height); imgconvctx = sws_getContext(width, height ,PIX_FMT_BGR24 ,width, height,PIX_FMT_YUV420P, SWS_BICUBIC , 0,0,0); //convert bmp uint8_t *inbuffer; Gdiplus::BitmapData inbmpdata; Gdiplus::Rect cltrct(0,0,width,height); newbmp->LockBits(&cltrct, Gdiplus::ImageLockModeRead ,PixelFormat24bppRGB , &inbmpdata); inbuffer = (uint8_t*) inbmpdata.Scan0; AVFrame *inframe = 0; inframe = avcodec_alloc_frame(); avpicture_fill( (AVPicture*)inframe, inbuffer, PIX_FMT_BGR24, width, height); sws_scale(imgconvctx,inframe->data , inframe->linesize,0, height, aktframe->data , aktframe->linesize); int videobuf_size = videocontext->bit_rate *2; //open output url_fopen(&focontext->pb,"file.mpg" , URL_WRONLY) av_write_header(focontext); //encode and write frame av_init_packet(&avpkt); encsize = avcodec_encode_video(videocontext, videobuf ,videobuf_size, aktframe); avpkt.stream_index= videostm->index; avpkt.data= videobuf; avpkt.size= encsize; av_write_frame(focontext, &avpkt); // next frames From brado at bighillsoftware.com Wed Apr 17 18:08:13 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 17 Apr 2013 09:08:13 -0700 Subject: [Libav-user] AAC with FLV Message-ID: Is there a way to encode an FLV file with AAC audio rather than the ADPCM which defaults when creating an output format context oriented to FLV? The output format context defaults to the ADPCM_SWF codec, but when I tried to change it to AAC (or SPEEX or MP3) I received an error message -- that these codecs couldn't be found. How can set up the output format context's audio codec to encode to AAC? Thanks, Brad From cehoyos at ag.or.at Wed Apr 17 18:36:29 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 17 Apr 2013 16:36:29 +0000 (UTC) Subject: [Libav-user] AAC with FLV References: Message-ID: Brad O'Hearne writes: > Is there a way to encode an FLV file with AAC audio > rather than the ADPCM which defaults when creating an > output format context oriented to FLV? The output > format context defaults to the ADPCM_SWF codec, but > when I tried to change it to AAC (or SPEEX or MP3) I > received an error message -- that these codecs > couldn't be found. For mp3 and speex, you have to compile FFmpeg with external libraries (lame and libspeex), to use the internal aac encoder you have to pass the equivalent of -strict -2 to the system. Carl Eugen From ggarra13 at gmail.com Wed Apr 17 20:04:58 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Wed, 17 Apr 2013 15:04:58 -0300 Subject: [Libav-user] pkt.dts/pts clarification Message-ID: <516EE44A.5080808@gmail.com> I am looking for the final word on pkt.pts/dts for movies that are not streaming and how to hold a valid packet queue. int got_pict = 0; while( pkt.size > 0 ) { int err = avcodec_decode_video2( stream->codec, av_frame, &got_pict, &pkt ); if ( err < 0 ) { return kDecodeError; } if ( got_pict ) { ptsframe = av_frame_get_best_effort_timestamp( av_frame ); ptsframe = pts2frame( stream, ptsframe ); store_image( ptsframe ); // store image in queue std::cerr << "STORE REPEAT " << store << " PTSFRAME " << ptsframe << " pkt.pts " << pkt.pts << " pkt.dts " << pkt.dts << " f->pts " << _av_frame->pts << " f->pkt_pts " << _av_frame->pkt_pts << " f->pkt_dts " << _av_frame->pkt_dts << std::endl; } pkt.size -= err; pkt.data += err; } if ( got_pict ) return kDecodeOK; return kDecodeMissingFrame; The above works well with decoding images with a proper pts. However, it does not work well with the "cached" frames of the video (mainly 2 frames in my case). I am wondering how should I work around that. From ggarra13 at gmail.com Thu Apr 18 00:37:19 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Wed, 17 Apr 2013 19:37:19 -0300 Subject: [Libav-user] pkt.dts/pts clarification Message-ID: <516F241F.8070000@gmail.com> I am looking for the final word on pkt.pts/dts for movies that are not streaming and how to hold a valid packet queue. int got_pict = 0; while( pkt.size > 0 ) { int err = avcodec_decode_video2( stream->codec, av_frame, &got_pict, &pkt ); if ( err < 0 ) { return kDecodeError; } if ( got_pict ) { ptsframe = av_frame_get_best_effort_timestamp( av_frame ); ptsframe = pts2frame( stream, ptsframe ); store_image( ptsframe ); // store image in queue std::cerr << "STORE REPEAT " << store << " PTSFRAME " << ptsframe << " pkt.pts " << pkt.pts << " pkt.dts " << pkt.dts << " f->pts " << _av_frame->pts << " f->pkt_pts " << _av_frame->pkt_pts << " f->pkt_dts " << _av_frame->pkt_dts << std::endl; } pkt.size -= err; pkt.data += err; } if ( got_pict ) return kDecodeOK; return kDecodeMissingFrame; The above works well with decoding images with a proper pts. However, it does not work well with the "cached" frames of the video (mainly 2 frames in my case). I am wondering how should I work around that. The demuxing example is very barebones and ffplay seems not to care about them. From phuze9 at gmail.com Thu Apr 18 00:28:12 2013 From: phuze9 at gmail.com (phuzE) Date: Wed, 17 Apr 2013 15:28:12 -0700 (PDT) Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: <516E61EB.4090406@hs-mittweida.de> References: <1365555188336-4657231.post@n4.nabble.com> <51664CED.9060206@hs-mittweida.de> <516E61EB.4090406@hs-mittweida.de> Message-ID: Thanks for your help, I discovered that my output video plays fine, but only in ffplay (in WMP/WMPClassic/VLC) it shows the gray distorted screen. I have made some changes to my code since the last update so I'll post what is working for me at the bottom of this. Can anyone think of a reason why the video would work well in ffplay and nothing else? Is there a setting that's causing this? I moved the screen capture code to another function, but it's similar with error checking for the getDIBits calls, which is where my earlier screenshot error was occurring, and also creating a COLORREF* rather than an RGBQUAD*. AVCodec* codec; AVCodecContext* c = NULL; uint8_t* outbuf; int i, out_size, outbuf_size; avcodec_register_all(); printf("Video encoding\n"); // Find the mpeg1 video encoder codec = avcodec_find_encoder(CODEC_ID_H264); if (!codec) { fprintf(stderr, "Codec not found\n"); exit(1); } else printf("H264 codec found\n"); c = avcodec_alloc_context3(codec); c->bit_rate = 400000; c->width = 1920; // resolution must be a multiple of two (1280x720),(1900x1080),(720x480) c->height = 1200; c->time_base.num = 1; // framerate numerator c->time_base.den = 25; // framerate denominator c->gop_size = 10; // emit one intra frame every ten frames c->max_b_frames = 1; // maximum number of b-frames between non b-frames //c->keyint_min = 1; // minimum GOP size //c->i_quant_factor = (float)0.71; // qscale factor between P and I frames //c->b_frame_strategy = 20; //c->qcompress = (float)0.6; //c->qmin = 20; // minimum quantizer //c->qmax = 51; // maximum quantizer //c->max_qdiff = 4; // maximum quantizer difference between frames //c->refs = 4; // number of reference frames //c->trellis = 1; // trellis RD Quantization c->pix_fmt = PIX_FMT_YUV420P; c->codec_id = CODEC_ID_H264; //c->codec_type = AVMEDIA_TYPE_VIDEO; // Open the encoder if (avcodec_open2(c, codec,NULL) < 0) { fprintf(stderr, "Could not open codec\n"); exit(1); } else printf("H264 codec opened\n"); outbuf_size = 100000 + c->width*c->height*(32>>3);//*(32>>3); // alloc image and output buffer outbuf = static_cast(malloc(outbuf_size)); printf("Setting buffer size to: %d\n",outbuf_size); FILE* f = fopen("example.mpg","wb"); if(!f) printf("x - Cannot open video file for writing\n"); else printf("Opened video file for writing\n"); // encode 5 seconds of video for(i=0;iwidth, c->height); uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes*sizeof(uint8_t)); AVFrame* inpic = avcodec_alloc_frame(); AVFrame* outpic = avcodec_alloc_frame(); outpic->pts = (int64_t)((float)i * (1000.0/((float)(c->time_base.den))) * 90); avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_RGB32, c->width, c->height); // Fill picture with image avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, c->height); av_image_alloc(outpic->data, outpic->linesize, c->width, c->height, c->pix_fmt, 1); inpic->data[0] += inpic->linesize[0]*(screenHeight-1); // Flipping frame inpic->linesize[0] = -inpic->linesize[0]; // Flipping frame struct SwsContext* fooContext = sws_getContext(screenWidth, screenHeight, PIX_FMT_RGB32, c->width, c->height, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL); sws_scale(fooContext, inpic->data, inpic->linesize, 0, c->height, outpic->data, outpic->linesize); // encode the image out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic); printf("Encoding frame %3d (size=%5d)\n", i, out_size); fwrite(outbuf, 1, out_size, f); delete [] pPixels; av_free(outbuffer); av_free(inpic); av_free(outpic); } // get the delayed frames for(; out_size; i++) { fflush(stdout); out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); printf("Writing frame %3d (size=%5d)\n", i, out_size); fwrite(outbuf, 1, out_size, f); } // add sequence end code to have a real mpeg file outbuf[0] = 0x00; outbuf[1] = 0x00; outbuf[2] = 0x01; outbuf[3] = 0xb7; fwrite(outbuf, 1, 4, f); fclose(f); avcodec_close(c); free(outbuf); av_free(c); printf("Closed codec and Freed\n"); On Wed, Apr 17, 2013 at 3:50 AM, Steffen Ebersbach-2 [via libav-users] < ml-node+s943685n4657296h60 at n4.nabble.com> wrote: > Hi > > > this is my code for making a video from a screenshot. I do not use the > hbitmap directly, but rather a gdi element. But i think this is not > necessary i do this or other reasons. One Idea, because in your last > picture the shell window is shown but the visual studio window is > missing, can be that the copy desktop / window function from windows > can't capy elements from directx and so on , only nativ stuff. This is > because in most remote control softwares, no video is transmitted. > I hope the codes help you. > > Steffen > > -------------------------------------------------- > HWND window; > // get hwnd from your window / desktop / ... > > srcDC = GetDC(window); > tarDC = CreateCompatibleDC(srcDC); > m_pal = (HPALETTE) GetCurrentObject(srcDC, OBJ_PAL); //colors > > HBITMAP obmp, hbmp = CreateCompatibleBitmap(srcDC, pwidth , pheight); > obmp = (HBITMAP) SelectObject(tarDC, hbmp); //connect hbmp to DC > > res = SendMessage(window,WM_PRINT, (WPARAM)tarDC,(LPARAM) PRF_CLIENT | > ~PRF_ERASEBKGND); // Copy BMP > tarbmp = Gdiplus::Bitmap::FromHBITMAP(hbmp,m_pal); > > SelectObject(tarDC,obmp); > DeleteObject(hbmp); > > > //Stream and encoder > av_register_all(); > avcodec_init(); > > AVFormatContext *focontext; > AVStream *videostm; > AVCodec *videocodec; > AVCodecContext *videocontext; > AVFrame *aktframe; > uint8_t *framebuf1; > SwsContext *imgconvctx; > > //container > focontext = av_alloc_format_context(); > > //videostream > videostm = av_new_stream(focontext,0); > // define your parameters here > > videocodec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO); > avcodec_open(videocontext, videocodec); > > focontext->video_codec_id = videocontext->codec_id; > av_set_parameters(focontext,0); > > > //frame > aktframe = avcodec_alloc_frame(); > picsize = avpicture_get_size(PIX_FMT_YUV420P, width, height); > framebuf1 = (uint8_t*) av_malloc(picsize); > avpicture_fill( (AVPicture*)aktframe, framebuf1, PIX_FMT_YUV420P, width, > height); > > imgconvctx = sws_getContext(width, height ,PIX_FMT_BGR24 ,width, > height,PIX_FMT_YUV420P, SWS_BICUBIC , 0,0,0); > > //convert bmp > uint8_t *inbuffer; > Gdiplus::BitmapData inbmpdata; > Gdiplus::Rect cltrct(0,0,width,height); > > newbmp->LockBits(&cltrct, Gdiplus::ImageLockModeRead > ,PixelFormat24bppRGB , &inbmpdata); > > inbuffer = (uint8_t*) inbmpdata.Scan0; > AVFrame *inframe = 0; > > inframe = avcodec_alloc_frame(); > avpicture_fill( (AVPicture*)inframe, inbuffer, PIX_FMT_BGR24, width, > height); > sws_scale(imgconvctx,inframe->data , inframe->linesize,0, height, > aktframe->data , aktframe->linesize); > int videobuf_size = videocontext->bit_rate *2; > > //open output > url_fopen(&focontext->pb,"file.mpg" , URL_WRONLY) > av_write_header(focontext); > > //encode and write frame > av_init_packet(&avpkt); > encsize = avcodec_encode_video(videocontext, videobuf ,videobuf_size, > aktframe); > avpkt.stream_index= videostm->index; > avpkt.data= videobuf; > avpkt.size= encsize; > > av_write_frame(focontext, &avpkt); > > // next frames > _______________________________________________ > 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/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657296.html > To unsubscribe from Encoding a screenshot into a video using FFMPEG, click > here > . > NAML > -- View this message in context: http://libav-users.943685.n4.nabble.com/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657301.html Sent from the libav-users mailing list archive at Nabble.com. From gkinsey at ad-holdings.co.uk Thu Apr 18 16:45:59 2013 From: gkinsey at ad-holdings.co.uk (Gavin Kinsey) Date: Thu, 18 Apr 2013 15:45:59 +0100 Subject: [Libav-user] iOS: Converting AVFrame to UIImage In-Reply-To: References: Message-ID: <201304181545.59836.gkinsey@ad-holdings.co.uk> On Wednesday 17 April 2013 03:15:06 Gary Overall wrote: > I am working on an iOS app and have been researching and seen different > approaches of converting video frames from sws_scale() to a UIImage, for > placement in a UIImageView. I am presently attempting to play my video > by successively altering the contents of my UIImageView. > > I then want to take pFrame and convert it to a UIImage so that I can > update the UIImageView.Can someone please point me in a really good > direction of how to do this conversion? Thank You In Advance Create a CGImage from the data then a UIImage from that CFDataRef cfdata = CFDataCreate(NULL, frameBuf, size); CGDataProviderRef dataProv = CGDataProviderCreateWithCFData(cfdata); CGImageRef cfimg = CGImageCreate(w, h, bitsPerComponent, bitDepth, w * bytesPP, rgbColour, bmpInfo, dataProv, NULL, NO, kCGRenderingIntentDefault); [self setImage: [UIImage imageWithCGImage:cfimg]]; CGImageRelease(cfimg); CGDataProviderRelease(dataProv); CFRelease(cfdata); Something like that. -- Gavin Kinsey AD Holdings Plc -------------------------------------------------------- This email and any files transmitted with it are CONFIDENTIAL and intended solely for the use of the individual or entity to whom they are addressed. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system; you may not copy this message or disclose its contents to anyone. The recipient should check this email and any attachments for the presence of viruses. The Company accepts no liability for any damage caused by any virus transmitted by this email. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Company. Contact Customer Services for details customerservices at dmicros.com From tanim.islam at gmail.com Thu Apr 18 17:15:09 2013 From: tanim.islam at gmail.com (Tanim Islam) Date: Thu, 18 Apr 2013 08:15:09 -0700 Subject: [Libav-user] encode directly from svg rather than png in avconv? Message-ID: Hello, Is it possible to encode from a set of SVG frames, rather than PNG frames, in avconv? Tanim Islam -------------- next part -------------- An HTML attachment was scrubbed... URL: From sagar.nmit at gmail.com Thu Apr 18 19:44:52 2013 From: sagar.nmit at gmail.com (haridas sagar) Date: Thu, 18 Apr 2013 23:14:52 +0530 Subject: [Libav-user] aac_encoding:avcodec_encode_audio2 Message-ID: Hello Everyone, I am trying to implement AAC encoder using ffmpeg API's,i am successful in encoding to aac when reading from file,thanks to libav-user and ffmpeg forums, But now i am trying to read from buffer,some times it works and sometimes it wont.... when i tried to debug the issue,it seems avcodec_encode_audio2 hangs some times and doesnt come out of the function, Does anyboby have idea or faced this issue,please do help. thanks in advance -- With Regards, Haridas Sagar.N -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Thu Apr 18 21:29:45 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Thu, 18 Apr 2013 12:29:45 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: Message-ID: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> On Apr 17, 2013, at 9:36 AM, Carl Eugen Hoyos wrote: > For mp3 and speex, you have to compile FFmpeg with > external libraries (lame and libspeex), to use the > internal aac encoder you have to pass the equivalent > of -strict -2 to the system. Carl -- thanks for the reply. Is the "-strict -2" passed to extra-cflags, extra-ldflags, or a separate option in the configure? Thanks, Brad From brado at bighillsoftware.com Fri Apr 19 06:03:33 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Thu, 18 Apr 2013 21:03:33 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> Message-ID: <1754397B-E991-4E2B-B7D6-83ED636127A2@bighillsoftware.com> On Apr 18, 2013, at 12:29 PM, Brad O'Hearne wrote: > On Apr 17, 2013, at 9:36 AM, Carl Eugen Hoyos wrote: > >> For mp3 and speex, you have to compile FFmpeg with >> external libraries (lame and libspeex), to use the >> internal aac encoder you have to pass the equivalent >> of -strict -2 to the system. I am still not having any luck with this. I have added '-strict -2" to both --extra-cflags and --extra-ldflags and have successfully compiled, but when I try to run my app, the avcodec_open2 function fails and outputs the following to the log: [aac @ 0x10700cc00] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it. Where does this '-strict -2' need to be added to enable the proper codecs and get past this error? Thanks, Brad From cehoyos at ag.or.at Fri Apr 19 10:57:02 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 19 Apr 2013 08:57:02 +0000 (UTC) Subject: [Libav-user] AAC with FLV References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > On Apr 17, 2013, at 9:36 AM, Carl Eugen Hoyos wrote: > > > For mp3 and speex, you have to compile FFmpeg with > > external libraries (lame and libspeex), to use the > > internal aac encoder you have to pass the equivalent > > of -strict -2 to the system. > Is the "-strict -2" passed to extra-cflags, > extra-ldflags, or a separate option in the configure? It is a ffmpeg runtime option, the equivalent is: avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; (avctx being AVCodecContext iirc) Carl Eugen From praks411 at gmail.com Fri Apr 19 11:16:32 2013 From: praks411 at gmail.com (praks411) Date: Fri, 19 Apr 2013 02:16:32 -0700 (PDT) Subject: [Libav-user] Audio sample format while encoding Message-ID: <1366362992265-4657309.post@n4.nabble.com> Hi, I'm trying to encode decoded audio packets alongwith with video frame into avi file. I'm facing some issue while encoding audio specifically with audio sample format field. The sample format for my audio packet is AV_SAMPLE_FMT_FLT. So when I add audio stream and set various stream parameters I also set the sample format of code contex class to AV_SAMPLE_FMT_FLT. I did normal avcodec_find_encoder() with codec id AV_CODEC_ID_AAC/AV_CODEC_ID_AC3 (tried both). Then added audio stream and set various code context params(sample rate, channel, sample fmt). However my avcodec_open2 is failing. I tried to debug it further and found that codec return by avcodec_find_encoder has available sample format as AV_SAMPLE_FMT_FLTP due to this mismatch, the call to open codec is failing. Is it possible to change the codec format to AV_SAMPLE_FMT_FLT or some other desire sample format? Here is the function which add stream and open codec for audio. int FfmpegEncoder::InitInputAudioStream(AVFormatContext* oc) { int ret = 0; char errbuf[128]; AVCodec *m_out_aud_codec; AVStream *m_out_aud_strm; if(oc->oformat->audio_codec != AV_CODEC_ID_NONE) { // oc->oformat->audio_codec = AV_CODEC_ID_AAC; //AV_CODEC_ID_AC3; m_out_aud_codec = avcodec_find_encoder(oc->oformat->audio_codec); m_out_aud_codec-> // m_out_aud_codec->sample_fmts = AV_SAMPLE_FMT_FLT; if(NULL == m_out_aud_codec) { PRINT_MSG("Could Not Find Out Aud Encoder ") return -1; } else { PRINT_MSG("Found Out Aud Encoder ") m_out_aud_strm = avformat_new_stream(oc, m_out_aud_codec); if(NULL == m_out_aud_strm) { PRINT_MSG("Failed to Allocate Out Vid Strm ") return -1; } else { m_out_aud_strm->index = 1, m_out_aud_strm->codec->channels = m_in_audio_specs.num_channels; m_out_aud_strm->codec->channel_layout = m_in_audio_specs.channel_layout; m_out_aud_strm->codec->sample_fmt = AV_SAMPLE_FMT_FLT; m_out_aud_strm->codec->sample_rate = m_in_audio_specs.sample_freq; m_out_aud_strm->codec->time_base.den = m_in_audio_specs.sample_freq; m_out_aud_strm->codec->time_base.num = 1; m_out_aud_strm->codec->bit_rate = 64000; m_out_aud_strm->codec->codec_tag = 0; /* open the codec */ AVDictionary *opts = NULL; av_dict_set(&opts, "strict", "experimental", 0); int err = 0; if((err=avcodec_open2( m_out_aud_strm->codec, m_out_aud_codec, &opts)) < 0) { return FF_ERR_CODEC_NOT_SUPPORTED; } av_dict_free(&opts); } } } else { return -1; } return 0; } -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-sample-format-while-encoding-tp4657309.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Fri Apr 19 13:12:05 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 19 Apr 2013 11:12:05 +0000 (UTC) Subject: [Libav-user] encode directly from svg rather than png in avconv? References: Message-ID: Tanim Islam writes: > Is it possible to encode from a set of SVG frames, >rather than PNG frames, FFmpeg does not support decoding svg. (Patch welcome.) > in avconv? avconv is known to contain several hundred bugs not present in ffmpeg, some of them security-relevant, please understand that we therefore cannot support it on this mailing list. Carl Eugen From praks411 at gmail.com Fri Apr 19 16:24:37 2013 From: praks411 at gmail.com (praks411) Date: Fri, 19 Apr 2013 07:24:37 -0700 (PDT) Subject: [Libav-user] Audio sample format while encoding In-Reply-To: <1366362992265-4657309.post@n4.nabble.com> References: <1366362992265-4657309.post@n4.nabble.com> Message-ID: <1366381477335-4657311.post@n4.nabble.com> I was going through source code of aac encoder and found that only single format is supported which is AV_SAMPLE_FMT_FLTP under support sample format. Similarly for other encoders too probably only one sample format. So I guess the conversion is left the for user. However I'm not sure about this. Some one please confirm on this. Thanks Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-sample-format-while-encoding-tp4657309p4657311.html Sent from the libav-users mailing list archive at Nabble.com. From brado at bighillsoftware.com Sat Apr 20 00:42:38 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 19 Apr 2013 15:42:38 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> Message-ID: <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> On Apr 19, 2013, at 1:57 AM, Carl Eugen Hoyos wrote: > It is a ffmpeg runtime option, the equivalent is: > avctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; Ok, got that working, so I didn't get the error message. However, changing the codec to AV_CODEC_ID_AAC and the sample format to AV_SAMPLE_FMT_FLTP (the only changes I made or that to my knowledge are required in my working capture-resample-encode-write pipeline) now results in distorted audio again. I'm a little stumped this time though, because first, these changes were made on working code which produced a good FLV video (with audio), and ironically the captured sample format of data is the exact same as the sample format used by AAC, so there's no mismatch there. Does anyone know what is different about processing with an AAC encoder vs a ADPCM encoder, and why the output of a working workflow might now be bad audio where before it was good? The audio now sounds slow, like talking through a fan (like a kid trying to sound like Darth Vader), and the video is kind of chunky -- good picture, but the video plays then stops, plays then stops. I've checked pts, and they are being calculated same as before and are good. Note that I've also turned off the video completely, so that only audio is being written, and the same distortion still exists in the audio. If anyone has any ideas, I'm all ears. One question you can help with, is how to properly set up an FLV output format context for use of a codec that is different from the one it loads by default. When I create my output format context for FLV, I use the following line: _avOutputFormat = av_guess_format(cStreamName, cFileNameExt, cMimeType); where the file name extension is ".flv" and the mime type is "video/x-flv", it defaults an audio codec of "adpcm_swf". What I do after the fact is this: _avOutputFormat->audio_codec = AV_CODEC_ID_AAC; audioCodec = avcodec_find_encoder(_avOutputFormat->audio_codec); this works, but is there something else I have to do to make AAC work? Is this the right way to specify an AAC encoder for use in an FLV output format context, or is there another way? I am receiving no errors anywhere in the pipeline, and as stated, the pts looks right. It is all monotonically increasing, and evenly spaced, but the audio is bad. Ideas? Thanks, Brad From cehoyos at ag.or.at Sat Apr 20 00:54:57 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 19 Apr 2013 22:54:57 +0000 (UTC) Subject: [Libav-user] AAC with FLV References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > Does anyone know what is different about processing with > an AAC encoder vs a ADPCM encoder One takes s16 (which you probably expect), the other takes flt-p (which is *not* flt, at least not exactly). You can test if mono works to find out if planar is your issue. Carl Eugen From brado at bighillsoftware.com Sat Apr 20 02:34:08 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 19 Apr 2013 17:34:08 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> Message-ID: <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> On Apr 19, 2013, at 3:54 PM, Carl Eugen Hoyos wrote: > One takes s16 (which you probably expect), the other takes > flt-p (which is *not* flt, at least not exactly). > You can test if mono works to find out if planar is your > issue. Yeah, that's just it. My captured format is FLTP, and originally that was being resampled to the adpcm_swf codec's S16 format. Now, the capture format is STILL FLTP, and is being resampled to the same format (FLTP) -- which should essentially just be a movement of data from source to destination. I haven't changed the working pipeline at all -- just the resample output format and the audio codec, but now it's junk. I'm not sure what could be affecting it. Does the creation of the output format context where it sets the default audio codec also set some other state that would effect processing? Befuddled.... Brad From cczscq2010 at gmail.com Wed Apr 17 12:02:38 2013 From: cczscq2010 at gmail.com (cczscq) Date: Wed, 17 Apr 2013 03:02:38 -0700 (PDT) Subject: [Libav-user] Speedup FFmpeg h264 Decoding on Android-Devices In-Reply-To: <501D116E.1080901@gmx.de> References: <501D116E.1080901@gmx.de> Message-ID: <1366192958248-4657297.post@n4.nabble.com> "i am using FFmpeg for H264 Decoding on an Android Device. The Videoframes are encoded on a desktop pc and streamed frame-by-frame to the phone. " I want to decode h264 using ffmpeg, frame by frame.But I just know a little about ffmpeg. Can you send a demo to me. email to:cczscq2010 at gmail.com Thanks,very much. -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Speedup-FFmpeg-h264-Decoding-on-Android-Devices-tp4655525p4657297.html Sent from the libav-users mailing list archive at Nabble.com. From cmst at live.com Thu Apr 18 10:39:35 2013 From: cmst at live.com (Dolevo Jay) Date: Thu, 18 Apr 2013 08:39:35 +0000 Subject: [Libav-user] Encoding a screenshot into a video using FFMPEG In-Reply-To: References: <1365555188336-4657231.post@n4.nabble.com>, <51664CED.9060206@hs-mittweida.de>, , , <516E61EB.4090406@hs-mittweida.de>, Message-ID: If you are thinking about commercial app, first, you must use x264 as an encoder, not ffmpeg. x264 is way optimized and the best encoder so far. Secondly, you need to capture the screenshots in a thread because you can't capture fixed fps. with bitblt. Depending on the content of the desktop, you will sometimes have 10 fps, sometimes 20. > Date: Wed, 17 Apr 2013 15:28:12 -0700 > From: phuze9 at gmail.com > To: libav-user at ffmpeg.org > Subject: Re: [Libav-user] Encoding a screenshot into a video using FFMPEG > > Thanks for your help, I discovered that my output video plays fine, but > only in ffplay (in WMP/WMPClassic/VLC) it shows the gray distorted screen. > I have made some changes to my code since the last update so I'll post what > is working for me at the bottom of this. Can anyone think of a reason why > the video would work well in ffplay and nothing else? Is there a setting > that's causing this? I moved the screen capture code to another function, > but it's similar with error checking for the getDIBits calls, which is > where my earlier screenshot error was occurring, and also creating a > COLORREF* rather than an RGBQUAD*. > > AVCodec* codec; > AVCodecContext* c = NULL; > uint8_t* outbuf; > int i, out_size, outbuf_size; > > avcodec_register_all(); > > printf("Video encoding\n"); > > // Find the mpeg1 video encoder > codec = avcodec_find_encoder(CODEC_ID_H264); > if (!codec) { > fprintf(stderr, "Codec not found\n"); > exit(1); > } > else printf("H264 codec found\n"); > > c = avcodec_alloc_context3(codec); > > c->bit_rate = 400000; > c->width = 1920; // resolution must be a multiple of two > (1280x720),(1900x1080),(720x480) > c->height = 1200; > c->time_base.num = 1; // framerate numerator > c->time_base.den = 25; // framerate denominator > c->gop_size = 10; // emit one intra frame every ten frames > c->max_b_frames = 1; // maximum number of b-frames between non b-frames > //c->keyint_min = 1; // minimum GOP size > //c->i_quant_factor = (float)0.71; // qscale factor between P and I frames > //c->b_frame_strategy = 20; > //c->qcompress = (float)0.6; > //c->qmin = 20; // minimum quantizer > //c->qmax = 51; // maximum quantizer > //c->max_qdiff = 4; // maximum quantizer difference between frames > //c->refs = 4; // number of reference frames > //c->trellis = 1; // trellis RD Quantization > c->pix_fmt = PIX_FMT_YUV420P; > c->codec_id = CODEC_ID_H264; > //c->codec_type = AVMEDIA_TYPE_VIDEO; > > // Open the encoder > if (avcodec_open2(c, codec,NULL) < 0) { > fprintf(stderr, "Could not open codec\n"); > exit(1); > } > else printf("H264 codec opened\n"); > > outbuf_size = 100000 + c->width*c->height*(32>>3);//*(32>>3); // alloc > image and output buffer > outbuf = static_cast(malloc(outbuf_size)); > printf("Setting buffer size to: %d\n",outbuf_size); > > FILE* f = fopen("example.mpg","wb"); > if(!f) printf("x - Cannot open video file for writing\n"); > else printf("Opened video file for writing\n"); > > // encode 5 seconds of video > for(i=0;i fflush(stdout); > > screenCap(); > > > int nbytes = avpicture_get_size(PIX_FMT_YUV420P, c->width, c->height); > uint8_t* outbuffer = (uint8_t*)av_malloc(nbytes*sizeof(uint8_t)); > > AVFrame* inpic = avcodec_alloc_frame(); > AVFrame* outpic = avcodec_alloc_frame(); > > > outpic->pts = (int64_t)((float)i * (1000.0/((float)(c->time_base.den))) * > 90); > avpicture_fill((AVPicture*)inpic, (uint8_t*)pPixels, PIX_FMT_RGB32, > c->width, c->height); // Fill picture with image > > avpicture_fill((AVPicture*)outpic, outbuffer, PIX_FMT_YUV420P, c->width, > c->height); > av_image_alloc(outpic->data, outpic->linesize, c->width, c->height, > c->pix_fmt, 1); > > inpic->data[0] += inpic->linesize[0]*(screenHeight-1); // Flipping frame > inpic->linesize[0] = -inpic->linesize[0]; // Flipping frame > > struct SwsContext* fooContext = sws_getContext(screenWidth, screenHeight, > PIX_FMT_RGB32, c->width, c->height, PIX_FMT_YUV420P, SWS_FAST_BILINEAR, > NULL, NULL, NULL); > > sws_scale(fooContext, inpic->data, inpic->linesize, 0, c->height, > outpic->data, outpic->linesize); > > // encode the image > out_size = avcodec_encode_video(c, outbuf, outbuf_size, outpic); > printf("Encoding frame %3d (size=%5d)\n", i, out_size); > fwrite(outbuf, 1, out_size, f); > delete [] pPixels; > av_free(outbuffer); > av_free(inpic); > av_free(outpic); > } > > // get the delayed frames > for(; out_size; i++) { > fflush(stdout); > > out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); > printf("Writing frame %3d (size=%5d)\n", i, out_size); > fwrite(outbuf, 1, out_size, f); > } > > // add sequence end code to have a real mpeg file > outbuf[0] = 0x00; > outbuf[1] = 0x00; > outbuf[2] = 0x01; > outbuf[3] = 0xb7; > fwrite(outbuf, 1, 4, f); > fclose(f); > > avcodec_close(c); > free(outbuf); > av_free(c); > printf("Closed codec and Freed\n"); > > > > On Wed, Apr 17, 2013 at 3:50 AM, Steffen Ebersbach-2 [via libav-users] < > ml-node+s943685n4657296h60 at n4.nabble.com> wrote: > > > Hi > > > > > > this is my code for making a video from a screenshot. I do not use the > > hbitmap directly, but rather a gdi element. But i think this is not > > necessary i do this or other reasons. One Idea, because in your last > > picture the shell window is shown but the visual studio window is > > missing, can be that the copy desktop / window function from windows > > can't capy elements from directx and so on , only nativ stuff. This is > > because in most remote control softwares, no video is transmitted. > > I hope the codes help you. > > > > Steffen > > > > -------------------------------------------------- > > HWND window; > > // get hwnd from your window / desktop / ... > > > > srcDC = GetDC(window); > > tarDC = CreateCompatibleDC(srcDC); > > m_pal = (HPALETTE) GetCurrentObject(srcDC, OBJ_PAL); //colors > > > > HBITMAP obmp, hbmp = CreateCompatibleBitmap(srcDC, pwidth , pheight); > > obmp = (HBITMAP) SelectObject(tarDC, hbmp); //connect hbmp to DC > > > > res = SendMessage(window,WM_PRINT, (WPARAM)tarDC,(LPARAM) PRF_CLIENT | > > ~PRF_ERASEBKGND); // Copy BMP > > tarbmp = Gdiplus::Bitmap::FromHBITMAP(hbmp,m_pal); > > > > SelectObject(tarDC,obmp); > > DeleteObject(hbmp); > > > > > > //Stream and encoder > > av_register_all(); > > avcodec_init(); > > > > AVFormatContext *focontext; > > AVStream *videostm; > > AVCodec *videocodec; > > AVCodecContext *videocontext; > > AVFrame *aktframe; > > uint8_t *framebuf1; > > SwsContext *imgconvctx; > > > > //container > > focontext = av_alloc_format_context(); > > > > //videostream > > videostm = av_new_stream(focontext,0); > > // define your parameters here > > > > videocodec = avcodec_find_encoder(CODEC_ID_MPEG2VIDEO); > > avcodec_open(videocontext, videocodec); > > > > focontext->video_codec_id = videocontext->codec_id; > > av_set_parameters(focontext,0); > > > > > > //frame > > aktframe = avcodec_alloc_frame(); > > picsize = avpicture_get_size(PIX_FMT_YUV420P, width, height); > > framebuf1 = (uint8_t*) av_malloc(picsize); > > avpicture_fill( (AVPicture*)aktframe, framebuf1, PIX_FMT_YUV420P, width, > > height); > > > > imgconvctx = sws_getContext(width, height ,PIX_FMT_BGR24 ,width, > > height,PIX_FMT_YUV420P, SWS_BICUBIC , 0,0,0); > > > > //convert bmp > > uint8_t *inbuffer; > > Gdiplus::BitmapData inbmpdata; > > Gdiplus::Rect cltrct(0,0,width,height); > > > > newbmp->LockBits(&cltrct, Gdiplus::ImageLockModeRead > > ,PixelFormat24bppRGB , &inbmpdata); > > > > inbuffer = (uint8_t*) inbmpdata.Scan0; > > AVFrame *inframe = 0; > > > > inframe = avcodec_alloc_frame(); > > avpicture_fill( (AVPicture*)inframe, inbuffer, PIX_FMT_BGR24, width, > > height); > > sws_scale(imgconvctx,inframe->data , inframe->linesize,0, height, > > aktframe->data , aktframe->linesize); > > int videobuf_size = videocontext->bit_rate *2; > > > > //open output > > url_fopen(&focontext->pb,"file.mpg" , URL_WRONLY) > > av_write_header(focontext); > > > > //encode and write frame > > av_init_packet(&avpkt); > > encsize = avcodec_encode_video(videocontext, videobuf ,videobuf_size, > > aktframe); > > avpkt.stream_index= videostm->index; > > avpkt.data= videobuf; > > avpkt.size= encsize; > > > > av_write_frame(focontext, &avpkt); > > > > // next frames > > _______________________________________________ > > 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/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657296.html > > To unsubscribe from Encoding a screenshot into a video using FFMPEG, click > > here > > . > > NAML > > > > > > > -- > View this message in context: http://libav-users.943685.n4.nabble.com/Encoding-a-screenshot-into-a-video-using-FFMPEG-tp4657231p4657301.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 gedikmert89 at gmail.com Sat Apr 20 13:20:25 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Sat, 20 Apr 2013 14:20:25 +0300 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems Message-ID: I've made many tests to get good performance for video decoding with ffmpeg on low cpu idevices such as iPad 1 and iPhone 3Gs, and see that using asm option when configuring ffmpeg for cross compiling for ios is very very important for performance.. But when I configure with --enable-asm, the audio stream which using mpx(mp1,mp2,mp) codec sounds squeaky. If I configure with --disable-asm option, than mpx(mp1,mp2,mp) codec sounds well but then the performance is %50 percent of the previous one built with the --enable-asm option... I've also tested these with the ffmpeg versions that are 0.8, 0.9, 0.10, 0.11, 1.0,1.1,1.2 All of them produces same results... Can anyone have the same problem with me ? Also, any idea how can I fix this issue ? please advice me .. (I can not find any patch to fix this issue on the net or in ffmpeg forums.) -mg -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Sat Apr 20 13:42:24 2013 From: onemda at gmail.com (Paul B Mahol) Date: Sat, 20 Apr 2013 11:42:24 +0000 Subject: [Libav-user] AAC with FLV In-Reply-To: <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> Message-ID: On 4/20/13, Brad O'Hearne wrote: > On Apr 19, 2013, at 3:54 PM, Carl Eugen Hoyos wrote: > >> One takes s16 (which you probably expect), the other takes >> flt-p (which is *not* flt, at least not exactly). >> You can test if mono works to find out if planar is your >> issue. > > Yeah, that's just it. My captured format is FLTP, and originally that was > being resampled to the adpcm_swf codec's S16 format. Now, the capture format > is STILL FLTP, and is being resampled to the same format (FLTP) -- which > should essentially just be a movement of data from source to destination. I > haven't changed the working pipeline at all -- just the resample output > format and the audio codec, but now it's junk. I'm not sure what could be > affecting it. Does the creation of the output format context where it sets > the default audio codec also set some other state that would effect > processing? Without source code, this is lottery. > > Befuddled.... > > Brad > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From cehoyos at ag.or.at Sat Apr 20 13:44:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 20 Apr 2013 11:44:06 +0000 (UTC) Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems References: Message-ID: Mert Gedik writes: > But when I configure with --enable-asm, the audio stream > which using mpx(mp1,mp2,mp) codec sounds squeaky. Did you test --disable-thumb and --disable-neon? Please try to find the function that is responsible for the problem. Carl Eugen From gedikmert89 at gmail.com Sat Apr 20 14:47:08 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Sat, 20 Apr 2013 15:47:08 +0300 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: Message-ID: I think, using --disable-neon option makes performance low, doesn't it? As I said I am working on slow devices such as iPad 1 and iPhone 3GS, and I need anything that improves performance... The sound problem happens on device only when configure ffmpeg with --enable-asm optimization parameter, no sound problem exists on simulator with same configuration... On Sat, Apr 20, 2013 at 2:44 PM, Carl Eugen Hoyos wrote: > Mert Gedik writes: > > > But when I configure with --enable-asm, the audio stream > > which using mpx(mp1,mp2,mp) codec sounds squeaky. > > Did you test --disable-thumb and --disable-neon? > Please try to find the function that is > responsible for the problem. > > 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 gedikmert89 at gmail.com Sat Apr 20 16:01:39 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Sat, 20 Apr 2013 17:01:39 +0300 Subject: [Libav-user] noise on mp3-decoding Message-ID: I think, your problem is same as mine which about using asm optimizations this is my post about my problem, http://ffmpeg.org/pipermail/libav-user/2013-April/004330.html any idea about how to fix that? -MG -------------- next part -------------- An HTML attachment was scrubbed... URL: From goverall at hotmail.com Sat Apr 20 16:51:25 2013 From: goverall at hotmail.com (Gary Overall) Date: Sat, 20 Apr 2013 10:51:25 -0400 Subject: [Libav-user] No accelerated colorspace conversion - What does it mean? Message-ID: I receive the following message: [swscaler @ 0x8b0de00] No accelerated colorspace conversion found from yuv420p to rgb24. when issuing: sws_ctx = sws_getContext ( pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt, pCodecCtx->width, pCodecCtx->height, PIX_FMT_RGB24, SWS_BILINEAR, NULL, NULL, NULL ); in my iOS app when running the iPhone or IPad simulator. I am decoding and h264 video. I had to turn off assembler optimizations (--disable-asm) in my configure script for the i386 compile in order to avoid the following error during the make of the i386 libraries: cc1: error in backend: Ran out of registers during register allocation!make: *** [libavcodec/h264_cabac.o] Error 1 My questions:1) Does "No accelerated colorspace conversion found" mean that there were no assembler optimizations?2) If so, is there a way to make it run without assembler optimizations? ( I don't mind if it is slow on the simulator)3) If so again, how do I avoid the error when attempting the make with assembler optimizations?4) Most importantly, am I even on the right path to solving this problem? I truly appreciate your kind response: Here is a copy of my configure command for the i386 build. ./configure \--prefix=i386 \--disable-programs \--enable-avresample \--disable-bzlib --disable-doc --enable-pic --disable-zlib --enable-decoder=h264 --enable-demuxer=h264 --enable-parser=h264 --disable-libschroedinger --disable-libspeex --disable-libtheora --disable-libvorbis --disable-libvpx \--enable-cross-compile \--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" \--target-os=darwin \--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" \--extra-cflags="-arch i386" \--extra-ldflags="-arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" \--arch=i386 \--cpu=i386 \--enable-pic \--disable-asm \ -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Sat Apr 20 18:36:57 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sat, 20 Apr 2013 09:36:57 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> Message-ID: <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> On Apr 20, 2013, at 4:42 AM, Paul B Mahol wrote: > On 4/20/13, Brad O'Hearne wrote: >> affecting it. Does the creation of the output format context where it sets >> the default audio codec also set some other state that would effect >> processing? > > Without source code, this is lottery. Paul -- thanks for the reply. My source code is on Github at: https://github.com/BigHillSoftware/QTFFmpeg This is a fully runnable Mac OS X (10.8) app, which captures video and audio, and writes them to a local FLV file on the desktop. The class which contains all FFmpeg code is QTFFAVStreamer. Configuration is mostly contained in QTFFAVConfig. Note that presently the app is configured to write only audio, so as to isolate it away from dealing with video. I have also included an FLV file created with this app in the following location: Sample Output/Output.flv You can go ahead and play this file, and hear what the problem is with the audio. If you have the knowhow to look into the file itself, well I suppose that could be done too. At this point, essentially here's a synopsis of the situation: the app mentioned above (same codebase) has been used to create good FLV files containing both video and audio, playback appeared to be perfectly synced. In this scenario, audio was being encoded with the adpcm_swf codec, which used an S16 sample format. The only changes made to the codebase from this working scenario were: 1. The adpcm_swf codec on the output format context (which was default for FLV) was replaced with the AAC codec. 2. The codec context was set for the proper strict compliance for AAC to work: audioCodecCtx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL; 3. The output sample format to which the captured audio was resampled to was changed from S16 to FLTP. Those were the only changes made save updating the FFmpeg source code to the latest on 4/18 and rebuilding the libraries -- and if you are curious about build settings, my configure script is located at: FFmpeg/build-ffmpeg-iOS6-MacOSX-libs.sh So after these changes, the audio is distorted. I'm not sure why -- as I know the actual capture-resample-encode-write approach / pipeline is sound, my guess is that this is some kind of additional configuration or handling need surrounding AAC. Any thoughts, ideas, or help are greatly appreciated. Brad From onemda at gmail.com Sat Apr 20 20:19:45 2013 From: onemda at gmail.com (Paul B Mahol) Date: Sat, 20 Apr 2013 18:19:45 +0000 Subject: [Libav-user] No accelerated colorspace conversion - What does it mean? In-Reply-To: References: Message-ID: On 4/20/13, Gary Overall wrote: > I receive the following message: > > > > > > > > [swscaler @ 0x8b0de00] No accelerated colorspace conversion found from > yuv420p to rgb24. > when issuing: > > > > > > > > sws_ctx = > sws_getContext > ( > pCodecCtx->width, > pCodecCtx->height, > pCodecCtx->pix_fmt, > pCodecCtx->width, > pCodecCtx->height, > PIX_FMT_RGB24, > SWS_BILINEAR, > NULL, > NULL, > NULL > ); > in my iOS app when running the iPhone or IPad simulator. I am decoding and > h264 video. I had to turn off assembler optimizations (--disable-asm) in my > configure script for the i386 compile in order to avoid the following error > during the make of the i386 libraries: > cc1: error in backend: Ran out of registers during register allocation!make: > *** [libavcodec/h264_cabac.o] Error 1 This is bug that should be reported if it's not already reported. Additionally it should be possible to disable optimizations only for certain files. > My questions: > 1) Does "No accelerated colorspace conversion found" mean that > there were no assembler optimizations? It means there where no assembler optimizations enabled at compilation. > 2) If so, is there a way to make it > run without assembler optimizations? ( I don't mind if it is slow on the > simulator) You are already running without optimizations. > 3) If so again, how do I avoid the error when attempting the make > with assembler optimizations? If assembler optimizations are enabled error will not be displayed. > 4) Most importantly, am I even on the right > path to solving this problem? > I truly appreciate your kind response: > Here is a copy of my configure command for the i386 build. > > ./configure \--prefix=i386 \--disable-programs \--enable-avresample > \--disable-bzlib --disable-doc --enable-pic --disable-zlib > --enable-decoder=h264 --enable-demuxer=h264 --enable-parser=h264 > --disable-libschroedinger --disable-libspeex --disable-libtheora > --disable-libvorbis --disable-libvpx \--enable-cross-compile > \--sysroot="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" > \--target-os=darwin > \--cc="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc" > \--extra-cflags="-arch i386" \--extra-ldflags="-arch i386 -isysroot > /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk" > \--arch=i386 \--cpu=i386 \--enable-pic \--disable-asm \ > --disable-asm means no asm optimizations will be compiled in, thus that warning happens. From cehoyos at ag.or.at Sat Apr 20 21:34:46 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sat, 20 Apr 2013 19:34:46 +0000 (UTC) Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems References: Message-ID: Mert Gedik writes: > The sound problem happens on device only when > configure ffmpeg with --enable-asm optimization > parameter, no sound problem exists on simulator > with same configuration... Is the sound also reproducible with --disable-neon or --disable-thumb ? (Honestly: As long as we don't find the offending function, this is quite unlikely to get fixed.) Please do not top-post on this mailing list and please avoid cross-posting, both is considered rude. Carl Eugen From brado at bighillsoftware.com Sat Apr 20 22:01:04 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sat, 20 Apr 2013 13:01:04 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> Message-ID: <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> On Apr 20, 2013, at 9:36 AM, Brad O'Hearne wrote: > So after these changes, the audio is distorted. I'm not sure why -- as I know the actual capture-resample-encode-write approach / pipeline is sound, my guess is that this is some kind of additional configuration or handling need surrounding AAC. I was able to eek just a bit closer to the goal by changing the AAC codec context's bit rate from 192 to 128 and the sample rate from 44100 to 9600. I found these values from looking at the defaults on the codec itself when it was loaded, so I inferred that the codec context would appreciate such values. At least now the audio timing sounds right (it isn't slower like it was before). However, the audio still suffers from noise -- a buzzing over the expected audio, still like someone talking through a running fan. I have uploaded this FLV file (which contains only audio) so that anyone interested can listen. https://github.com/BigHillSoftware/QTFFmpeg The output FLV can be found in the code above at: Sample Output/Output.flv I'm not sure what to try next. While I mentioned above that I had changed the bit rate, that didn't really seem to be a big factor -- the change seemed to be most affected by the sample rate changes (I experimented with various values, and that seemed to have the greatest effect). Note that the source audio sample rate was 44100, so I'm not sure why using a sample rate of 44100 on the codec context was problematic. Beyond this, I'm pretty much grabbing at straws. I'm suspecting that the answer is probably just a knob or switch somewhere, a setting that will make it work. I read a bit about bit_rate_tolerance, but the source code doc doesn't say anything about what values to use, so I didn't know how to set it. Any ideas would be greatly appreciated. Thanks, Brad From brado at bighillsoftware.com Sat Apr 20 22:24:48 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sat, 20 Apr 2013 13:24:48 -0700 Subject: [Libav-user] Resampling to an identical audio format Message-ID: Suppose one were to create a resampler context for audio where the source and destination sample formats, channel layout, and sample rates were the same. Should the source data bytes be modified in any way when assigning to the destination data? Brad From gedikmert89 at gmail.com Sun Apr 21 01:34:03 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Sun, 21 Apr 2013 02:34:03 +0300 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: Message-ID: Sorry for that, I am using an mail list for the first time... BTW, I tested each configuration option that you mentioned as below, you can see the results, ./configure ... --enable-asm --disable-neon ---> distortion on sound. ./configure ... --enable-asm --disable-thumb ---> distortion on sound. Please note that this problem happens only when using --enable-asm configure option with streams that include mp3, or mp2 , or mp1 codecs on device. -MG -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Sun Apr 21 10:21:10 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 21 Apr 2013 08:21:10 +0000 (UTC) Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems References: Message-ID: Mert Gedik writes: > ./configure ... --enable-asm --disable-neon > ---> distortion on sound. > > ./configure ... --enable-asm --disable-thumb > ---> distortion on sound. I believe if you test the following configuration options, it should allow to further narrow down the search for the responsible function: --cpu=armv4 --cpu=armv5 --cpu=armv6 (They correspond to libavcodec/arm/dsputil_init*.c) Carl Eugen From julian at jusst.de Sun Apr 21 17:16:04 2013 From: julian at jusst.de (Julian Scheel) Date: Sun, 21 Apr 2013 17:16:04 +0200 Subject: [Libav-user] Skipping data consumed by avformat_find_stream_info Message-ID: Hi, is it possible to skip the data that was consumed by avformat_find_stream_info instead of keeping it buffered? We are playing livestream with omxplayer on raspberry pi, where the stream parameters are autodetected by avformat_find_stream_info before the hardware decoders are opened. As this takes a few seconds (decoding a few h264 frames in software is not actually fast on a 700MHz ARM) it does not make much sense to try decoding the full data that was incoming while analyzing the stream. Instead it would be better to just continue with the live data where it is after find_stream_info completes. This will avoid interrupted data on start of playback, as most times some packets are dropped due to high system load in the analyze step), and reduce the rendering delay. For live-tv 10-15 seconds delay are not really good to have. Any hints on how this could be realized? I did not see an obvious way so far. Thanks, Julian From cehoyos at ag.or.at Sun Apr 21 22:05:48 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Sun, 21 Apr 2013 20:05:48 +0000 (UTC) Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems References: Message-ID: Mert Gedik writes: > But when I configure with --enable-asm, the audio stream > which using mpx(mp1,mp2,mp) codec sounds squeaky. I suspect that this is ticket #2473 which I had to close because no information whatsoever was provided that allowed to analyze the problem. Thanks to you, there is a little more information now (arm but not neon related iiuc), but more tests will be needed to allow fixing this issue. (I unfortunately do not have acess to a suitable testing environment.) Carl Eugen From brado at bighillsoftware.com Mon Apr 22 01:32:03 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sun, 21 Apr 2013 16:32:03 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> Message-ID: <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> On Apr 20, 2013, at 1:01 PM, Brad O'Hearne wrote: > Beyond this, I'm pretty much grabbing at straws. I'm suspecting that the answer is probably just a knob or switch somewhere, a setting that will make it work. I read a bit about bit_rate_tolerance, but the source code doc doesn't say anything about what values to use, so I didn't know how to set it. In lieu of making no progress, and being pretty much out of options, and nothing being apparent to anyone else either, perhaps I can retrench with some simpler questions in hopes of moving forward: 1. Is anyone aware of audio being captured from QuickTime, encoded successfully to AAC in an FLV file? I wouldn't think this is the case, but maybe there's some prohibiting factor that prevents the encoder from being able to accomplish this. 2. How do you get rid of distortion / buzz in encoded AAC audio? I'm at a loss -- I've taken working code, changed the encoder / sample format / sample rate and gone from perfect audio to distorted audio -- same input, same processing code. 3. Is there any way to determine from the recorded/written FLV file what the reason for distortion / buzz is? I have no experience analyzing the end product of encoding -- is there a way to pinpoint what is happening in encoding that creates this distortion where before it didn't exist? Thanks, Brad From kalileo at universalx.net Mon Apr 22 04:34:06 2013 From: kalileo at universalx.net (Kalileo) Date: Mon, 22 Apr 2013 09:34:06 +0700 Subject: [Libav-user] AAC with FLV In-Reply-To: <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> Message-ID: <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> On Apr 22, 2013, at 06:32 , Brad O'Hearne wrote: > On Apr 20, 2013, at 1:01 PM, Brad O'Hearne wrote: > >> Beyond this, I'm pretty much grabbing at straws. I'm suspecting that the answer is probably just a knob or switch somewhere, a setting that will make it work. I read a bit about bit_rate_tolerance, but the source code doc doesn't say anything about what values to use, so I didn't know how to set it. > > In lieu of making no progress, and being pretty much out of options, and nothing being apparent to anyone else either, perhaps I can retrench with some simpler questions in hopes of moving forward: > > 1. Is anyone aware of audio being captured from QuickTime, encoded successfully to AAC in an FLV file? I wouldn't think this is the case, but maybe there's some prohibiting factor that prevents the encoder from being able to accomplish this. I strongly doubt that there is any reason why that should not be possible. > > 2. How do you get rid of distortion / buzz in encoded AAC audio? I'm at a loss -- I've taken working code, changed the encoder / sample format / sample rate and gone from perfect audio to distorted audio -- same input, same processing code. > You took working code for a different situation. Instead of playing around with values, I would systematically analyze every step of your process, verify every value, to check if your assumptions are correct. Memory alignment might be an issue too. Again, I would check the process every step beginning with the first step, the captured audio. Assuming the source is clean, and your resampling logic is correct, somewhere you feed the process with incorrect values. Verify every single value. From nhanndt_87 at yahoo.com Mon Apr 22 07:51:08 2013 From: nhanndt_87 at yahoo.com (thanh nhan thanh nhan) Date: Sun, 21 Apr 2013 22:51:08 -0700 (PDT) Subject: [Libav-user] Video decoding to raw image data! Message-ID: <1366609868.99471.YahooMailNeo@web121702.mail.ne1.yahoo.com> Dear all, I am working video data decoding using ffmpeg libs. I tried to use example source code provided by ffmpeg but it failed. The program was corruptted at avcodec_decode_video2() function?and left a message : Header damage. In some files, avcodec_decode_video2() returned negative values and no frame decoded. I do not clearly know about this function. Is there anybody who knows why or has free-bug source code for decoding video? Hope you guys could help me soon. Thank you so much! nhanndt From julian.herrera at tvgenius.net Mon Apr 22 10:34:05 2013 From: julian.herrera at tvgenius.net (Julian Herrera) Date: Mon, 22 Apr 2013 09:34:05 +0100 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: Message-ID: <5174F5FD.1070502@tvgenius.net> On 21/04/2013 21:05, Mert Gedik wrote: > Mert Gedik writes: > >> But when I configure with --enable-asm, the audio stream >> which using mpx(mp1,mp2,mp) codec sounds squeaky. > Which gas-preprocessor.pl version are you using? I came accross a similar issue that affected only mp* audio on iOS and I found a solution by using this preprocessor: https://github.com/mansr/gas-preprocessor Give it a try. Julian From cehoyos at ag.or.at Mon Apr 22 11:06:49 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 22 Apr 2013 09:06:49 +0000 (UTC) Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems References: <5174F5FD.1070502@tvgenius.net> Message-ID: Julian Herrera writes: > Which gas-preprocessor.pl version are you using? I > came accross a similar issue that affected only > mp* audio on iOS and I found a solution by using > this preprocessor: Please only use the official gas-preprocessor script from https://github.com/yuvi/gas-preprocessor as explained on http://ffmpeg.org/platform.html and please report any problems with it! Carl Eugen From al at dneg.com Mon Apr 22 11:16:28 2013 From: al at dneg.com (Al Crate) Date: Mon, 22 Apr 2013 10:16:28 +0100 Subject: [Libav-user] swscale YUV444P10 -> RGB48LE Message-ID: <5174FFEC.6060305@dneg.com> Hi all, I've been trying to explode a ProRes 444 movie to a sequence of 16bit images. It would appear that this doesn't work as libswscale always outputs non full chroma when converting YUV->RGB. Can someone confirm my suspicion ? cheers al From onemda at gmail.com Mon Apr 22 11:22:12 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 22 Apr 2013 09:22:12 +0000 Subject: [Libav-user] swscale YUV444P10 -> RGB48LE In-Reply-To: <5174FFEC.6060305@dneg.com> References: <5174FFEC.6060305@dneg.com> Message-ID: On 4/22/13, Al Crate wrote: > Hi all, > > I've been trying to explode a ProRes 444 movie to a sequence of 16bit > images. It would appear that this doesn't work as libswscale always > outputs non full chroma when converting YUV->RGB. > > Can someone confirm my suspicion ? What "outputs non full chroma" means? > > cheers > > al > > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From al at dneg.com Mon Apr 22 11:34:03 2013 From: al at dneg.com (Al Crate) Date: Mon, 22 Apr 2013 10:34:03 +0100 Subject: [Libav-user] swscale YUV444P10 -> RGB48LE In-Reply-To: References: <5174FFEC.6060305@dneg.com> Message-ID: <5175040B.50906@dneg.com> On 22/04/13 10:22, Paul B Mahol wrote: > On 4/22/13, Al Crate wrote: >> Hi all, >> >> I've been trying to explode a ProRes 444 movie to a sequence of 16bit >> images. It would appear that this doesn't work as libswscale always >> outputs non full chroma when converting YUV->RGB. >> >> Can someone confirm my suspicion ? > > What "outputs non full chroma" means? >> >> cheers >> >> al >> >> >> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > When you look at the output (converted to back YUV) you get 422 i.e. half the expected number of UV samples. I suspect this piece of code in libswscale (util.c) might be the cause. Line 1031: /* reuse chroma for 2 pixels RGB/BGR unless user wants full * chroma interpolation */ if (flags & SWS_FULL_CHR_H_INT && isAnyRGB(dstFormat) && !isPlanarRGB(dstFormat) && dstFormat != AV_PIX_FMT_RGBA && dstFormat != AV_PIX_FMT_ARGB && dstFormat != AV_PIX_FMT_BGRA && dstFormat != AV_PIX_FMT_ABGR && dstFormat != AV_PIX_FMT_RGB24 && dstFormat != AV_PIX_FMT_BGR24 && dstFormat != AV_PIX_FMT_BGR4_BYTE && dstFormat != AV_PIX_FMT_RGB4_BYTE && dstFormat != AV_PIX_FMT_BGR8 && dstFormat != AV_PIX_FMT_RGB8 ) { av_log(c, AV_LOG_WARNING, "full chroma interpolation for destination format '%s' not yet implemented\n", av_get_pix_fmt_name(dstFormat)); flags &= ~SWS_FULL_CHR_H_INT; c->flags = flags; } From onemda at gmail.com Mon Apr 22 11:37:18 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 22 Apr 2013 09:37:18 +0000 Subject: [Libav-user] swscale YUV444P10 -> RGB48LE In-Reply-To: <5175040B.50906@dneg.com> References: <5174FFEC.6060305@dneg.com> <5175040B.50906@dneg.com> Message-ID: On 4/22/13, Al Crate wrote: > On 22/04/13 10:22, Paul B Mahol wrote: >> On 4/22/13, Al Crate wrote: >>> Hi all, >>> >>> I've been trying to explode a ProRes 444 movie to a sequence of 16bit >>> images. It would appear that this doesn't work as libswscale always >>> outputs non full chroma when converting YUV->RGB. >>> >>> Can someone confirm my suspicion ? >> >> What "outputs non full chroma" means? >>> >>> cheers >>> >>> al >>> >>> >>> >>> _______________________________________________ >>> Libav-user mailing list >>> Libav-user at ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/libav-user >>> >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user >> > > When you look at the output (converted to back YUV) you get 422 i.e. > half the expected number of UV samples. > > I suspect this piece of code in libswscale (util.c) might be the cause. > > Line 1031: > > /* reuse chroma for 2 pixels RGB/BGR unless user wants full > * chroma interpolation */ > if (flags & SWS_FULL_CHR_H_INT && > isAnyRGB(dstFormat) && > !isPlanarRGB(dstFormat) && > dstFormat != AV_PIX_FMT_RGBA && > dstFormat != AV_PIX_FMT_ARGB && > dstFormat != AV_PIX_FMT_BGRA && > dstFormat != AV_PIX_FMT_ABGR && > dstFormat != AV_PIX_FMT_RGB24 && > dstFormat != AV_PIX_FMT_BGR24 && > dstFormat != AV_PIX_FMT_BGR4_BYTE && > dstFormat != AV_PIX_FMT_RGB4_BYTE && > dstFormat != AV_PIX_FMT_BGR8 && > dstFormat != AV_PIX_FMT_RGB8 > ) { > av_log(c, AV_LOG_WARNING, > "full chroma interpolation for destination format '%s' > not yet implemented\n", > av_get_pix_fmt_name(dstFormat)); > flags &= ~SWS_FULL_CHR_H_INT; > c->flags = flags; > } > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > Hmm, indeed, then open bug report. From lars.hammarstrand at gmail.com Mon Apr 22 15:04:15 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 15:04:15 +0200 Subject: [Libav-user] Anybody got DXVA2 running? Message-ID: Hi I'm facing hard problems to get DXVA2 to work based on current master head or 1.2. The ffmpeg implementation seems to supports DXVA2 hw-accl codec for H.264/MPEG-4 & MPEG-2 (i.e Hi10P) but I only get CPU decoded and swscale converted working properly. Same problem goes with VideoLan's VLC binary 2.0.6 but Apples Quicktime seems doing fine with full hw-acc with only 2-4% CPU. Maybe this has anything to do with it: http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-March/139852.html. Dxdiag says dx10 and all hw functions enabled. Anybody got DXVA2 running? If so, which ffmpeg version and config flags were used? Thanks in advance! -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Mon Apr 22 15:32:01 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Mon, 22 Apr 2013 15:32:01 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: On Mon, Apr 22, 2013 at 3:04 PM, Lars Hammarstrand < lars.hammarstrand at gmail.com> wrote: > Hi > > I'm facing hard problems to get DXVA2 to work based on current master head > or 1.2. The ffmpeg implementation seems to supports DXVA2 hw-accl codec for > H.264/MPEG-4 & MPEG-2 (i.e Hi10P) but I only get CPU decoded and swscale > converted working properly. Same problem goes with VideoLan's VLC binary > 2.0.6 but Apples Quicktime seems doing fine with full hw-acc with only 2-4% > CPU. Maybe this has anything to do with it: > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-March/139852.html. > Dxdiag says dx10 and all hw functions enabled. > > Anybody got DXVA2 running? If so, which ffmpeg version and config flags > were used? > > > The ffmpeg application does not support DXVA2. Other players like VLC should however be fine, if build with a proper toolchain which includes the DXVA2 headers required (say mingw-w64) If the toolchain provides dxva2 headers, no config flags should be required and support enabled automatically in avcodec. Note that Hi10p is not supported by hardware decoders. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Apr 22 15:32:44 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 22 Apr 2013 13:32:44 +0000 (UTC) Subject: [Libav-user] Anybody got DXVA2 running? References: Message-ID: Lars Hammarstrand writes: > The ffmpeg implementation seems to supports DXVA2 > hw-accl codec for H.264/MPEG-4 & MPEG-2 (i.e Hi10P) > but I only get CPU decoded and swscale converted > working properly. Since this is not clear (for me, I am not a native speaker) from your message: You do realize that ffmpeg (the application) does not suport dxva2 ? Carl Eugen From lars.hammarstrand at gmail.com Mon Apr 22 15:42:00 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 15:42:00 +0200 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: Message-ID: 2013/4/21 Mert Gedik > Sorry for that, I am using an mail list for the first time... > > Hi Mert - I wouldn't worry to much about that, same happens to me all the time :-) > BTW, > > I tested each configuration option that you mentioned as below, you can > see the results, > > xbmc are utilizing ffmpeg to the fullest and we seldom have any problems with general formats like mp3 and so on. We build for ios like this: ./configure \ --disable-avdevice \ --disable-avformat \ --disable-avutil \ --disable-swresample \ --disable-swscale \ --disable-postproc \ --disable-avfilter \ --disable-ffplay \ --disable-ffserver \ --disable-ffprobe \ --disable-doc \ --disable-bzlib \ --disable-programs \ --target-os=darwin \ --enable-cross-compile \ --enable-gpl \ --enable-version3 \ --arch=arm \ --cpu=cortex-a8 \ --enable-pic \ --extra-cflags='-arch armv7' \ --extra-ldflags='-arch armv7' \ --extra-cflags='-mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad' \ --enable-neon \ --disable-armv5te \ --disable-armv6 \ --disable-armv6t2 \ --enable-optimizations \ --enable-debug=3 \ --disable-stripping \ --cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk \ --as='/Users/Shared/xbmc-depends/buildtools-native/bin/gas-preprocessor.pl/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc' \ --extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/usr/lib/system You should also check you have the latest/proper gas-preprocessor version which manages all the ARM optimizations and the official ffmpeg repo for gas-preprocessor is https://github.com/yuvi/gas-preprocessor which btw is a copy of Mans Rullgards (the author of gas-preprocessos) own repo https://github.com/yuvi/gas-preprocessor. Since gas-preprocessor is copied manually the ffmpeg version may some time fall behind so it's worth checking out Mans repo from time to time. Mans Rullgards is an ARM optimizations guru and The Father of all ARM optimizations used by libav and ffmpeg. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Mon Apr 22 15:55:05 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 15:55:05 +0200 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: <5174F5FD.1070502@tvgenius.net> Message-ID: 2013/4/22 Carl Eugen Hoyos > Julian Herrera writes: > > > Which gas-preprocessor.pl version are you using? I > > came accross a similar issue that affected only > > mp* audio on iOS and I found a solution by using > > this preprocessor: > > Please only use the official gas-preprocessor script > from https://github.com/yuvi/gas-preprocessor as > explained on http://ffmpeg.org/platform.html and > please report any problems with it! > > Well, first of all: Mans Rullgard is the author of gas-preprocessor and deserves all the credit. Secondly the ffmeg version of gas-preprocesso is manually copied from Mans repo github.com/mansr/gas-preprocessor to ffmpeg's repo github.com/yuvi/gas-preprocessor thus it may fall behind. In fact, if you have problems with arm optimization i would recommend to check Mans repo from time to time just to be sure there are no new updates that hasn't been brought into ffmpeg. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Mon Apr 22 16:03:11 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 16:03:11 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: 2013/4/22 Hendrik Leppkes > > > On Mon, Apr 22, 2013 at 3:04 PM, Lars Hammarstrand < > lars.hammarstrand at gmail.com> wrote: > >> Hi >> >> I'm facing hard problems to get DXVA2 to work based on current master >> head or 1.2. The ffmpeg implementation seems to supports DXVA2 hw-accl >> codec for H.264/MPEG-4 & MPEG-2 (i.e Hi10P) but I only get CPU decoded and >> swscale converted working properly. Same problem goes with VideoLan's VLC >> binary 2.0.6 but Apples Quicktime seems doing fine with full hw-acc with >> only 2-4% CPU. Maybe this has anything to do with it: >> http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-March/139852.html. >> Dxdiag says dx10 and all hw functions enabled. >> >> Anybody got DXVA2 running? If so, which ffmpeg version and config flags >> were used? >> >> >> > The ffmpeg application does not support DXVA2. > Other players like VLC should however be fine, if build with a proper > toolchain which includes the DXVA2 headers required (say mingw-w64) > > If the toolchain provides dxva2 headers, no config flags should be > required and support enabled automatically in avcodec. > > Note that Hi10p is not supported by hardware decoders. > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Mon Apr 22 16:10:31 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 16:10:31 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: > > You do realize that ffmpeg (the application) does not suport dxva2 ? > Sorry my bad - I meant libs, not the apps. Hopefully it's not the same story with the libs regarding dxva2. > > Other players like VLC should however be fine, if build with a proper toolchain which includes the DXVA2 headers required (say mingw-w64) > > If the toolchain provides dxva2 headers, no config flags should be required and support enabled automatically in avcodec. The toolchain for xbmc does but we don't get it to work that's why i was wondering about this patch: http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-March/139852.html. Aware of any apps that successfully utilizes dxva2 with current ffmpeg head (or 1.2)? -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Mon Apr 22 16:14:07 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Mon, 22 Apr 2013 16:14:07 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: On Mon, Apr 22, 2013 at 4:10 PM, Lars Hammarstrand < lars.hammarstrand at gmail.com> wrote: > > > > You do realize that ffmpeg (the application) does not suport dxva2 ? > > > > Sorry my bad - I meant libs, not the apps. Hopefully it's not the same > story with the libs regarding dxva2. > > > > > Other players like VLC should however be fine, if build with a proper > toolchain which includes the DXVA2 headers required (say mingw-w64) > > > > If the toolchain provides dxva2 headers, no config flags should be > required and support enabled automatically in avcodec. > > The toolchain for xbmc does but we don't get it to work that's why i was > wondering about this patch: > http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2013-March/139852.html. Aware > of any apps that successfully utilizes dxva2 with current ffmpeg head (or > 1.2)? > > VLC should work, and my set of DirectShow decoders also does ( http://code.google.com/p/lavfilters/) There was a bug a short while back which required you to pass --enable-dxva2 to configure because the auto-detection was faulty, but this was fixed in HEAD, and hopefully backported to 1.2 (not sure on this part). -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Apr 22 16:23:57 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 22 Apr 2013 14:23:57 +0000 (UTC) Subject: [Libav-user] Anybody got DXVA2 running? References: Message-ID: Hendrik Leppkes writes: > There was a bug a short while back which required > you to pass --enable-dxva2 to configure because the > auto-detection was faulty, but this was fixed in HEAD, > and hopefully backported to 1.2 (not sure on this part). This would have needed some advanced technology since the bug was reported after 1.2 was released. Carl Eugen From lars.hammarstrand at gmail.com Mon Apr 22 16:26:26 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 16:26:26 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: 2013/4/22 Hendrik Leppkes > > VLC should work, and my set of DirectShow decoders also does ( > http://code.google.com/p/lavfilters/) > > There was a bug a short while back which required you to pass > --enable-dxva2 to configure because the auto-detection was faulty, but this > was fixed in HEAD, and hopefully backported to 1.2 (not sure on this part). > > Ok, thanks. xbmc is on 1.2 and we're currently working on syncing it with ffmpeg head thus this might be the reason. Have you got a pointer to a version of the patch that went into head? -------------- next part -------------- An HTML attachment was scrubbed... URL: From h.leppkes at gmail.com Mon Apr 22 16:54:20 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Mon, 22 Apr 2013 16:54:20 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: On Mon, Apr 22, 2013 at 4:26 PM, Lars Hammarstrand < lars.hammarstrand at gmail.com> wrote: > 2013/4/22 Hendrik Leppkes > >> >> VLC should work, and my set of DirectShow decoders also does ( >> http://code.google.com/p/lavfilters/) >> >> There was a bug a short while back which required you to pass >> --enable-dxva2 to configure because the auto-detection was faulty, but this >> was fixed in HEAD, and hopefully backported to 1.2 (not sure on this part). >> >> > Ok, thanks. xbmc is on 1.2 and we're currently working on syncing it with > ffmpeg head thus this might be the reason. Have you got a pointer to a > version of the patch that went into head? > > http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2e2ec667416d8ed345491ac360fccc94e7a4772f It was backported to the 1.2 branch, but no release was made yet which includes it. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lars.hammarstrand at gmail.com Mon Apr 22 17:12:33 2013 From: lars.hammarstrand at gmail.com (Lars Hammarstrand) Date: Mon, 22 Apr 2013 17:12:33 +0200 Subject: [Libav-user] Anybody got DXVA2 running? In-Reply-To: References: Message-ID: 2013/4/22 Hendrik Leppkes > > > http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2e2ec667416d8ed345491ac360fccc94e7a4772f > > It was backported to the 1.2 branch, but no release was made yet which > includes it. > > Excellent, thank you very much! I'll backport it straight up to our 1.2 setup and hopefully it will solve the problem... -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Mon Apr 22 18:10:17 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Mon, 22 Apr 2013 16:10:17 +0000 (UTC) Subject: [Libav-user] Anybody got DXVA2 running? References: Message-ID: Hendrik Leppkes writes: > http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=2e2ec66 This cannot be a fix for the mentioned problem, Lars explained that he also tested git head. Carl Eugen From nhmenne42 at students.tntech.edu Tue Apr 23 16:21:39 2013 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Tue, 23 Apr 2013 10:21:39 -0400 Subject: [Libav-user] BGR24 to YUV pixel conversion Message-ID: I'm trying to convert a raw image that I receive as a unsigned character array. I then create (via avpicture_alloc) two AVPictures (one for the source and one for the destination). I then do an avpicture_fill for the input using the unsigned character array. The value returned by avpicture_fill matches the size of the original image. When I do the sws_scale, I get a printout saying "bad src image pointers" which comes from the check_image_pointers function in sws_scale. My question is this: How is this happening? I'm filling an allocated picture. Where is the disconnect? Thanks in advance, guys. -Neil P.S. here's the relevant snippet of code -------------- next part -------------- An HTML attachment was scrubbed... URL: From the1evilgenius at gmail.com Tue Apr 23 16:22:04 2013 From: the1evilgenius at gmail.com (Neil Menne) Date: Tue, 23 Apr 2013 10:22:04 -0400 Subject: [Libav-user] BGR24 to YUV pixel conversion In-Reply-To: References: Message-ID: //begin relevant code here mSwsContext = sws_getContext(input_width, input_height, input_pixel_format, output_width, output_height, output_pixel_format, SWS_BICUBIC, NULL, NULL, NULL); AVPicture input_picture; avpicture_alloc(&input_picture, input_pixel_format, //AV_PIX_FMT_BGR24 input_width, //656 input_height); //354 ret = avpicture_fill(&input_picture, data, input_pixel_format, input_width, input_height); AVPicture output_picture; avpicture_alloc(&output_picture, output_pixel_format, output_width, output_height); if (mSwsContext != NULL) { ret = sws_scale(mSwsContext, input_picture.data, input_picture.linesize, 0, input_height, output_picture.data, output_picture.linesize); //ret here is always 0 } //etc.... On Tue, Apr 23, 2013 at 10:21 AM, Neil Menne wrote: > I'm trying to convert a raw image that I receive as a unsigned character > array. I then create (via avpicture_alloc) two AVPictures (one for the > source and one for the destination). I then do an avpicture_fill for the > input using the unsigned character array. The value returned by > avpicture_fill matches the size of the original image. > > When I do the sws_scale, I get a printout saying "bad src image pointers" > which comes from the check_image_pointers function in sws_scale. My > question is this: How is this happening? I'm filling an allocated picture. > Where is the disconnect? > > Thanks in advance, guys. > > -Neil > > P.S. here's the relevant snippet of code > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nhmenne42 at students.tntech.edu Tue Apr 23 20:59:59 2013 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Tue, 23 Apr 2013 14:59:59 -0400 Subject: [Libav-user] BGR24 to YUV pixel conversion In-Reply-To: References: Message-ID: Nevermind all that previous nonsense. I misunderstood the intended use of avpicture_fill and that was the source of a great deal of my confusion. Now I can ask the right question: *How do I get the raw image buffer (located in a uint8_t array called data) into the AVFrame? * * * I've looked at the API a great deal today and yesterday, and I don't see a clear way to accomplish this. -Neil On Tue, Apr 23, 2013 at 10:22 AM, Neil Menne wrote: > //begin relevant code here > mSwsContext = sws_getContext(input_width, > input_height, > input_pixel_format, > output_width, > output_height, > output_pixel_format, > SWS_BICUBIC, > NULL, > NULL, > NULL); > > AVPicture input_picture; > avpicture_alloc(&input_picture, > input_pixel_format, //AV_PIX_FMT_BGR24 > input_width, //656 > input_height); //354 > > ret = avpicture_fill(&input_picture, > data, > input_pixel_format, > input_width, > input_height); > > AVPicture output_picture; > avpicture_alloc(&output_picture, > output_pixel_format, > output_width, > output_height); > > if (mSwsContext != NULL) > { > ret = sws_scale(mSwsContext, > input_picture.data, > input_picture.linesize, > 0, > input_height, > output_picture.data, > output_picture.linesize); > > //ret here is always 0 > } > > //etc.... > > > On Tue, Apr 23, 2013 at 10:21 AM, Neil Menne < > nhmenne42 at students.tntech.edu> wrote: > >> I'm trying to convert a raw image that I receive as a unsigned character >> array. I then create (via avpicture_alloc) two AVPictures (one for the >> source and one for the destination). I then do an avpicture_fill for the >> input using the unsigned character array. The value returned by >> avpicture_fill matches the size of the original image. >> >> When I do the sws_scale, I get a printout saying "bad src image pointers" >> which comes from the check_image_pointers function in sws_scale. My >> question is this: How is this happening? I'm filling an allocated picture. >> Where is the disconnect? >> >> Thanks in advance, guys. >> >> -Neil >> >> P.S. here's the relevant snippet of code >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nhmenne42 at students.tntech.edu Tue Apr 23 22:53:54 2013 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Tue, 23 Apr 2013 16:53:54 -0400 Subject: [Libav-user] avpicture_fill Message-ID: avpicture_fill is not filling in the linesize or data as expected. I could really use some help here. See the following: AVFrame *output_frame = avcodec_alloc_frame(); output_size = avpicture_get_size(AV_PIX_FMT_YUV420P, 640, 480); uint8_t *output_buffer = (uint8_t*)av_malloc(output_size); avpicture_fill((AVPicture*)output_frame, output_buffer, AV_PIX_FMT_YUV420P, 640, 480); ... later ... sws_scale(...); Outputs: [swscaler @ 0x912dd60] bad dst image pointers Thanks for your time! -Neil -------------- next part -------------- An HTML attachment was scrubbed... URL: From xuanyu.huang at gmail.com Wed Apr 24 06:43:17 2013 From: xuanyu.huang at gmail.com (=?GB2312?B?u8bQ+dPu?=) Date: Wed, 24 Apr 2013 14:43:17 +1000 Subject: [Libav-user] does ffmpeg/ffplay has any known issue with swf format? Message-ID: Hi Guys, I met a failure when calling av_seek_frame to seek into a swf file (function returned -1). While I tried to play this file with ffplay, it also reports an error when I seek to a position. Below is the output from ffprobe, and here is the video link https://dl.dropboxusercontent.com/u/89678527/big_buck_bunny.swf ffprobe version N-50025-gb8bb661 Copyright (c) 2007-2013 the FFmpeg developers built on Feb 17 2013 02:37:45 with gcc 4.7.2 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 52. 17.101 / 52. 17.101 libavcodec 54. 91.103 / 54. 91.103 libavformat 54. 63.100 / 54. 63.100 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 38.100 / 3. 38.100 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 [swf @ 02dc4300] max_analyze_duration 5000000 reached at 5008151 microseconds [swf @ 02dc4300] Estimating duration from bitrate, this may be inaccurate Input #0, swf, from 'big_buck_bunny.swf': Duration: 00:06:30.11, start: 0.000000, bitrate: 47 kb/s Stream #0:0: Audio: mp3, 22050 Hz, stereo, s16p, 48 kb/s Stream #0:1: Video: flv1, yuv420p, 640x360, 23.98 fps, 47.92 tbr, 23.96 tbn Can anyone take a look at it? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: From bjoern.drabeck at gmail.com Wed Apr 24 07:14:11 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Wed, 24 Apr 2013 13:14:11 +0800 Subject: [Libav-user] avpicture_fill In-Reply-To: References: Message-ID: avpicture_fill is not filling in the linesize or data as expected. I could > really use some help here. > > See the following: > > AVFrame *output_frame = avcodec_alloc_frame(); > > output_size = avpicture_get_size(AV_PIX_FMT_YUV420P, > 640, > 480); > > uint8_t *output_buffer = (uint8_t*)av_malloc(output_size); > > avpicture_fill((AVPicture*)output_frame, > output_buffer, > AV_PIX_FMT_YUV420P, > 640, > 480); > > ... later ... > > sws_scale(...); > > Outputs: [swscaler @ 0x912dd60] bad dst image pointers > > Thanks for your time! > -Neil > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > Hi, have you tried to call avpicture_alloc(&outPic, m_codecCtxOut->pix_fmt, m_codecCtxOut->width, m_codecCtxOut->height) That should set the data[] and linesize[] fields, and allocate the memory accordingly, afaik. -Bjoern -------------- next part -------------- An HTML attachment was scrubbed... URL: From pixar.basim at gmail.com Wed Apr 24 09:34:39 2013 From: pixar.basim at gmail.com (Basim Ahmad) Date: Wed, 24 Apr 2013 13:04:39 +0530 Subject: [Libav-user] recording screen activity with audio on android phone Message-ID: Hey all, i have been working on an android application that records screen activity of the phone along with user's speech. The video is working fine while the audio is very noisy and giving a metallic sound. The code snippet for performing the writing of audio frame by frame :- static void write_audio_frame(AVFormatContext *oc, AVStream *st) { AVCodecContext *c; AVFrame *frame = avcodec_alloc_frame(); AVPacket pkt = { 0 }; // data and size must be 0; int got_packet, ret; av_init_packet(&pkt); c = st->codec; // get_audio_frame(samples, audio_input_frame_size, c->channels); frame->nb_samples = audio_input_frame_size; avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, (uint8_t *) samples, audio_input_frame_size * av_get_bytes_per_sample(c->sample_fmt) * c->channels, 1); ret = avcodec_encode_audio2(c, &pkt, frame, &got_packet); if (ret < 0) { LOGE(3, "Error encoding audio frame: %s\n", av_err2str(ret)); return; } if (!got_packet) return; pkt.stream_index = st->index; /* Write the compressed frame to the media file. */ ret = av_interleaved_write_frame(oc, &pkt); if (ret != 0) { LOGE(3, "Error while writing audio frame: %s\n", av_err2str(ret)); return; } av_free(frame); } Any guidance will be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmendia at engineea.com Wed Apr 24 09:39:02 2013 From: mmendia at engineea.com (mmendia) Date: Wed, 24 Apr 2013 09:39:02 +0200 Subject: [Libav-user] Memory leaks with the function avformat_new_stream In-Reply-To: <51778A8C.5070602@engineea.com> References: <51778A8C.5070602@engineea.com> Message-ID: <51778C16.5030705@engineea.com> Hi all, First of all, I am new to this mailing list, so hi everybody. I want to make a program that mixes some packets of a couple of .ts files, the program runs ok but valgrind detects some memory leaks and two of them are quite big (23,288 bytes) and I do not know what to do. I think i understand quite well what I am doing (use the right functions at the right moment), and after having looked at it a lot I can not figure out what is wrong. This is Valgrinds ouptut: ==11908== Memcheck, a memory error detector ==11908== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==11908== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==11908== Command: ./CopyTsToTs hola-3.ts salida.ts ==11908== [mpegts @ 0x4278060] max_analyze_duration 5000000 reached at 5013600 Input #0, mpegts, from 'hola-3.ts': Duration: 00:00:12.07, start: 25.688000, bitrate: 799 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, s16, 86 kb/s Output #0, mpegts, to 'salida.ts': Stream #0:0: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 640x360, q=2-31, 90k tbn, 25 tbc Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, 86 kb/s [mpegts @ 0x48348a0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts ==11908== ==11908== HEAP SUMMARY: ==11908== in use at exit: 46,622 bytes in 7 blocks ==11908== total heap usage: 5,751 allocs, 5,744 frees, 9,552,334 bytes allocated ==11908== ==11908== 8 bytes in 1 blocks are indirectly lost in loss record 1 of 7 ==11908== at 0x402BE68: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402C007: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86D3B07: av_dict_set (dict.c:82) ==11908== by 0x81232CA: avformat_write_header (utils.c:3446) ==11908== by 0x804AE75: CopyTsPacketByPacket (CopyTsToTs.c:258) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 8 bytes in 1 blocks are indirectly lost in loss record 2 of 7 ==11908== at 0x402A420: memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402A4DE: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86DADEF: av_strdup (mem.c:95) ==11908== by 0x86D3AC6: av_dict_set (dict.c:92) ==11908== by 0x81232CA: avformat_write_header (utils.c:3446) ==11908== by 0x804AE75: CopyTsPacketByPacket (CopyTsToTs.c:258) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 8 bytes in 1 blocks are definitely lost in loss record 3 of 7 ==11908== at 0x402BF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x812594E: avformat_new_stream (utils.c:3147) ==11908== by 0x804AA66: add_output_stream (CopyTsToTs.c:82) ==11908== by 0x804AFAF: CopyTsPacketByPacket (CopyTsToTs.c:242) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 14 bytes in 1 blocks are indirectly lost in loss record 4 of 7 ==11908== at 0x402A420: memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402A4DE: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86DADEF: av_strdup (mem.c:95) ==11908== by 0x86D3A35: av_dict_set (dict.c:102) ==11908== by 0x81232CA: avformat_write_header (utils.c:3446) ==11908== by 0x804AE75: CopyTsPacketByPacket (CopyTsToTs.c:258) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 38 (8 direct, 30 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 7 ==11908== at 0x402A420: memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402A4DE: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86DACAF: av_mallocz (mem.c:95) ==11908== by 0x86D3ADB: av_dict_set (dict.c:70) ==11908== by 0x81232CA: avformat_write_header (utils.c:3446) ==11908== by 0x804AE75: CopyTsPacketByPacket (CopyTsToTs.c:258) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 23,288 bytes in 1 blocks are definitely lost in loss record 6 of 7 ==11908== at 0x402A420: memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402A4DE: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86DACAF: av_mallocz (mem.c:95) ==11908== by 0x812597B: avformat_new_stream (utils.c:3155) ==11908== by 0x804AA66: add_output_stream (CopyTsToTs.c:82) ==11908== by 0x804ADD7: CopyTsPacketByPacket (CopyTsToTs.c:237) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== 23,288 bytes in 1 blocks are definitely lost in loss record 7 of 7 ==11908== at 0x402A420: memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x402A4DE: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==11908== by 0x86DACAF: av_mallocz (mem.c:95) ==11908== by 0x812597B: avformat_new_stream (utils.c:3155) ==11908== by 0x804AA66: add_output_stream (CopyTsToTs.c:82) ==11908== by 0x804AFAF: CopyTsPacketByPacket (CopyTsToTs.c:242) ==11908== by 0x804B2BC: main (CopyTsToTs.c:44) ==11908== ==11908== LEAK SUMMARY: ==11908== definitely lost: 46,592 bytes in 4 blocks ==11908== indirectly lost: 30 bytes in 3 blocks ==11908== possibly lost: 0 bytes in 0 blocks ==11908== still reachable: 0 bytes in 0 blocks ==11908== suppressed: 0 bytes in 0 blocks ==11908== ==11908== For counts of detected and suppressed errors, rerun with: -v ==11908== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0) I attach a source code that just copyes a .ts file into other .ts file packet by packet. The compilation, valgrind and mtrace instructions are on it. I also attach a little .ts file. It looks like it misses some reference... Thank you in advance! Miguel -------------- next part -------------- A non-text attachment was scrubbed... Name: CopyTsToTs.c Type: text/x-csrc Size: 10700 bytes Desc: not available URL: From praks411 at gmail.com Wed Apr 24 13:21:54 2013 From: praks411 at gmail.com (Pradeep Karosiya) Date: Wed, 24 Apr 2013 04:21:54 -0700 (PDT) Subject: [Libav-user] Audio quality loss while encoding Message-ID: <1366802514683-4657364.post@n4.nabble.com> Hi I'm trying to encode decoded audio sample to an avi file. The audio samples are decoded from different file. So I've both input and output file. The decoded audio samples are in AV_SAMPLE_FMT_FLTP (float planar) in one large buffer. The first half contains channel 0 while second half of buffer contains channel 1. I'm passing these decoded sample as it is without any conversion for encoding. The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm getting some noise is the final audio output. The quality is getting degraded. However if the number of channels is 1 then I'm getting same quality as the input file The audio parameter which are used for encoding (mostly same as decoding). Sample Rate = 44100, Num of Channels = 1/2, Sample Format = float planar (AV_SAMPLE_FMT_FLTP), Bit Rate = 128000 (set by me not sure what to take), codec_id = AV_CODEC_ID_AAC. Audio encoding api : avcodec_encode_audio2 Please let me what could be going wrong. Thanks Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-quality-loss-while-encoding-tp4657364.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Wed Apr 24 13:53:47 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 24 Apr 2013 11:53:47 +0000 (UTC) Subject: [Libav-user] Audio quality loss while encoding References: <1366802514683-4657364.post@n4.nabble.com> Message-ID: Pradeep Karosiya writes: > Bit Rate = 128000 (set by me not sure what to take) Did you test with a higher value? Also with a significantly higher value? Did you test with ffmpeg (the application)? Carl Eugen From onemda at gmail.com Wed Apr 24 14:05:22 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 12:05:22 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <1366802514683-4657364.post@n4.nabble.com> References: <1366802514683-4657364.post@n4.nabble.com> Message-ID: On 4/24/13, Pradeep Karosiya wrote: > Hi > I'm trying to encode decoded audio sample to an avi file. The audio samples > are decoded from different file. So I've both input and output file. The > decoded audio samples are in AV_SAMPLE_FMT_FLTP (float planar) in one large > buffer. The first half contains channel 0 while second half of buffer They are not in one large buffer. They are in two separate buffers. > contains channel 1. I'm passing these decoded sample as it is without any > conversion for encoding. > The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm > getting > some noise is the final audio output. The quality is getting degraded. > However if the number of channels is 1 then I'm getting same quality as the > input file > > The audio parameter which are used for encoding (mostly same as decoding). > Sample Rate = 44100, Num of Channels = 1/2, Sample Format = float planar > (AV_SAMPLE_FMT_FLTP), > Bit Rate = 128000 (set by me not sure what to take), codec_id = > AV_CODEC_ID_AAC. > > Audio encoding api : avcodec_encode_audio2 > > Please let me what could be going wrong. > > Thanks > Pradeep > > > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/Audio-quality-loss-while-encoding-tp4657364.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 > From praks411 at gmail.com Wed Apr 24 14:05:50 2013 From: praks411 at gmail.com (Pradeep Karosiya) Date: Wed, 24 Apr 2013 05:05:50 -0700 (PDT) Subject: [Libav-user] AAC with FLV In-Reply-To: <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> Message-ID: <1366805150614-4657367.post@n4.nabble.com> Hi Brad, Have you found the solution to your issueof audio distortion. I'm also facing a similar issue while encoding with AAC and this is happening for same audio parameters sample rate: 44100, sample format: AV_SAMPLE_FMT_FLTP and number of channels = 2. For mono it is working fine. So I guess the problem could be with planar data. Please let share with me. Thanks Pradeep -- View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-AAC-with-FLV-tp4657298p4657367.html Sent from the libav-users mailing list archive at Nabble.com. From praks411 at gmail.com Wed Apr 24 15:24:51 2013 From: praks411 at gmail.com (Pradeep Karosiya) Date: Wed, 24 Apr 2013 06:24:51 -0700 (PDT) Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> Message-ID: <1366809891405-4657368.post@n4.nabble.com> I also tried with 400000 however the voice is bit clear but whenever music comes it is distorted. With ffmpeg application it is working fine the output is same as input in quality. So I guess I'm missing something. Also the quality is good for mono but stereo is bit distorted. Another thing which I want to share is that I'm getting decoded audio sample from ffms2 (aka ffmpegsource). Here is the snippet of code which is give decoded audio. Since decoded audio is already in AV_SAMPLE_FMT_FLTP, I'm just passing them as it is to encoder with doing any kind to conversion. The decoded samples are set in m_audio_sample (buffer class), then total sample length is set in byte based on bytes_per_sample and num_channel. Note that ffms2 gives the decoded samples in one large buffer for both planar and non-planar format. if(m_audio_set && (m_finished_aud_enc == false)) { m_audio_mux_sample->ResetSampleValue(); int dres = GetDecodedAudioSamples(m_audio_mux_sample->GetAudioSampleData(), audio_start_pos, num_request); if(num_request < 1536) { sample_len = 1536; } else { sample_len = num_request; } m_audio_mux_sample->SetAudioSampleLen( num_request*m_audio_specs->byte_per_sample*m_audio_specs->num_channels); audio_start_pos += num_request; num_samples_rem -= num_request; if(num_samples_rem <= 0) { num_samples_rem = 0; num_request = 0; m_finished_aud_enc = true; } else { num_request = (num_samples_rem < aud_frame_req)?num_samples_rem:aud_frame_req; if(audio_start_pos >= m_audio_specs->total_samples_audio -1) { audio_start_pos = 0; } } } } Do I need to take care memory alignment while allocating buffer in buffer class (m_audio_mux_sample). -- View this message in context: http://libav-users.943685.n4.nabble.com/Audio-quality-loss-while-encoding-tp4657364p4657368.html Sent from the libav-users mailing list archive at Nabble.com. From Steffen.Roeber at hella.com Wed Apr 24 15:38:51 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Wed, 24 Apr 2013 06:38:51 -0700 (PDT) Subject: [Libav-user] writing .avi with rawvideo and rgb data Message-ID: <1366810731983-4657369.post@n4.nabble.com> I'm trying to write an uncompressed .avi with pixel format rgb24. This fails: static void video_encode_example_init(const cImg &i_img) { oc = avformat_alloc_context(); oc->oformat = av_guess_format("rawvideo", nullptr, nullptr); oc->oformat->video_codec = AV_CODEC_ID_RAWVIDEO; codec = avcodec_find_encoder(oc->oformat->video_codec); oc->streams[0] = avformat_new_stream(oc, codec); avcodec_get_context_defaults3(oc->streams[0]->codec, codec); oc->streams[0]->codec->codec_id = codec->id; oc->streams[0]->codec->codec_type = codec->type; oc->streams[0]->codec->width = i_img.getWidth(); oc->streams[0]->codec->height = i_img.getHeight(); oc->streams[0]->codec->time_base.num = 1; oc->streams[0]->codec->time_base.den = 25; oc->streams[0]->codec->pix_fmt = codec->pix_fmts[0]; int res = avcodec_open2(oc->streams[0]->codec, codec, NULL); res = avio_open2(&oc->pb, "d:/temp/test.avi", AVIO_FLAG_WRITE, 0, 0); // oc->streams[0]->codec->codec_tag = 0; //if I comment this line write header works. res = avformat_write_header(oc, 0); //this gives me an error It seems that the avi encoder does not support rgb24 or rgb32 pixel types. So what 's the preffered way? -- View this message in context: http://libav-users.943685.n4.nabble.com/writing-avi-with-rawvideo-and-rgb-data-tp4657369.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Wed Apr 24 16:09:17 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Wed, 24 Apr 2013 14:09:17 +0000 (UTC) Subject: [Libav-user] writing .avi with rawvideo and rgb data References: <1366810731983-4657369.post@n4.nabble.com> Message-ID: Steffen writes: > It seems that the avi encoder does not support > rgb24 or rgb32 pixel types. avi only supports bgr24 and bgra, this is not a limitation of FFmpeg. Carl Eugen From klaussfreire at gmail.com Wed Apr 24 17:30:44 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Wed, 24 Apr 2013 12:30:44 -0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <1366802514683-4657364.post@n4.nabble.com> References: <1366802514683-4657364.post@n4.nabble.com> Message-ID: On Wed, Apr 24, 2013 at 8:21 AM, Pradeep Karosiya wrote: > The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm getting > some noise is the final audio output. The quality is getting degraded. > However if the number of channels is 1 then I'm getting same quality as the > input file I also experienced this when encoding AAC, so I stopped using AAC. I'm not using the very latest ffmpeg, so I didn't bother reporting the issue, and it's been on my To-Do to check the latest version for a while. Been busy and all. Anyway, I thought I'd say "me too", and add that it does seem related to the AAC encoder, because it only happens with AAC. It's not so much noise, as "clicks". Probably some buffer alignment mishap. From bjoern.drabeck at gmail.com Wed Apr 24 17:54:56 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Wed, 24 Apr 2013 23:54:56 +0800 Subject: [Libav-user] Issues when playing files from http Message-ID: Hi, in my player I want to play back files that are located online (usually mp4 files provided from some server or CDN (http)), which generally works fine, however I have two issues that I need to address, but am not quite sure about: 1. when I pause the file for several minutes then continue later it seems ffmpeg's connection times out and the next call into av_read_frame returns an error. My code is (currently) still the same that I use for local playback, so I was wondering what would be required to change in order to affect that. Is there a way to tell it to keep the connection alive? Or do I have to make sure in my player that at least at a regular interval I keep reading another packet with av_read_frame, and stuffing it into a buffer? (Normally when I pause I keep reading packets until the packet queues are full, then the next av_read_frame will only happen after some packets have been taken out for processing). 2. sometimes playback can be a bit jerky, esp for example when I seek somewhere into the stream, and I am on a slower connection, then even though I wait until I have a few frames ready before continuing playback, however it still seems that I am rendering them faster than I can get them from the stream. Is there some way of knowing when enough data is ready for me to continue playback? (I mean inside the ffmpeg libraries, or some callbacks I can set or flags to monitor or sth) Or do I have to write my own logic to see of the rate of consumption is bigger than the rate I can get the packets out of the stream? Are there any recommended practices or guidelines or documents on how to handle that? Mostly the code that I use for local playback works fine for online as well, just the pausing issue is really troublesome, and the buffering behavior on slower connections. thanks and best regards, Bjoern -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Wed Apr 24 19:25:52 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 10:25:52 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: <1366805150614-4657367.post@n4.nabble.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> Message-ID: <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> On Apr 24, 2013, at 5:05 AM, Pradeep Karosiya wrote: > Hi Brad, > > Have you found the solution to your issueof audio distortion. I'm also > facing a similar issue while encoding with AAC and this is happening for > same audio parameters sample rate: 44100, sample format: AV_SAMPLE_FMT_FLTP > and number of channels = 2. For mono it is working fine. So I guess the > problem could be with planar data. Please let share with me. Pradeep -- thanks so much for your reply! Given the hair-pulling (what little I have of it to pull) required thus far with this problem, it is encouraging to know there's someone else to validate the difficulties I am experiencing (so I have a fighting chance of still being semi-sane!) To answer your question, no, I have not figured this out yet. As you may have gathered from my posts on this topic, I have taken a working codebase and simply changed the destination sample format for resampling (from AV_SAMPLE_FMT_S16 to AV_SAMPLE_FMT_FLTP) and the codec in play (ADPCM_SWF to AAC), and audio went from perfect to garbage. That garbage became understandable audio with distortion simply by changing the destination sample rate from 44100 (which is the same as the source sample rate) to 96000, which is completely confusing to me. Another poster astutely recommended to reexamine all assumptions and understand that the changes above constitute a "different situation", but in acknowledging that, it is important to note what is *not* different: the entire handling pipeline. There is absolutely zero data byte value manipulation taking place in my code -- I am merely feeding data I have to FFmpeg data / array filling, resampling, and encoding functions. The parts I'm changing are merely settings, which leads me to two possibilities I'm testing at this point: 1. My code (specifically data array pointers on the captured samples) wasn't right to begin with, which would seem a little strange, given that it was producing perfect video / audio encoding with other settings / codec. If I had passed bad pointers or array structure / layout / population I would have expected any format to blow up. 2. There is some issue in FFmpeg -- and you are right, the glaring difference in use case here was going from a non-planar destination to a planar destination. This was even more confusing for me, because my captured format was planar -- so as a test I skipped resampling entirely and passed the encoder my source data array (which should have been in the exact format as the destination array once resampled), and it blew up. I do believe there's an issue that revolves around the fact the destination format is planar. I mean, my original stab at this resampled from a source array with the same channel layout, sample format, and sample rate as the destination -- the encoder can take the destination fine, but blows up if I pass it the source (again, should be no different from the resampled destination) -- how weird is that? This would seem to be a fair indication that, to quote the Princess Bride movie, "I do not think it means what you think it means", with respect to the source data array. But it sure seems weird that if I were handling the source data array improperly, that it wouldn't have blown up before and that I'd be able to get perfect audio from it using another sample format...so I'm still allowing for the possibility that swr_convert doesn't like source and destination with identical sample formats for some reason. I'll keep you posted. One other thing I've been looking into are the "align" parameters on a number of these functions. They aren't documented very well, and there appears to be more than one way to interpret alignment and the parameter values, so if someone could expound on that further, I'd appreciate it. Thanks, Brad From onemda at gmail.com Wed Apr 24 19:38:57 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 17:38:57 +0000 Subject: [Libav-user] AAC with FLV In-Reply-To: <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 5:05 AM, Pradeep Karosiya wrote: > >> Hi Brad, >> >> Have you found the solution to your issueof audio distortion. I'm also >> facing a similar issue while encoding with AAC and this is happening for >> same audio parameters sample rate: 44100, sample format: >> AV_SAMPLE_FMT_FLTP >> and number of channels = 2. For mono it is working fine. So I guess the >> problem could be with planar data. Please let share with me. > > Pradeep -- thanks so much for your reply! Given the hair-pulling (what > little I have of it to pull) required thus far with this problem, it is > encouraging to know there's someone else to validate the difficulties I am > experiencing (so I have a fighting chance of still being semi-sane!) > > To answer your question, no, I have not figured this out yet. As you may > have gathered from my posts on this topic, I have taken a working codebase > and simply changed the destination sample format for resampling (from > AV_SAMPLE_FMT_S16 to AV_SAMPLE_FMT_FLTP) and the codec in play (ADPCM_SWF to > AAC), and audio went from perfect to garbage. That garbage became > understandable audio with distortion simply by changing the destination > sample rate from 44100 (which is the same as the source sample rate) to > 96000, which is completely confusing to me. > > Another poster astutely recommended to reexamine all assumptions and > understand that the changes above constitute a "different situation", but in > acknowledging that, it is important to note what is *not* different: the > entire handling pipeline. There is absolutely zero data byte value > manipulation taking place in my code -- I am merely feeding data I have to > FFmpeg data / array filling, resampling, and encoding functions. The parts > I'm changing are merely settings, which leads me to two possibilities I'm > testing at this point: > > 1. My code (specifically data array pointers on the captured samples) wasn't > right to begin with, which would seem a little strange, given that it was > producing perfect video / audio encoding with other settings / codec. If I > had passed bad pointers or array structure / layout / population I would > have expected any format to blow up. > > 2. There is some issue in FFmpeg -- and you are right, the glaring > difference in use case here was going from a non-planar destination to a > planar destination. This was even more confusing for me, because my captured > format was planar -- so as a test I skipped resampling entirely and passed > the encoder my source data array (which should have been in the exact format > as the destination array once resampled), and it blew up. I do believe > there's an issue that revolves around the fact the destination format is > planar. I mean, my original stab at this resampled from a source array with > the same channel layout, sample format, and sample rate as the destination > -- the encoder can take the destination fine, but blows up if I pass it the > source (again, should be no different from the resampled destination) -- how > weird is that? This would seem to be a fair indication that, to quote the > Princess Bride movie, "I do not think it means what you think it means", > with respect to the sourc > e data array. But it sure seems weird that if I were handling the source > data array improperly, that it wouldn't have blown up before and that I'd be > able to get perfect audio from it using another sample format...so I'm still > allowing for the possibility that swr_convert doesn't like source and > destination with identical sample formats for some reason. > > I'll keep you posted. One other thing I've been looking into are the "align" > parameters on a number of these functions. They aren't documented very well, > and there appears to be more than one way to interpret alignment and the > parameter values, so if someone could expound on that further, I'd > appreciate it. Stop this nonsense trollfest. There is no bug in ffmpeg. Planare sample format store each channel samples in separate buffer. You can not access them with single pointer. > > Thanks, > > Brad > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Wed Apr 24 19:43:42 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 10:43:42 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> Message-ID: <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> On Apr 24, 2013, at 8:30 AM, Claudio Freire wrote: > On Wed, Apr 24, 2013 at 8:21 AM, Pradeep Karosiya wrote: >> The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm getting >> some noise is the final audio output. The quality is getting degraded. >> However if the number of channels is 1 then I'm getting same quality as the >> input file > > > I also experienced this when encoding AAC, so I stopped using AAC. > > I'm not using the very latest ffmpeg, so I didn't bother reporting the > issue, and it's been on my To-Do to check the latest version for a > while. Been busy and all. Anyway, I thought I'd say "me too", and add > that it does seem related to the AAC encoder, because it only happens > with AAC. This seems like some level of vindication / relief for this mortal -- as is probably apparent from my other thread, this is the exact problem I am having too. I am heavily suspecting weirdness in either resampling, or the nature of the expected data buffer to the encoder -- that's actually contained within a frame, so the data filling occurs within this function call: avcodec_fill_audio_frame(_streamAudioFrame, _streamAudioFrame->channels, _streamAudioFrame->format, (const uint8_t *)destinationData[0], bufferSize, 0); To revisit this, my destinationData variable is declared as: uint8_t **destinationData = NULL; It is populated with data from resampling as in: returnVal = swr_convert(resamplerCtx, destinationData, destinationNumberOfSamples, (const uint8_t **)sourceData, sourceNumberOfSamples); from a source data array declared similarly as: uint8_t **sourceData = NULL; My questions revolve around this parameter in the avcodec_fill_audio_frame function: (const uint8_t *)destinationData[0], 1. Is that the proper pointer to be passing? It works (to the degree that the return code is success). I've tried sending: (const uint8_t *)destinationData, and (const uint8_t *)&destinationData, and (const uint8_t *)&destinationData[0], and all three of those blow up. I wouldn't otherwise doubt the original line (as it produced good audio with another sample format), but I've got little in the equation here that can be changed, so I'm reconsidering everything. 2. For planar data, what exactly is the expected structure of the data array? is it: data[0] -> plane 1 data[1] -> plane 2 or is it data[0] -> plane 1 data[0 + plane_size] -> plane 2 or something else? Thanks, Brad From onemda at gmail.com Wed Apr 24 19:57:00 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 17:57:00 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 8:30 AM, Claudio Freire wrote: > >> On Wed, Apr 24, 2013 at 8:21 AM, Pradeep Karosiya >> wrote: >>> The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm >>> getting >>> some noise is the final audio output. The quality is getting degraded. >>> However if the number of channels is 1 then I'm getting same quality as >>> the >>> input file >> >> >> I also experienced this when encoding AAC, so I stopped using AAC. >> >> I'm not using the very latest ffmpeg, so I didn't bother reporting the >> issue, and it's been on my To-Do to check the latest version for a >> while. Been busy and all. Anyway, I thought I'd say "me too", and add >> that it does seem related to the AAC encoder, because it only happens >> with AAC. > > This seems like some level of vindication / relief for this mortal -- as is > probably apparent from my other thread, this is the exact problem I am > having too. I am heavily suspecting weirdness in either resampling, or the > nature of the expected data buffer to the encoder -- that's actually > contained within a frame, so the data filling occurs within this function > call: > > avcodec_fill_audio_frame(_streamAudioFrame, > > _streamAudioFrame->channels, > > _streamAudioFrame->format, > (const uint8_t > *)destinationData[0], > bufferSize, > 0); > > To revisit this, my destinationData variable is declared as: > > uint8_t **destinationData = NULL; > > It is populated with data from resampling as in: > > returnVal = swr_convert(resamplerCtx, > destinationData, > destinationNumberOfSamples, > (const uint8_t **)sourceData, > sourceNumberOfSamples); > > from a source data array declared similarly as: > > uint8_t **sourceData = NULL; > > My questions revolve around this parameter in the avcodec_fill_audio_frame > function: > > (const uint8_t *)destinationData[0], > > 1. Is that the proper pointer to be passing? It works (to the degree that > the return code is success). I've tried sending: > > (const uint8_t *)destinationData, > > and > > (const uint8_t *)&destinationData, > > and > > (const uint8_t *)&destinationData[0], > > and all three of those blow up. I wouldn't otherwise doubt the original line > (as it produced good audio with another sample format), but I've got little > in the equation here that can be changed, so I'm reconsidering everything. > > 2. For planar data, what exactly is the expected structure of the data > array? > > is it: > > data[0] -> plane 1 > data[1] -> plane 2 For planar sample format, each channel is in separate array: channel left = data[0] channel right = data[1] If you use more than 8 channels, use extended_data instead. From brado at bighillsoftware.com Wed Apr 24 19:58:20 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 10:58:20 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> Message-ID: <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> On Apr 24, 2013, at 10:38 AM, Paul B Mahol wrote: > Stop this nonsense trollfest. There is no bug in ffmpeg. This is simple problem solving, no trolling. As another poster advised, rechecking assumptions. All along I have treated FFmpeg as a black-box, and my assumption all along has been that there were no bugs anywhere but in my code. I've done what I can to this point -- even posted a fully working app with source code up to Github for help. So please don't take offense at the logical process of deduction. And given that there's now another thread with others reporting the same problem, I don't think it is either out of line or an infringement on anyone's turf to simply raise the question of whether it is possible or not. > > Planare sample format store each channel samples in separate buffer. > You can not access them with single pointer. Well....I get what you are saying, but you might not be understanding what those not in the know may be asking -- frame filling and by extension the encoder *does* access these via a single pointer. avcodec_fill_audio_frame(_streamAudioFrame, _streamAudioFrame->channels, _streamAudioFrame->format, (const uint8_t *)destinationData[0], bufferSize, 0); ...i.e. the fourth parameter, the data parameter. We may just be somewhat parsing semantics, so we may actually be saying the same thing. But if not, that's the difference in things working / not. And again, you've now got others in another thread reporting similar problems, one abandoning the AAC encoder entirely. Keep in mind, this entire inquiry derives from a desire to use FFmpeg...even posting code to help others use it. So please don't take honest questions as an issue of turf. They are no more personal as are nuts and bolts...it's all just machinery. Thanks, Brad From alexcohn at netvision.net.il Wed Apr 24 20:04:27 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Wed, 24 Apr 2013 21:04:27 +0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On 24 Apr 2013 20:57, "Paul B Mahol" wrote: > > On 4/24/13, Brad O'Hearne wrote: > > On Apr 24, 2013, at 8:30 AM, Claudio Freire wrote: > > > >> On Wed, Apr 24, 2013 at 8:21 AM, Pradeep Karosiya > >> wrote: > >>> The codec id used is AV_CODEC_ID_AAC. The encoding goes fine but I'm > >>> getting > >>> some noise is the final audio output. The quality is getting degraded. > >>> However if the number of channels is 1 then I'm getting same quality as > >>> the > >>> input file > >> > >> > >> I also experienced this when encoding AAC, so I stopped using AAC. > >> > >> I'm not using the very latest ffmpeg, so I didn't bother reporting the > >> issue, and it's been on my To-Do to check the latest version for a > >> while. Been busy and all. Anyway, I thought I'd say "me too", and add > >> that it does seem related to the AAC encoder, because it only happens > >> with AAC. > > > > This seems like some level of vindication / relief for this mortal -- as is > > probably apparent from my other thread, this is the exact problem I am > > having too. I am heavily suspecting weirdness in either resampling, or the > > nature of the expected data buffer to the encoder -- that's actually > > contained within a frame, so the data filling occurs within this function > > call: > > > > avcodec_fill_audio_frame(_streamAudioFrame, > > > > _streamAudioFrame->channels, > > > > _streamAudioFrame->format, > > (const uint8_t > > *)destinationData[0], > > bufferSize, > > 0); > > > > To revisit this, my destinationData variable is declared as: > > > > uint8_t **destinationData = NULL; > > > > It is populated with data from resampling as in: > > > > returnVal = swr_convert(resamplerCtx, > > destinationData, > > destinationNumberOfSamples, > > (const uint8_t **)sourceData, > > sourceNumberOfSamples); > > > > from a source data array declared similarly as: > > > > uint8_t **sourceData = NULL; > > > > My questions revolve around this parameter in the avcodec_fill_audio_frame > > function: > > > > (const uint8_t *)destinationData[0], > > > > 1. Is that the proper pointer to be passing? It works (to the degree that > > the return code is success). I've tried sending: > > > > (const uint8_t *)destinationData, > > > > and > > > > (const uint8_t *)&destinationData, > > > > and > > > > (const uint8_t *)&destinationData[0], > > > > and all three of those blow up. I wouldn't otherwise doubt the original line > > (as it produced good audio with another sample format), but I've got little > > in the equation here that can be changed, so I'm reconsidering everything. > > > > 2. For planar data, what exactly is the expected structure of the data > > array? > > > > is it: > > > > data[0] -> plane 1 > > data[1] -> plane 2 > > For planar sample format, each channel is in separate array: > > channel left = data[0] > channel right = data[1] > > If you use more than 8 channels, use extended_data instead. And to set data[1]=data[0] + plane_size; is most likely not enough because both data[0] and data[1] must be aligned. -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Wed Apr 24 20:05:53 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 11:05:53 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: <058C963B-7C8D-4CFB-A05E-50CF594291FD@bighillsoftware.com> On Apr 24, 2013, at 10:57 AM, Paul B Mahol wrote: > For planar sample format, each channel is in separate array: > > channel left = data[0] > channel right = data[1] > > If you use more than 8 channels, use extended_data instead. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user Paul -- thx for the reply. Fair enough on the above -- so as a contrast to this structure, what does the data array look like for a non-planar format with two channels? Brad From onemda at gmail.com Wed Apr 24 20:13:31 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 18:13:31 +0000 Subject: [Libav-user] AAC with FLV In-Reply-To: <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 10:38 AM, Paul B Mahol wrote: >> Stop this nonsense trollfest. There is no bug in ffmpeg. > > This is simple problem solving, no trolling. As another poster advised, > rechecking assumptions. All along I have treated FFmpeg as a black-box, and > my assumption all along has been that there were no bugs anywhere but in my > code. I've done what I can to this point -- even posted a fully working app > with source code up to Github for help. So please don't take offense at the > logical process of deduction. And given that there's now another thread with > others reporting the same problem, I don't think it is either out of line or > an infringement on anyone's turf to simply raise the question of whether it > is possible or not. > >> >> Planare sample format store each channel samples in separate buffer. >> You can not access them with single pointer. > > Well....I get what you are saying, but you might not be understanding what > those not in the know may be asking -- frame filling and by extension the > encoder *does* access these via a single pointer. > > avcodec_fill_audio_frame(_streamAudioFrame, > > _streamAudioFrame->channels, > > _streamAudioFrame->format, > (const uint8_t > *)destinationData[0], > bufferSize, > 0); > > ...i.e. the fourth parameter, the data parameter. We may just be somewhat > parsing semantics, so we may actually be saying the same thing. But if not, > that's the difference in things working / not. And again, you've now got > others in another thread reporting similar problems, one abandoning the AAC > encoder entirely. That have nothing relevant to "issue" you are reporting. > > Keep in mind, this entire inquiry derives from a desire to use FFmpeg...even > posting code to help others use it. So please don't take honest questions as > an issue of turf. They are no more personal as are nuts and bolts...it's all > just machinery. You are still trolling. I lost 16 minutes reading you too long spam. > > Thanks, > > Brad > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From onemda at gmail.com Wed Apr 24 20:15:49 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 18:15:49 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <058C963B-7C8D-4CFB-A05E-50CF594291FD@bighillsoftware.com> References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <058C963B-7C8D-4CFB-A05E-50CF594291FD@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 10:57 AM, Paul B Mahol wrote: > >> For planar sample format, each channel is in separate array: >> >> channel left = data[0] >> channel right = data[1] >> >> If you use more than 8 channels, use extended_data instead. >> _______________________________________________ >> Libav-user mailing list >> Libav-user at ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/libav-user > > > Paul -- thx for the reply. Fair enough on the above -- so as a contrast to > this structure, what does the data array look like for a non-planar format > with two channels? Its one big array, only data[0] points to something. This is asked at least 10 times a day on irc channel. From brado at bighillsoftware.com Wed Apr 24 20:20:39 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 11:20:39 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On Apr 24, 2013, at 11:04 AM, Alex Cohn wrote: > And to set > > data[1]=data[0] + plane_size; > > is most likely not enough because both data[0] and data[1] must be aligned. Hey Alex, thx for the reply. You hit one of the magic words ("aligned") that I'm investigating further. I've seen "align" as a parameter in a number of the avcodec function calls, and there doesn't appear to be much discussion regarding the proper setting of this value (like for example "0 = default" -- which doesn't explain what the "default" actually means). Also understand that alignment even in audio samples has other interpretations, so I'm trying to make sure I'm not reading something into what FFmpeg means by this. So back to your statement that "both data[0] and data[1] must be aligned". What specifically do you mean by this? Thanks, Brad From brado at bighillsoftware.com Wed Apr 24 20:38:30 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 11:38:30 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> Message-ID: <988F5E9F-128F-4A7D-992F-78B163FFDEBC@bighillsoftware.com> On Apr 24, 2013, at 11:13 AM, Paul B Mahol wrote: > You are still trolling. I've had a working app plus source posted on Github for the better part of a month trying to solve a problem for a client: https://github.com/BigHillSoftware/QTFFmpeg Feel free to contribute a solution to the specific problem. I would greatly appreciate it. Otherwise, if list questions are that bothersome, if I could set up the inbox rule for your mail client to filter off my posts, I would, but I can't. I'm trying to solve a problem, and what's more it is for a client. I've asked questions, I've posted source code (a working capture app with a UI on top of it to boot). I've demonstrated repeatedly that I've read the FFmpeg documentation and source and extensively searched Google for answers -- this isn't an issue of looking for anyone else to do the work. This is a legit problem. So I'm going to continue to ask questions as necessary until this problem gets solved. If you are one of the FFmpeg maintainers and you speak for the list membership / management as a whole, and this is the general attitude towards the FFmpeg community (at least newcomers, which I'm not exactly, but perhaps relatively so) and support, then please bear with me long enough to get this problem solved for my client. After that, I'll be on my way, and I'll inform both my client and others who inquire about video/audio encoding solutions that this is what they will face if issues arise, and they can review the Libav history I was appraised of earlier (which appears to be just more of the same general communication dysfunction), and they can choose accordingly whether using FFmpeg and being dependent on this scenario for support or getting questions answered represents a commercial risk to them or not. I personally have no desire to make an enemy out of anyone or have adversarial communication, especially someone I've never met; nor do I have a craving for conflict that appears to be present on virtually every OSS mailing list. So again, I'm seeing this problem through, then I'll be gone unless/until another problem arises. Just a kid with a dream trying to make a living... Brad From onemda at gmail.com Wed Apr 24 21:02:57 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 19:02:57 +0000 Subject: [Libav-user] AAC with FLV In-Reply-To: <988F5E9F-128F-4A7D-992F-78B163FFDEBC@bighillsoftware.com> References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> <988F5E9F-128F-4A7D-992F-78B163FFDEBC@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 11:13 AM, Paul B Mahol wrote: > >> You are still trolling. > > I've had a working app plus source posted on Github for the better part of a > month trying to solve a problem for a client: > > https://github.com/BigHillSoftware/QTFFmpeg I have nothing against you, but seeing that so much time passed and problem is still not solved is really making me feel uneasy, and reading multiple threads that come up with almost same problem and that same FUD spreading is makeing me even less ignorant so I will look at this asap just to stop FUD nonsense. From brado at bighillsoftware.com Thu Apr 25 00:59:22 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 15:59:22 -0700 Subject: [Libav-user] AAC with FLV In-Reply-To: References: <3B30067A-BA3F-4DC4-94B0-B03982D88AB4@bighillsoftware.com> <3E82B25D-5F7C-4141-A7CE-AE3AF094572C@bighillsoftware.com> <2B27B5A5-B18A-43AB-808B-F0C4CB9D5E28@bighillsoftware.com> <135D09F1-F7A6-4142-B609-4C4506679BF6@bighillsoftware.com> <9574ADC3-75AF-4814-ACEF-9E169A783F13@bighillsoftware.com> <611F5E7C-F912-4229-B93A-E8DA7BA9A242@bighillsoftware.com> <6E3935B3-CEDD-428B-A35A-F2BCDC6510E5@universalx.net> <1366805150614-4657367.post@n4.nabble.com> <66E01B75-C321-4110-981A-37999748558E@bighillsoftware.com> <36A6AF51-C643-493B-B4E9-AF766397E9D7@bighillsoftware.com> <988F5E9F-128F-4A7D-992F-78B163FFDEBC@bighillsoftware.com> Message-ID: <45267EE1-7EE3-4A20-A717-4951E50DA742@bighillsoftware.com> On Apr 24, 2013, at 12:02 PM, Paul B Mahol wrote: > I have nothing against you, but seeing that so much time passed and problem > is still not solved is really making me feel uneasy, and reading > multiple threads that come up with almost same problem and that same FUD spreading is makeing me Dunno about fear/doubt, but uncertainty is the nature of any question. I am indeed uncertain about the solution here; hence the questions. > even less ignorant so I will look at this asap just to stop FUD nonsense. I gratefully accept and appreciate any help anyone offers. I just updated the code on Github to be a bit cleaner in a few areas testing was taking place, updated the configuration such that it was encoding only audio (to isolate it) and writing to a local file (rather than streaming across the network), and put a new sample FLV file out there so anyone could listen to sample audio that was created with this app. If you or anyone has any questions, please don't hesitate to ask. I'll do whatever I can and track down whatever answers to get to the bottom of this. For the record...when I do get to the bottom of this and get it working, I'm leaving this code up on Github so that those from both the QuickTime API and FFmpeg developer communities can benefit, so should questions similar to my own arise, the inquiring party can have a look and perhaps find it helpful. Thanks for your help. Brad From bruce at spearmorgan.com Thu Apr 25 01:26:30 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Wed, 24 Apr 2013 16:26:30 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On Apr 24, 2013, at 10:43 AM, Brad O'Hearne wrote: > 2. For planar data, what exactly is the expected structure of the data array? > > is it: > > data[0] -> plane 1 > data[1] -> plane 2 > > or is it > > data[0] -> plane 1 > data[0 + plane_size] -> plane 2 > This seems quite clear in sampleformat.h: * For planar sample formats, each audio channel is in a separate data plane, * and linesize is the buffer size, in bytes, for a single plane. All data * planes must be the same size. For packed sample formats, only the first data * plane is used, and samples for each channel are interleaved. In this case, * linesize is the buffer size, in bytes, for the 1 plane. I found adding support for planar data trivial. I use: avcodec_decode_audio4 (audioCodecCtx, workingFrame, &bytesUsed, &packet); Then for interleaved formats access the samples at: (const void*)workingFrame->data[0] and planar formats: (const void*)workingFrame->data[i] (where i is 0 - number channels, obviously) I can read AAC format files with this method, although they have some weird quirks, like variable durations per packet, and sizes not being samples (I work mostly with integer PCM formats). Haven't tried saving them. Bruce From onemda at gmail.com Thu Apr 25 01:54:23 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 23:54:23 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On 4/24/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 11:04 AM, Alex Cohn wrote: > >> And to set >> >> data[1]=data[0] + plane_size; >> >> is most likely not enough because both data[0] and data[1] must be >> aligned. > > Hey Alex, thx for the reply. You hit one of the magic words ("aligned") that > I'm investigating further. I've seen "align" as a parameter in a number of > the avcodec function calls, and there doesn't appear to be much discussion > regarding the proper setting of this value (like for example "0 = default" > -- which doesn't explain what the "default" actually means). Also understand > that alignment even in audio samples has other interpretations, so I'm > trying to make sure I'm not reading something into what FFmpeg means by > this. > > So back to your statement that "both data[0] and data[1] must be aligned". > What specifically do you mean by this? You call av_samples_alloc_array_and_samples() with align set to 0, which means channel data planes are aligned along 32 byte boundary. Is this really the case? Set align argument to 1 if to make them aligned along 1 byte boundary. > > Thanks, > > Brad > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From onemda at gmail.com Thu Apr 25 01:57:17 2013 From: onemda at gmail.com (Paul B Mahol) Date: Wed, 24 Apr 2013 23:57:17 +0000 Subject: [Libav-user] Resampling to an identical audio format In-Reply-To: References: Message-ID: On 4/20/13, Brad O'Hearne wrote: > Suppose one were to create a resampler context for audio where the source > and destination sample formats, channel layout, and sample rates were the > same. Should the source data bytes be modified in any way when assigning to > the destination data? No it should not .... If it does then there is bug somehwere. From brado at bighillsoftware.com Thu Apr 25 02:16:01 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 17:16:01 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On Apr 24, 2013, at 4:54 PM, Paul B Mahol wrote: > You call av_samples_alloc_array_and_samples() with align set to 0, which means > channel data planes are aligned along 32 byte boundary. Is this really the case? > > Set align argument to 1 if to make them aligned along 1 byte boundary. Here is the information on the sample buffer received from QTKit which is being used to fill the source data array: 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit little-endian floating point, 2 channels, 44100 Hz 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Bytes per frame: 4 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Frames per packet: 1 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Bits per channel: 32 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is packed? YES 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is high aligned? NO 2013-04-24 17:06:58.656 QTFFmpeg[2732:d407] Channels per frame: 2 So to answer your question, provided that I've understood it correctly, samples are packed, therefore should be aligned on the full 32-bit boundary, and thus align should be set to 0. But for the sake of curiosity, I changed align to 1 (for all functions with align) and it made no difference in the audio distortion...same as before. I then tried setting the align parameter to 1 on only the filling of the source data array -- distorted audio still, but seemed to cut the whole track short. To the best of my knowledge, a packed sample buffer should not need high alignment (which I presume is what you mean by the 1 byte boundary). If I've misunderstood your question, let me know. Thanks, Brad From onemda at gmail.com Thu Apr 25 02:32:03 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 25 Apr 2013 00:32:03 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: On 4/25/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 4:54 PM, Paul B Mahol wrote: > >> You call av_samples_alloc_array_and_samples() with align set to 0, which >> means >> channel data planes are aligned along 32 byte boundary. Is this really the >> case? >> >> Set align argument to 1 if to make them aligned along 1 byte boundary. > > Here is the information on the sample buffer received from QTKit which is > being used to fill the source data array: > > 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit little-endian > floating point, 2 channels, 44100 Hz > 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Bytes per frame: 4 > 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Frames per packet: 1 > 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Bits per channel: 32 > 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is packed? YES > 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is high aligned? NO > 2013-04-24 17:06:58.656 QTFFmpeg[2732:d407] Channels per frame: 2 > > So to answer your question, provided that I've understood it correctly, > samples are packed, therefore should be aligned on the full 32-bit boundary, Its byte and not bit. Another thing, you overwrite sourceData[x] pointers, causing memory leak. > and thus align should be set to 0. But for the sake of curiosity, I changed > align to 1 (for all functions with align) and it made no difference in the > audio distortion...same as before. I then tried setting the align parameter > to 1 on only the filling of the source data array -- distorted audio still, > but seemed to cut the whole track short. > > To the best of my knowledge, a packed sample buffer should not need high > alignment (which I presume is what you mean by the 1 byte boundary). If I've > misunderstood your question, let me know. > > Thanks, > > Brad > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Thu Apr 25 03:18:25 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 18:18:25 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> On Apr 24, 2013, at 5:32 PM, Paul B Mahol wrote: > On 4/25/13, Brad O'Hearne wrote: >> Here is the information on the sample buffer received from QTKit which is >> being used to fill the source data array: >> >> 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit little-endian >> floating point, 2 channels, 44100 Hz >> 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Bytes per frame: 4 >> 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Frames per packet: 1 >> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Bits per channel: 32 >> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is packed? YES >> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is high aligned? NO >> 2013-04-24 17:06:58.656 QTFFmpeg[2732:d407] Channels per frame: 2 >> >> So to answer your question, provided that I've understood it correctly, >> samples are packed, therefore should be aligned on the full 32-bit boundary, > > Its byte and not bit. Actually I meant bit. 1 frame, 4 bytes per frame (4 * 8 bits = 32 bits), 32 bits per channel, packed, so no offset alignment within that 32-bit (4 byte) slot. I presumed that was what you meant by 0 or 1 byte boundary. If not, let me know. > Another thing, you overwrite sourceData[x] pointers, causing memory leak. Good catch...I'm aware of a few missing memory frees, as I've profiled it using Instruments. As I've been repeatedly trying various things and adding code here and there to try to fix this issue, I resolved not to worry about that stuff until the thing actually worked. But yes, you are correct. There is one thing I probably should clarify. In past posts, you may have heard me state that my source sample format was AV_SAMPLE_FMT_FLTP. This might have created confusion with my mention above of the captured sample buffer having a format of the following: >> 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit little-endian >> floating point, 2 channels, 44100 Hz The "Linear PCM" part might have lead you to believe I didn't have a planar format. In QTKit, the QTSampleBuffer object has a reference to the data buffer which indeed follows this format. However, it also maintains a reference to an AudioBufferList which is defined as: struct AudioBufferList { UInt32 mNumberBuffers; AudioBuffer mBuffers[1]; }; typedef struct AudioBufferList AudioBufferList; This struct allows you to access each buffer contained within the sample, where each mBuffer contains a separate channel's data buffer, i.e. each plane of data. So if you've looked at my source code, you may notice this block of code: // assign source data AudioBufferList *tempAudioBufferList = [sampleBuffer audioBufferListWithOptions:0]; for (uint i = 0; i < tempAudioBufferList->mNumberBuffers; i++) { sourceData[i] = tempAudioBufferList->mBuffers[i].mData; } That is essentially assigning sourceData with each channel's data plane. I know that this works, because when resampling from AV_SAMPLE_FMT_FLTP to AV_SAMPLE_FMT_S16 with the ADPCM_SWF codec, I get perfect audio. (Though interestingly this first go-round I never could get the pointer to the linear buffer to work -- changing to this planar format and using the channel data references from the AudioBufferList is what fixed my previous resampling problem). So I just wanted to mention that, so that when you saw the "Linear PCM" mentioned, it didn't seem as if the wrong source sample format was being used. It isn't ... Brad From brado at bighillsoftware.com Thu Apr 25 03:35:28 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Wed, 24 Apr 2013 18:35:28 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> Message-ID: <358BDAEE-5100-48DE-812D-CC197A70D3F5@bighillsoftware.com> On Apr 24, 2013, at 4:26 PM, Bruce Wheaton wrote: > This seems quite clear in sampleformat.h: > > * For planar sample formats, each audio channel is in a separate data plane, > * and linesize is the buffer size, in bytes, for a single plane. All data > * planes must be the same size. For packed sample formats, only the first data > * plane is used, and samples for each channel are interleaved. In this case, > * linesize is the buffer size, in bytes, for the 1 plane. I fear some of my posts/discussions may be somewhat laden with two different definitions of the term "packed". The FFmpeg description based on for example the above doc you posted used "packed" in contrast to planar...i.e. channels delivered in linear format vs. separate planes (which would of course be planar). QTKit uses a different meaning for "packed"....from their doc for a particular attribute constant: kAudioFormatFlagIsPacked Set if the sample bits occupy the entire available bits for the channel, clear if they are high- or low-aligned within the channel. If I'm reading this correctly, FFmpeg uses packed to refer to the way channels are structured relative to each other, in a single, linear buffer or in multiple buffers for each plane. QTKit uses packed to talk about whether a frame's bits are completely used, and if not, the positioning of sample bits within the frame (i.e. if 3 bytes of 4 were used, they could be low or high aligned within that frame, whether the format was planar or not). > I found adding support for planar data trivial. > I use: > > avcodec_decode_audio4 (audioCodecCtx, workingFrame, &bytesUsed, &packet); Well, I'm encoding, but I figured it would be the same -- changing sample formats and codec config, but that's it. Other than that, I'm not aware of much else to change. A different codec or sample format doesn't necessitate a different approach to resampling or encoding. I'm still betting on a data buffer or pointer issue somewhere. > Then for interleaved formats access the samples at: > > (const void*)workingFrame->data[0] > > and planar formats: > > (const void*)workingFrame->data[i] (where i is 0 - number channels, obviously) As it follows my use case, to my knowledge, that's essentially what I'm doing. Feel free to check out the code yourself. It's the QTFFAVStreamer class, the createAudioStream and streamAudioFrame methods. https://github.com/BigHillSoftware/QTFFmpeg Thanks again for the reply. Brad From Steffen.Roeber at hella.com Thu Apr 25 07:59:55 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Wed, 24 Apr 2013 22:59:55 -0700 (PDT) Subject: [Libav-user] writing .avi with rawvideo and rgb data In-Reply-To: References: <1366810731983-4657369.post@n4.nabble.com> Message-ID: <1366869595330-4657395.post@n4.nabble.com> But write_header also gives me return value AVERROR_INVALIDDATA with pix_fmt BGRA and BGRA24. I think this is because of validate_codec_tag call in mux.c. -- View this message in context: http://libav-users.943685.n4.nabble.com/writing-avi-with-rawvideo-and-rgb-data-tp4657369p4657395.html Sent from the libav-users mailing list archive at Nabble.com. From gedikmert89 at gmail.com Thu Apr 25 10:33:28 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Thu, 25 Apr 2013 11:33:28 +0300 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: <5174F5FD.1070502@tvgenius.net> Message-ID: > Well, first of all: Mans Rullgard is the author of gas-preprocessor and > deserves all the credit. Secondly the ffmeg version of gas-preprocesso is > manually copied from Mans repo github.com/mansr/gas-preprocessor to > ffmpeg's repo github.com/yuvi/gas-preprocessor thus it may fall behind. In > fact, if you have problems with arm optimization i would recommend to check > Mans repo from time to time just to be sure there are no new updates that > hasn't been brought into ffmpeg. Thanks Julian, Carl and Lars, The problem is gone with the configure options that Lars wrote with the latest gas-processor which is same with mansr's one. Now, I can use asm optimizations without distortion when decoding any mpx codec. - MG -------------- next part -------------- An HTML attachment was scrubbed... URL: From gedikmert89 at gmail.com Thu Apr 25 11:08:49 2013 From: gedikmert89 at gmail.com (Mert Gedik) Date: Thu, 25 Apr 2013 12:08:49 +0300 Subject: [Libav-user] RTSP streaming on UDP transport Message-ID: Hello, ./ffplay -rtsp_transport tcp rtsp://live.sabah.com.tr:443/atv/atv3/ -> perfect streaming - no problem ./ffplay -rtsp_transport udp rtsp://live.sabah.com.tr:443/atv/atv3/ -> missing lots of packets so, barely the image can be presented without problem. the links are real and live, so anyone can test it via ffplay. VLC hasn't got a problem like above, I can see that VLC can not miss any/much UDP packets as it uses live555 project for RTSP streaming. The tested versions for ffplay are 0.9, 0.11.1 , 1.0, 1.1 & 1.2, all results same problem.. I've searched about this issue on the net, some people advise to increase udp packet buffer size, this makes some help but does not fix the issue completely. any help or advise appreciated... - MG -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Thu Apr 25 11:18:30 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 25 Apr 2013 09:18:30 +0000 Subject: [Libav-user] writing .avi with rawvideo and rgb data In-Reply-To: <1366869595330-4657395.post@n4.nabble.com> References: <1366810731983-4657369.post@n4.nabble.com> <1366869595330-4657395.post@n4.nabble.com> Message-ID: On 4/25/13, Steffen wrote: > But write_header also gives me return value AVERROR_INVALIDDATA with > pix_fmt > BGRA and BGRA24. > I think this is because of validate_codec_tag call in mux.c. No, you most likely need to set bits per coded sample and tag. > > > > -- > View this message in context: > http://libav-users.943685.n4.nabble.com/writing-avi-with-rawvideo-and-rgb-data-tp4657369p4657395.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 > From onemda at gmail.com Thu Apr 25 11:29:21 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 25 Apr 2013 09:29:21 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On 4/25/13, Brad O'Hearne wrote: > On Apr 24, 2013, at 5:32 PM, Paul B Mahol wrote: > >> On 4/25/13, Brad O'Hearne wrote: >>> Here is the information on the sample buffer received from QTKit which >>> is >>> being used to fill the source data array: >>> >>> 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit >>> little-endian >>> floating point, 2 channels, 44100 Hz >>> 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Bytes per frame: 4 >>> 2013-04-24 17:06:58.654 QTFFmpeg[2732:d407] Frames per packet: 1 >>> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Bits per channel: 32 >>> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is packed? YES >>> 2013-04-24 17:06:58.655 QTFFmpeg[2732:d407] Is high aligned? NO >>> 2013-04-24 17:06:58.656 QTFFmpeg[2732:d407] Channels per frame: 2 >>> >>> So to answer your question, provided that I've understood it correctly, >>> samples are packed, therefore should be aligned on the full 32-bit >>> boundary, >> >> Its byte and not bit. > > Actually I meant bit. 1 frame, 4 bytes per frame (4 * 8 bits = 32 bits), 32 > bits per channel, packed, so no offset alignment within that 32-bit (4 byte) > slot. I presumed that was what you meant by 0 or 1 byte boundary. If not, > let me know. This is last time I repeat this: Aligment set by align is 32 BYTES and not 4 BYTES or 32 BITS. > >> Another thing, you overwrite sourceData[x] pointers, causing memory leak. > > Good catch...I'm aware of a few missing memory frees, as I've profiled it > using Instruments. As I've been repeatedly trying various things and adding > code here and there to try to fix this issue, I resolved not to worry about > that stuff until the thing actually worked. But yes, you are correct. > > There is one thing I probably should clarify. In past posts, you may have > heard me state that my source sample format was AV_SAMPLE_FMT_FLTP. This > might have created confusion with my mention above of the captured sample > buffer having a format of the following: > >>> 2013-04-24 17:06:58.653 QTFFmpeg[2732:d407] Linear PCM, 32 bit >>> little-endian >>> floating point, 2 channels, 44100 Hz > > The "Linear PCM" part might have lead you to believe I didn't have a planar > format. In QTKit, the QTSampleBuffer object has a reference to the data > buffer which indeed follows this format. However, it also maintains a > reference to an AudioBufferList which is defined as: > > struct AudioBufferList { > UInt32 mNumberBuffers; > AudioBuffer mBuffers[1]; > }; > typedef struct AudioBufferList AudioBufferList; > > This struct allows you to access each buffer contained within the sample, > where each mBuffer contains a separate channel's data buffer, i.e. each > plane of data. So if you've looked at my source code, you may notice this > block of code: > > // assign source data > AudioBufferList *tempAudioBufferList = [sampleBuffer > audioBufferListWithOptions:0]; > > for (uint i = 0; i < tempAudioBufferList->mNumberBuffers; > i++) > { > sourceData[i] = tempAudioBufferList->mBuffers[i].mData; > } > > That is essentially assigning sourceData with each channel's data plane. I > know that this works, because when resampling from AV_SAMPLE_FMT_FLTP to > AV_SAMPLE_FMT_S16 with the ADPCM_SWF codec, I get perfect audio. (Though > interestingly this first go-round I never could get the pointer to the > linear buffer to work -- changing to this planar format and using the > channel data references from the AudioBufferList is what fixed my previous > resampling problem). > > So I just wanted to mention that, so that when you saw the "Linear PCM" > mentioned, it didn't seem as if the wrong source sample format was being > used. It isn't ... I listened the sample from mentioned github repo. And its evident that there are either holes (end of every? channel data is cut off) or extra noise after each channel is added. Because this does not happen with any of ffmpeg libraries or tools I can conclude with 1000% confidence that bug is in your code. If both source and destination are planar you need to check that align argument for both of them is correct, and also that you give correct number of samples (per each channel) to every swr_convert() call. > > Brad > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From Steffen.Roeber at hella.com Thu Apr 25 11:44:19 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Thu, 25 Apr 2013 02:44:19 -0700 (PDT) Subject: [Libav-user] Supported video_codec in muxer Message-ID: <1366883059146-4657400.post@n4.nabble.com> The muxer provides a default codec "video_codec". Is there any way to check if an arbitry codec 8set be the user) is provided by a muxer? For example: Check if AV_CODEC_ID_PNG is supported by .m2t muxer? -- View this message in context: http://libav-users.943685.n4.nabble.com/Supported-video-codec-in-muxer-tp4657400.html Sent from the libav-users mailing list archive at Nabble.com. From someshwar.sutar at gmail.com Thu Apr 25 15:08:29 2013 From: someshwar.sutar at gmail.com (Someshwar Sutar) Date: Thu, 25 Apr 2013 18:38:29 +0530 Subject: [Libav-user] Configure ffmpeg with eclipse on windows. Message-ID: Dear all, I want to develop application using ffmpeg and eclipse on windows. I am not able to make eclipse ready to use ffmpeg. Please provide 'step by step' guide to do the same. Regards Someshwar -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Thu Apr 25 18:26:50 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Thu, 25 Apr 2013 09:26:50 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: <0A4D5B65-D11F-450C-B764-1D494529455A@bighillsoftware.com> On Apr 25, 2013, at 2:29 AM, Paul B Mahol wrote: > This is last time I repeat this: Aligment set by align is 32 BYTES and > not 4 BYTES > or 32 BITS. If you could post a reference or where in the FFmpeg doc (which I've looked for and haven't found) which explains exactly what this 32 bytes relates to with respect to sample / planar structure, that would help me greatly. I've mentioned in a few other posts that I'm having to bridge two different definitions of alignment -- one from FFmpeg and another from QuickTime. Perhaps clarification on this point would lead to the solution. > Because this does not happen with any of ffmpeg libraries or tools I can > conclude with 1000% confidence that bug is in your code. Thank you for looking at my code, which I greatly appreciate. I take it from your comment that no specific problem with the code was apparent (doesn't mean it isn't there, just nothing jumped out). > If both source and destination are planar you need to check that align argument > for both of them is correct, and also that you give correct number of > samples (per each channel) > to every swr_convert() call. The correct number of samples are coming in per call. As for the alignment, I've experimented with both 0 and 1 values for that parameter, with no difference -- also the current alignment settings worked just fine for the incoming source data when resampled to a different output sample format. I would have expected a problem in source alignment handling to manifest itself regardless of the destination sample format, but perhaps that's where the problem lies. I think once I understand more clearly exactly how that alignment relates to plane structure and byte storage, I'll be able to eliminate it as an issue. Thank you for taking the time to look at this code. If anything else arises that might uncover the problem, let me know. Thx, Brad From klaussfreire at gmail.com Thu Apr 25 19:11:17 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Thu, 25 Apr 2013 14:11:17 -0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: > I listened the sample from mentioned github repo. And its evident that there are > either holes (end of every? channel data is cut off) or extra noise > after each channel is added. > > Because this does not happen with any of ffmpeg libraries or tools I can > conclude with 1000% confidence that bug is in your code. It does happen to me with "ffmpeg" (the tool - no code of mine), when encoding to AAC. And the symptom is very similar to that sample output. From onemda at gmail.com Thu Apr 25 19:16:22 2013 From: onemda at gmail.com (Paul B Mahol) Date: Thu, 25 Apr 2013 17:16:22 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On 4/25/13, Claudio Freire wrote: > On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: >> I listened the sample from mentioned github repo. And its evident that >> there are >> either holes (end of every? channel data is cut off) or extra noise >> after each channel is added. >> >> Because this does not happen with any of ffmpeg libraries or tools I can >> conclude with 1000% confidence that bug is in your code. > > > It does happen to me with "ffmpeg" (the tool - no code of mine), when > encoding to AAC. And the symptom is very similar to that sample > output. Plese open bug report, with exact step to reproduce bug. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Thu Apr 25 20:10:15 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Thu, 25 Apr 2013 11:10:15 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: <6A06F8CD-E524-4010-A8EC-9D70BCC2E81B@bighillsoftware.com> On Apr 25, 2013, at 10:16 AM, Paul B Mahol wrote: > On 4/25/13, Claudio Freire wrote: >> On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: >>> I listened the sample from mentioned github repo. And its evident that >>> there are >>> either holes (end of every? channel data is cut off) or extra noise >>> after each channel is added. >>> >>> Because this does not happen with any of ffmpeg libraries or tools I can >>> conclude with 1000% confidence that bug is in your code. >> >> >> It does happen to me with "ffmpeg" (the tool - no code of mine), when >> encoding to AAC. And the symptom is very similar to that sample >> output. > > Plese open bug report, with exact step to reproduce bug. Claudio, thanks for posting this. If you wouldn't mind posting the exact command you are using with the ffmpeg tool to create this problem, I'd love to reproduce this myself. Thanks, Brad From 3.14pi at ukr.net Wed Apr 24 15:05:49 2013 From: 3.14pi at ukr.net (Alex) Date: Wed, 24 Apr 2013 16:05:49 +0300 Subject: [Libav-user] extradata Message-ID: <39761.1366808749.9616082871718576128@ffe15.ukr.net> Hi, I develop decoder that use NVidia CUDA thechnology. And I have problems, for decode frame on CUDA I need fill and parse same struc first to CUDA decoder. But I don't understend where and how I can get params for my struc. Can you help me? This is struc for h264 video: http://graphics.im.ntu.edu.tw/~bossliaw/nvCuda_doxygen/html/struct___c_u_v_i_d_h264_p_i_c_p_a_r_a_m_s.html int log2_max_frame_num_minus4 int pic_order_cnt_type int log2_max_pic_order_cnt_lsb_minus4 int delta_pic_order_always_zero_flag int frame_mbs_only_flag int direct_8x8_inference_flag int num_ref_frames unsigned char residual_colour_transform_flag unsigned char bit_depth_luma_minus8 unsigned char bit_depth_chroma_minus8 unsigned char qpprime_y_zero_transform_bypass_flag int entropy_coding_mode_flag int pic_order_present_flag int num_ref_idx_l0_active_minus1 int num_ref_idx_l1_active_minus1 int weighted_pred_flag int weighted_bipred_idc int pic_init_qp_minus26 int deblocking_filter_control_present_flag int redundant_pic_cnt_present_flag int transform_8x8_mode_flag int MbaffFrameFlag int constrained_intra_pred_flag int chroma_qp_index_offset int second_chroma_qp_index_offset int ref_pic_flag int frame_num int CurrFieldOrderCnt [2] CUVIDH264DPBENTRY dpb [16] unsigned char WeightScale4x4 [6][16] unsigned char WeightScale8x8 [2][64] unsigned char fmo_aso_enable unsigned char num_slice_groups_minus1 unsigned char slice_group_map_type signed char pic_init_qs_minus26 unsigned int slice_group_change_rate_minus1 union { unsigned long long slice_group_map_addr const unsigned char * pMb2SliceGroupMap } fmo unsigned int Reserved [12] union { CUVIDH264MVCEXT mvcext CUVIDH264SVCEXT svcext }; From murat.sudan at argela.com.tr Thu Apr 25 10:30:42 2013 From: murat.sudan at argela.com.tr (Murat Sudan) Date: Thu, 25 Apr 2013 11:30:42 +0300 Subject: [Libav-user] ffmpeg configure for ios - using asm options causes MPx (mp1, mp2, mp3) codecs sound problems In-Reply-To: References: <5174F5FD.1070502@tvgenius.net> Message-ID: > Well, first of all: Mans Rullgard is the author of gas-preprocessor and > deserves all the credit. Secondly the ffmeg version of gas-preprocesso is > manually copied from Mans repo github.com/mansr/gas-preprocessor to > ffmpeg's repo github.com/yuvi/gas-preprocessor thus it may fall behind. In > fact, if you have problems with arm optimization i would recommend to check > Mans repo from time to time just to be sure there are no new updates that > hasn't been brought into ffmpeg. Thanks Julian, Carl and Lars, The problem is gone with the configure options that Lars wrote with the latest gas-processor which is same with mansr's one. Now, I can use asm optimizations without distortion on sound when decoding any mpx codec. - MG -------------- next part -------------- An HTML attachment was scrubbed... URL: From redeemarr at gmail.com Mon Apr 22 21:55:36 2013 From: redeemarr at gmail.com (san) Date: Mon, 22 Apr 2013 12:55:36 -0700 (PDT) Subject: [Libav-user] Getting SDP from AVFormatContext Message-ID: <1366660536564-4657353.post@n4.nabble.com> Is there any chance to get an SDP information from AVFormatContext? I'm trying to stream h.264 over RTP (RTSP), but unfortunately an SPS/PPS data is stored in SDP only and not included in RTP packets. So I'm getting errors from decoder for now (non-existing PPS 0 referenced). I've solved this problem earlier by establishing additional TCP connection, interacting with RTSP server, receiving SDP and obtaining SPS/PPS from it at last. But I think this is very ugly solution since libavformat already deals with RTSP and probably got an SDP somewhere deep inside. -- View this message in context: http://libav-users.943685.n4.nabble.com/Getting-SDP-from-AVFormatContext-tp4657353.html Sent from the libav-users mailing list archive at Nabble.com. From yiikai1987910 at gmail.com Wed Apr 24 07:33:00 2013 From: yiikai1987910 at gmail.com (dboyaoao) Date: Tue, 23 Apr 2013 22:33:00 -0700 (PDT) Subject: [Libav-user] about mp3 convert to aac Message-ID: <1366781580810-4657360.post@n4.nabble.com> Hello, I had covert mp3 to aac , but the saved aac file is not correct , there are a lot of noise and the human sound is very quickly. somebody can help me? here is my code : #include #include #include #include #include const char* infile = NULL; AVFormatContext *ic = NULL; int videoindex = -1; int audioindex = -1; AVPacket videopacket; AVPacket audiopacket; AVPacket encodeaudiopacket; AVCodec *codec = NULL; AVCodecContext *codecctx = NULL; AVFrame pictureFrame; AVFrame audioFrame; AVFrame *pFrameRGB; int numBytes; uint8_t *buffer; AVOutputFormat *ofmt = NULL; AVCodec *encode = NULL; AVCodecContext *encodecctx = NULL; AVAudioFifo *fifo = NULL; int main(int argc, char **argv) { infile = argv[1]; av_register_all(); if(avformat_open_input(&ic,infile,NULL,NULL)) { printf("open input file error\n"); return 0; } if(avformat_find_stream_info(ic,NULL) < 0) { printf("no stream in the file\n"); return 0; } int streamnum = ic->nb_streams; int i = 0; for(;istreams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { videoindex = i; break; } if(ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { audioindex = i; break; } } if(audioindex != -1 && videoindex != -1) { printf("the input file is AV\n"); } else if(audioindex != -1){ printf("the input file is audio\n"); } else if(videoindex != -1) { printf("the input file is video\n"); } ofmt = av_guess_format(NULL,argv[2],NULL); if(!ofmt) { printf("no found exit format\n"); return 0; } encode = avcodec_find_encoder(ofmt->audio_codec); if(!encode) { printf("can't find encode\n"); return 0; } encodecctx = avcodec_alloc_context3(encode); if(!encodecctx) { printf("can't allocate encode context\n"); return 0; } codec = avcodec_find_decoder(ic->streams[audioindex]->codec->codec_id); if(!codec) { printf("codec not found\n"); } codecctx = ic->streams[audioindex]->codec; encodecctx->sample_fmt = AV_SAMPLE_FMT_S16; encodecctx->channels = codecctx->channels; encodecctx->channel_layout = codecctx->channel_layout; encodecctx->sample_rate = codecctx->sample_rate; if(avcodec_open2(codecctx,codec,NULL) < 0) { printf("couldn't allocate video codeccontext\n"); return 0; } if(avcodec_open2(encodecctx,encode,NULL) < 0) { printf("caouldn't open encode\n"); return 0; } if(!(fifo = av_audio_fifo_alloc(AV_SAMPLE_FMT_S16,codecctx->channels,codecctx->frame_size))) { printf("can't alloc fifo\n"); return 0; } FILE *outfile = fopen(argv[2],"wb"); if(!outfile) { printf("can't open out file\n"); return 0; } int nRet; int j = 0; while(1) { nRet = av_read_frame(ic,&audiopacket); if(nRet < 0) { printf("no packet read\n"); break; } if(audiopacket.stream_index == audioindex) { int gotptr = -1; int ret = avcodec_decode_audio4(codecctx,&audioFrame,&gotptr,&audiopacket); if(av_audio_fifo_realloc(fifo,av_audio_fifo_size(fifo)+codecctx->frame_size) < 0) { printf("realloc fifo error\n"); return 0; } if(av_audio_fifo_write(fifo,audioFrame.data,codecctx->frame_size) != codecctx->frame_size) { printf("write fifo error\n"); return 0; } printf("fifo size is %d\n",av_audio_fifo_size(fifo)); while(av_audio_fifo_size(fifo) < encodecctx->frame_size) { int ret = avcodec_decode_audio4(codecctx,&audioFrame,&gotptr,&audiopacket); if(av_audio_fifo_realloc(fifo,av_audio_fifo_size(fifo)+codecctx->frame_size) < 0) { printf("realloc fifo error\n"); return 0; } if(av_audio_fifo_write(fifo,audioFrame.data,codecctx->frame_size) != codecctx->frame_size) { printf("write fifo error\n"); return 0; } } if(gotptr) { int gotencodeptr = -1; av_init_packet(&encodeaudiopacket); while(av_audio_fifo_size(fifo) >= encodecctx->frame_size) { audioFrame.nb_samples = encodecctx->frame_size; if(av_audio_fifo_read(fifo,audioFrame.data,encodecctx->frame_size) != encodecctx->frame_size) { printf("read data from fifo error\n"); return 0; } printf("audioFrame size is %d\n",audioFrame.nb_samples); printf("encodectx size is %d\n",encodecctx->frame_size); if(avcodec_encode_audio2(encodecctx,&encodeaudiopacket,&audioFrame,&gotencodeptr) < 0 ) { printf("encode audio error\n"); return 0; } else{ if(gotencodeptr == 1) { printf("encode sucess\n"); fwrite(encodeaudiopacket.data,1,encodeaudiopacket.size,outfile); } else{ printf("no encode data\n"); } } av_free_packet(&encodeaudiopacket); } } else{ printf("decode error\n"); } if(ret < 0) { printf("decode error\n"); return 0; } } else{ } } } THANKS! -- View this message in context: http://libav-users.943685.n4.nabble.com/about-mp3-convert-to-aac-tp4657360.html Sent from the libav-users mailing list archive at Nabble.com. From yiikai1987910 at gmail.com Wed Apr 24 11:32:24 2013 From: yiikai1987910 at gmail.com (dboyaoao) Date: Wed, 24 Apr 2013 02:32:24 -0700 (PDT) Subject: [Libav-user] about mp3 convert to aac In-Reply-To: <1366781580810-4657360.post@n4.nabble.com> References: <1366781580810-4657360.post@n4.nabble.com> Message-ID: <1366795944102-4657363.post@n4.nabble.com> can anybody help me -- View this message in context: http://libav-users.943685.n4.nabble.com/about-mp3-convert-to-aac-tp4657360p4657363.html Sent from the libav-users mailing list archive at Nabble.com. From yiikai1987910 at gmail.com Thu Apr 25 05:14:21 2013 From: yiikai1987910 at gmail.com (dboyaoao) Date: Wed, 24 Apr 2013 20:14:21 -0700 (PDT) Subject: [Libav-user] using avcode_decode_audio4 error Message-ID: <1366859661074-4657394.post@n4.nabble.com> HELLO I use avcode_decode_audio4 to decode audio file ,but I don't know why the pcm file I got has a lot of noise ,who can help me? THANKS -- View this message in context: http://libav-users.943685.n4.nabble.com/using-avcode-decode-audio4-error-tp4657394.html Sent from the libav-users mailing list archive at Nabble.com. From yiikai1987910 at gmail.com Wed Apr 24 16:00:09 2013 From: yiikai1987910 at gmail.com (dboyaoao) Date: Wed, 24 Apr 2013 07:00:09 -0700 (PDT) Subject: [Libav-user] convert mp3 to aac !!!!!!!!!!!!!!!!!!!!!!!!!! Message-ID: <1366812009679-4657370.post@n4.nabble.com> HELLO I am now convert the mp3 file to aac file ,but i got a problem, when I use avcodec_decode_audio4() and I save the frmae.data[0] to the local pcm file. then I use ffmepg convert to wav. When I use vlc to play the wav file there are lot of noise ,I guess the pcm data were wrong, but I don't know why ? any body can help me ? THANKS -- View this message in context: http://libav-users.943685.n4.nabble.com/convert-mp3-to-aac-tp4657370.html Sent from the libav-users mailing list archive at Nabble.com. From klaussfreire at gmail.com Thu Apr 25 20:30:10 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Thu, 25 Apr 2013 15:30:10 -0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: <6A06F8CD-E524-4010-A8EC-9D70BCC2E81B@bighillsoftware.com> References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> <6A06F8CD-E524-4010-A8EC-9D70BCC2E81B@bighillsoftware.com> Message-ID: On Thu, Apr 25, 2013 at 3:10 PM, Brad O'Hearne wrote: >> On 4/25/13, Claudio Freire wrote: >>> On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: >>>> I listened the sample from mentioned github repo. And its evident that >>>> there are >>>> either holes (end of every? channel data is cut off) or extra noise >>>> after each channel is added. >>>> >>>> Because this does not happen with any of ffmpeg libraries or tools I can >>>> conclude with 1000% confidence that bug is in your code. >>> >>> >>> It does happen to me with "ffmpeg" (the tool - no code of mine), when >>> encoding to AAC. And the symptom is very similar to that sample >>> output. >> >> Plese open bug report, with exact step to reproduce bug. > > Claudio, thanks for posting this. If you wouldn't mind posting the exact command you are using with the ffmpeg tool to create this problem, I'd love to reproduce this myself. > > Thanks, > > Brad Yes, I've starred the issue to get a minimal test case as soon as I get some time to. From klaussfreire at gmail.com Thu Apr 25 20:31:21 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Thu, 25 Apr 2013 15:31:21 -0300 Subject: [Libav-user] convert mp3 to aac !!!!!!!!!!!!!!!!!!!!!!!!!! In-Reply-To: <1366812009679-4657370.post@n4.nabble.com> References: <1366812009679-4657370.post@n4.nabble.com> Message-ID: On Wed, Apr 24, 2013 at 11:00 AM, dboyaoao wrote: > I am now convert the mp3 file to aac file ,but i got a problem, > when I use avcodec_decode_audio4() and I save the frmae.data[0] to the local > pcm file. then I use ffmepg convert to wav. When I use vlc to play the wav > file there are lot of noise ,I guess the pcm data were wrong, but I don't > know why ? any body can help me ? Dude, I've got the same issue, but 4 identical posts? Dial down with the spamming a bit... From nhmenne42 at students.tntech.edu Thu Apr 25 23:50:46 2013 From: nhmenne42 at students.tntech.edu (Neil Menne) Date: Thu, 25 Apr 2013 17:50:46 -0400 Subject: [Libav-user] Pixel Format Question Message-ID: To all, Would anyone here happen to know the AV_PIX_FMT_* equivalent to the OpenCV pixel format bgr8 which is explained as being CV_8UC3? I receive an image that's in this format, and I'm trying to use FFmpeg to deal with it. I just can't seem to figure out which is the correct corresponding pixel format. I suspected AV_PIX_FMT_BGR24, but I just want to be sure. -Neil -------------- next part -------------- An HTML attachment was scrubbed... URL: From enerccio at gmail.com Fri Apr 26 00:02:35 2013 From: enerccio at gmail.com (Peter Enerccio) Date: Fri, 26 Apr 2013 00:02:35 +0200 Subject: [Libav-user] convert mp3 to aac !!!!!!!!!!!!!!!!!!!!!!!!!! In-Reply-To: References: <1366812009679-4657370.post@n4.nabble.com> Message-ID: Also, cut down the exclamation marks, seriously... 2013/4/25 Claudio Freire > On Wed, Apr 24, 2013 at 11:00 AM, dboyaoao > wrote: > > I am now convert the mp3 file to aac file ,but i got a problem, > > when I use avcodec_decode_audio4() and I save the frmae.data[0] to the > local > > pcm file. then I use ffmepg convert to wav. When I use vlc to play the > wav > > file there are lot of noise ,I guess the pcm data were wrong, but I don't > > know why ? any body can help me ? > > > Dude, I've got the same issue, but 4 identical posts? Dial down with > the spamming a bit... > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > -- Bc. Peter Va?u?anik -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Apr 26 04:41:31 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 26 Apr 2013 02:41:31 +0000 (UTC) Subject: [Libav-user] Pixel Format Question References: Message-ID: Neil Menne writes: > Would anyone here happen to know the AV_PIX_FMT_* > equivalent to the OpenCV pixel format bgr8 which is > explained as being CV_8UC3? Probably if you can explain how "OpenCV pixel format bgr8" is defined. Carl Eugen From cehoyos at ag.or.at Fri Apr 26 04:43:50 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 26 Apr 2013 02:43:50 +0000 (UTC) Subject: [Libav-user] extradata References: <39761.1366808749.9616082871718576128@ffe15.ukr.net> Message-ID: Alex <3.14pi at ...> writes: > Hi, I develop decoder that use NVidia CUDA thechnology. > And I have problems, for decode frame on CUDA I need > fill and parse same struc first to CUDA decoder. > But I don't understend where and how I can get params > for my struc. Did you already look into libavcodec/vdpau.c ? Carl Eugen From bjoern.drabeck at gmail.com Fri Apr 26 04:49:31 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Fri, 26 Apr 2013 10:49:31 +0800 Subject: [Libav-user] Pixel Format Question In-Reply-To: References: Message-ID: > Neil Menne writes: > > > Would anyone here happen to know the AV_PIX_FMT_* > > equivalent to the OpenCV pixel format bgr8 which is > > explained as being CV_8UC3? > > Probably if you can explain how "OpenCV pixel format bgr8" > is defined. > > Carl Eugen > > Afaik 8 bit, 3 channels, unsigned char.. so that would sound like AV_PIX_FMT_BGR24 to me.. right? Bjoern -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Apr 26 04:57:44 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 26 Apr 2013 02:57:44 +0000 (UTC) Subject: [Libav-user] Pixel Format Question References: Message-ID: Bjoern Drabeck writes: > Afaik 8 bit, 3 channels, unsigned char.. > so that would sound like?AV_PIX_FMT_BGR24 to me.. right? Or AV_PIX_FMT_RGB24. Please fix your quoting / don't use html, Carl Eugen From bjoern.drabeck at gmail.com Fri Apr 26 08:01:32 2013 From: bjoern.drabeck at gmail.com (Bjoern Drabeck) Date: Fri, 26 Apr 2013 14:01:32 +0800 Subject: [Libav-user] Issues when playing files from http In-Reply-To: References: Message-ID: > Hi, > > in my player I want to play back files that are located online (usually mp4 > files provided from some server or CDN (http)), which generally works fine, > however I have two issues that I need to address, but am not quite sure > about: > > 1. when I pause the file for several minutes then continue later it seems > ffmpeg's connection times out and the next call into av_read_frame returns > an error. My code is (currently) still the same that I use for local > playback, so I was wondering what would be required to change in order to > affect that. Is there a way to tell it to keep the connection alive? Or do I > have to make sure in my player that at least at a regular interval I keep > reading another packet with av_read_frame, and stuffing it into a buffer? > (Normally when I pause I keep reading packets until the packet queues are > full, then the next av_read_frame will only happen after some packets have > been taken out for processing). > Upon further investigation I found that after pausing a file (that I am streaming from http) for a while, then continue playback, av_read_frame starts to return with AVERROR_INVALIDDATA ("Invalid data found when processing input ") usually for several packets. While in itself this is not a major problem (except that the resulting frames will be corrupted), I am wondering if this is caused by me (maybe lacking to set some flags or something upon opening the file), or if this would indicate a problem on the http layer of ffmpeg? Anyone else experience anything similar, or know anything about this issue? > 2. sometimes playback can be a bit jerky, esp for example when I seek > somewhere into the stream, and I am on a slower connection, then even though > I wait until I have a few frames ready before continuing playback, however > it still seems that I am rendering them faster than I can get them from the > stream. Is there some way of knowing when enough data is ready for me to > continue playback? (I mean inside the ffmpeg libraries, or some callbacks I > can set or flags to monitor or sth) Or do I have to write my own logic to > see of the rate of consumption is bigger than the rate I can get the packets > out of the stream? > > Are there any recommended practices or guidelines or documents on how to > handle that? > > Mostly the code that I use for local playback works fine for online as well, > just the pausing issue is really troublesome, and the buffering behavior on > slower connections. > thanks, Bjoern From muhammad.talha22 at gmail.com Fri Apr 26 11:40:50 2013 From: muhammad.talha22 at gmail.com (Talha) Date: Fri, 26 Apr 2013 14:40:50 +0500 Subject: [Libav-user] error when building ffmpeg Message-ID: am building ffmpeg and stuck in an unusual spot. Inside libavutil we have float_dsp.h and float_dsp.c files. Inside these file there is a declaration of a methond which is: void (*butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len);float (*scalarproduct_float)(const float *v1, const float *v2, int len); when building and compiling this file i get this error and have no idea what to do. I think problem is somewhere else but again have no idea at all. Error is jni/ffmpeg/libavcodec/../libavutil/float_dsp.h:150: error: expected ';', ',' or ')' before 'v1' jni/ffmpeg/libavcodec/../libavutil/float_dsp.h:161: error: expected ';' before 'float' Anybody who wants to help please take a step forward because i have not really got any support on ffmpeg during couple of weeks now. -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Fri Apr 26 13:45:21 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Fri, 26 Apr 2013 11:45:21 +0000 (UTC) Subject: [Libav-user] error when building ffmpeg References: Message-ID: Talha writes: > Anybody who wants to help please take a step forward > because i have not really got any support on ffmpeg > during couple of weeks now. Where did you ask for support? When reporting build problems, please post the configure line you were using ("./configure" if it allows to reproduce the problem), then run make, if you see the compilation problem, please run "make V=1" and post its complete console output. (Please do not post the complete output of the first "make" call.) And please post the output of "gcc -v". Carl Eugen From yiikai1987910 at gmail.com Fri Apr 26 08:21:19 2013 From: yiikai1987910 at gmail.com (dboyaoao) Date: Thu, 25 Apr 2013 23:21:19 -0700 (PDT) Subject: [Libav-user] convert mp3 to aac !!!!!!!!!!!!!!!!!!!!!!!!!! In-Reply-To: References: <1366812009679-4657370.post@n4.nabble.com> Message-ID: <1366957279240-4657417.post@n4.nabble.com> I found the example of ffmpeg also has the problem , it seems that the decode_audio api has some bug in it -- View this message in context: http://libav-users.943685.n4.nabble.com/convert-mp3-to-aac-tp4657370p4657417.html Sent from the libav-users mailing list archive at Nabble.com. From the1evilgenius at gmail.com Fri Apr 26 15:54:15 2013 From: the1evilgenius at gmail.com (Neil Menne) Date: Fri, 26 Apr 2013 09:54:15 -0400 Subject: [Libav-user] Pixel Format Question In-Reply-To: References: Message-ID: They describe it as "any primitive type from the list can be defined by an identifier in the form CV_{U|S|F}C(). For example, uchar ~ CV8UC1, 3-element floating-point tuple ~ CV_32FC3, ..." That's the best description I can find. On Thu, Apr 25, 2013 at 10:57 PM, Carl Eugen Hoyos wrote: > Bjoern Drabeck writes: > > > Afaik 8 bit, 3 channels, unsigned char.. > > so that would sound like AV_PIX_FMT_BGR24 to me.. right? > > Or AV_PIX_FMT_RGB24. > > Please fix your quoting / don't use html, 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 brado at bighillsoftware.com Fri Apr 26 18:45:28 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Fri, 26 Apr 2013 09:45:28 -0700 Subject: [Libav-user] av_samples_fill_arrays and memory Message-ID: Last night I delved into the source code looking for the exact handling of pointers and population of audio sample arrays. I had a question from the av_samples_fill_arrays in samplefmt.c, specifically lines 167-169: audio_data[0] = (uint8_t *)buf; for (ch = 1; planar && ch < nb_channels; ch++) audio_data[ch] = audio_data[ch-1] + line_size; This makes perfect sense for the purpose of this method -- given that it takes one buffer as a parameter (buf), all sample data must be contained within it, and each channel resides in contiguous memory. So again, this code does exactly what I'd expect it to. I got to thinking however about the scenario where someone has planar sample data, each plane which is completely filled with the proper number of samples and properly structured, but whose channels (1, 2, ...n) aren't in contiguous memory. So for instance, say samples are derived from an outside source (such as capture), and channels/planes are delivered and properly structured, and code was not to use the av_samples_fill_arrays above, but rather set pointers themselves. This would seem right: audio_data[0] = channel1; audio_data[1] = channel2; But what if the above was done, yet this was also true: audio_data[1] != (audio_data[0] + line_size) The audio_data array has proper pointers to each channel -- and each channel may be properly aligned within. But what if multiple channels aren't in contiguous memory? Is that going to be an issue in using the audio_data array at any point, perhaps later in encoding? I think this what may be what Alex was alluding to in a previous post. Brad From ysegalov at gmail.com Fri Apr 26 20:21:04 2013 From: ysegalov at gmail.com (Yaron Segalov) Date: Fri, 26 Apr 2013 21:21:04 +0300 Subject: [Libav-user] non-causal or two-pass filters Message-ID: Is it possible to create a non-causal filter, or even a two-pass filter? An example filter: an audio filter which normalizes the audio gain based on the MAX gain throughout the entire movie. -------------- next part -------------- An HTML attachment was scrubbed... URL: From onemda at gmail.com Fri Apr 26 21:47:18 2013 From: onemda at gmail.com (Paul B Mahol) Date: Fri, 26 Apr 2013 19:47:18 +0000 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: References: Message-ID: On 4/26/13, Brad O'Hearne wrote: > Last night I delved into the source code looking for the exact handling of > pointers and population of audio sample arrays. I had a question from the > av_samples_fill_arrays in samplefmt.c, specifically lines 167-169: > > audio_data[0] = (uint8_t *)buf; > for (ch = 1; planar && ch < nb_channels; ch++) > audio_data[ch] = audio_data[ch-1] + line_size; > > This makes perfect sense for the purpose of this method -- given that it > takes one buffer as a parameter (buf), all sample data must be contained > within it, and each channel resides in contiguous memory. So again, this > code does exactly what I'd expect it to. I got to thinking however about the > scenario where someone has planar sample data, each plane which is > completely filled with the proper number of samples and properly structured, > but whose channels (1, 2, ...n) aren't in contiguous memory. > > So for instance, say samples are derived from an outside source (such as > capture), and channels/planes are delivered and properly structured, and > code was not to use the av_samples_fill_arrays above, but rather set > pointers themselves. This would seem right: > > audio_data[0] = channel1; > audio_data[1] = channel2; and are those aligned? > > But what if the above was done, yet this was also true: > > audio_data[1] != (audio_data[0] + line_size) > > The audio_data array has proper pointers to each channel -- and each channel > may be properly aligned within. But what if multiple channels aren't in > contiguous memory? Is that going to be an issue in using the audio_data > array at any point, perhaps later in encoding? > > I think this what may be what Alex was alluding to in a previous post. Contiguous memory or not AFAIK should not matter. Instead of setting pointers, you could memcpy data instead, and if done correctly your issue should be solved. > > Brad > > > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From alexcohn at netvision.net.il Fri Apr 26 21:56:35 2013 From: alexcohn at netvision.net.il (Alex Cohn) Date: Fri, 26 Apr 2013 22:56:35 +0300 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: References: Message-ID: On Fri, Apr 26, 2013 at 10:47 PM, Paul B Mahol wrote: > > > But what if the above was done, yet this was also true: > > > > audio_data[1] != (audio_data[0] + line_size) > > > > The audio_data array has proper pointers to each channel -- and each channel > > may be properly aligned within. But what if multiple channels aren't in > > contiguous memory? Is that going to be an issue in using the audio_data > > array at any point, perhaps later in encoding? > > > > I think this what may be what Alex was alluding to in a previous post. > > Contiguous memory or not AFAIK should not matter. ... but attempt to use a contiguous buffer when the data is not aligned correctly inside it, does matter, I believe. > Instead of setting pointers, you could memcpy data instead, and if > done correctly your issue should be solved. That's a precise prescription. Alex From bruce at spearmorgan.com Fri Apr 26 22:45:33 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Fri, 26 Apr 2013 13:45:33 -0700 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: References: Message-ID: On Apr 26, 2013, at 9:45 AM, Brad O'Hearne wrote: > So for instance, say samples are derived from an outside source (such as capture), and channels/planes are delivered and properly structured, and code was not to use the av_samples_fill_arrays above, but rather set pointers themselves. This would seem right: > > audio_data[0] = channel1; > audio_data[1] = channel2; > > But what if the above was done, yet this was also true: > > audio_data[1] != (audio_data[0] + line_size) > > The audio_data array has proper pointers to each channel -- and each channel may be properly aligned within. But what if multiple channels aren't in contiguous memory? Is that going to be an issue in using the audio_data array at any point, perhaps later in encoding? Brad, since you've discussed at length every aspect of this except one meaning of 'aligned', and it's the relevant one, can I just double check you're aware of this definition and you are respecting it? When discussing the data being aligned, it means that the data in the buffers is aligned to four byte (or however many) boundaries in memory. That's required to use various FFmpeg accelerated routines - SSE etc. It may be that your source of dest buffers, if not from ffmpeg, are not correctly aligned. If you make your own buffers, you would generally expect to confirm or adjust alignment as you do, so that ffmpeg can use them. If not, then the results are probably undefined. Bruce From stefasab at gmail.com Fri Apr 26 23:44:52 2013 From: stefasab at gmail.com (Stefano Sabatini) Date: Fri, 26 Apr 2013 23:44:52 +0200 Subject: [Libav-user] non-causal or two-pass filters In-Reply-To: References: Message-ID: <20130426214452.GN31789@arborea> In data Friday 2013-04-26 21:21:04 +0300, Yaron Segalov ha scritto: > Is it possible to create a non-causal filter, or even a two-pass filter? Non-causal?? > An example filter: an audio filter which normalizes the audio gain based on > the MAX gain throughout the entire movie. There are a few filters which allow to collect data about a stream, see ebur128 and the astats filter currently reviewed. The problem with a two-steps process is that we didn't yet designed a mechanism to pass global data (data collected at the end of the stream processing) to the outside, right now we log it which may or may not be an optimal way to send information around. Help in this area is welcome. -- FFmpeg = Frightening Fundamental Multipurpose Pacific Eager Glue From klaussfreire at gmail.com Sat Apr 27 00:15:56 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Fri, 26 Apr 2013 19:15:56 -0300 Subject: [Libav-user] non-causal or two-pass filters In-Reply-To: <20130426214452.GN31789@arborea> References: <20130426214452.GN31789@arborea> Message-ID: On Fri, Apr 26, 2013 at 6:44 PM, Stefano Sabatini wrote: > In data Friday 2013-04-26 21:21:04 +0300, Yaron Segalov ha scritto: >> Is it possible to create a non-causal filter, or even a two-pass filter? > > Non-causal?? One that uses "future samples" to compute "current output". For example, negative delay (moving samples earlier in time to be precise). From onemda at gmail.com Sat Apr 27 18:55:29 2013 From: onemda at gmail.com (Paul B Mahol) Date: Sat, 27 Apr 2013 16:55:29 +0000 Subject: [Libav-user] non-causal or two-pass filters In-Reply-To: References: <20130426214452.GN31789@arborea> Message-ID: On 4/26/13, Claudio Freire wrote: > On Fri, Apr 26, 2013 at 6:44 PM, Stefano Sabatini > wrote: >> In data Friday 2013-04-26 21:21:04 +0300, Yaron Segalov ha scritto: >>> Is it possible to create a non-causal filter, or even a two-pass filter? >> >> Non-causal?? > > One that uses "future samples" to compute "current output". For > example, negative delay (moving samples earlier in time to be > precise). It should be possible, for example: For first run, filter store useful info in some file, in 2nd run it use that info from file to filter frame. > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From brado at bighillsoftware.com Sat Apr 27 19:44:44 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Sat, 27 Apr 2013 10:44:44 -0700 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: References: Message-ID: <0345028E-8F5B-44D3-85B5-1E984766C081@bighillsoftware.com> On Apr 26, 2013, at 1:45 PM, Bruce Wheaton wrote: > It may be that your source of dest buffers, if not from ffmpeg, are not correctly aligned. To the best of my knowledge, the source data is aligned, exactly as needed. Reasons for saying so: 1. The meta-data on the QTSampleBuffer coming over indicates that this is so. 2. The same code / source data being used with the FLTP sample format / AAC encoder works perfect with a S16 sample format / ADPCM_SWF encoder. An alignment problem with the source data most likely would cause a problem in both scenarios. 3. I've tried both 0 and 1 for align parameters throughout my code, and it has absolutely zero effect on the output audio -- same distortion problem. 4. As an alternative approach to setting buffer/channel pointers, I've manually moved every value from the captured buffer to the source data array for resampling. Again, no change in output. I'll take other avenues. Thanks, Brad From nicolas.george at normalesup.org Sun Apr 28 11:15:32 2013 From: nicolas.george at normalesup.org (Nicolas George) Date: Sun, 28 Apr 2013 11:15:32 +0200 Subject: [Libav-user] non-causal or two-pass filters In-Reply-To: <20130426214452.GN31789@arborea> References: <20130426214452.GN31789@arborea> Message-ID: <20130428091532.GA12698@phare.normalesup.org> Le septidi 7 flor?al, an CCXXI, Stefano Sabatini a ?crit?: > There are a few filters which allow to collect data about a stream, > see ebur128 and the astats filter currently reviewed. The problem with > a two-steps process is that we didn't yet designed a mechanism to pass > global data (data collected at the end of the stream processing) to > the outside, right now we log it which may or may not be an optimal > way to send information around. Help in this area is welcome. I believe it may be possible to handle things with very few changes to the framework, only specialized filters. The problem with multi-pass filters is it requires the decoded data twice, and decoded data is huge, too huge to be kept in memory. If we trust the surrounding application to provide the same data twice, that is not a problem. Consider the following, imagined, ffmpeg command: ffmpeg -i music.flac -i music.flac -lavfi " [0:a] ebur128=metadata=1, ascript=frame='l=metadata(\"lavfi.r128.I\") : eof='sendcmd(\"volnorm\", \"set_volume\", l); sendcmd(\"startstop\", \"start\")' [dummy] ; [1:a] startstop=start=0, volnorm [out]" \ -map "[dummy]" -f null - \ -map "[out]" music_normalized.flac The startstop filter would just return EAGAIN until it gets the "start" command. The dummy output could be replaced by a nullsink, but I am not sure ffmpeg is at ease with sinks right now. Regarding the export of data collected during the run, an extension of the ffmetadata may be a simple short term solution. Also, maybe we should consider moving the writers API from ffprobe to lavu. 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 yangnuo0408 at yahoo.com.cn Sun Apr 28 15:50:19 2013 From: yangnuo0408 at yahoo.com.cn (nuo yang) Date: Sun, 28 Apr 2013 21:50:19 +0800 (CST) Subject: [Libav-user] MPEG-2 NTSC video shows horizontal lines on the red color Message-ID: <1367157019.49851.YahooMailNeo@web15102.mail.cnb.yahoo.com> Hi everyone, ? Recently I use ffmpeg sdk to develop my own player, my video source is MPEG-2 NTSC video, and I use ffmpeg sdk to decode the video, then use BlackMagic DeckLink sdk to receive the video frame and display the video to my CRT monitor through a DeckLink PCI card. Everything is okay but a little defect, when the video contains some red color objects (like red clothes), and if the red color objects moving fast, there are some horizontal lines on red color. My video is interlaced, and I tried some methods, including change the video field order, but I didn't make it. BTW, if I use ffdshow to decode the video, it does not have the issue. ? Is there someone has the same issue like me, or can someone give me some advice? Many thanks in advance! ? ? - Nuo -------------- next part -------------- An HTML attachment was scrubbed... URL: From eclipse7 at gmx.net Sun Apr 28 19:04:21 2013 From: eclipse7 at gmx.net (Alexander Strasser) Date: Sun, 28 Apr 2013 19:04:21 +0200 Subject: [Libav-user] [LT2013] FFmpeg at LinuxTag in Berlin Message-ID: <20130428170421.GA3903@akuma.Speedport_W_723V_1_27_000> We happily announce that FFmpeg will be represented at LinuxTag in Berlin, Germany. The event will take place from 22nd to 25th of May. We will have a shared booth with XBMC. More information on the event can be found here: http://www.linuxtag.org/2013/en/ Just visit us at our booth to have a chat with us. And please bring along your media samples if you have any that do not work correctly with FFmpeg! From bruce at spearmorgan.com Sun Apr 28 21:22:43 2013 From: bruce at spearmorgan.com (Bruce Wheaton) Date: Sun, 28 Apr 2013 12:22:43 -0700 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: <0345028E-8F5B-44D3-85B5-1E984766C081@bighillsoftware.com> References: <0345028E-8F5B-44D3-85B5-1E984766C081@bighillsoftware.com> Message-ID: On Apr 27, 2013, at 10:44 AM, Brad O'Hearne wrote: > On Apr 26, 2013, at 1:45 PM, Bruce Wheaton wrote: > >> It may be that your source of dest buffers, if not from ffmpeg, are not correctly aligned. > > To the best of my knowledge, the source data is aligned, exactly as needed. Reasons for saying so: > > 1. The meta-data on the QTSampleBuffer coming over indicates that this is so. Why don't you just check the addresses of the data planes and know it? It's 2 minutes to check a few times. > > 2. The same code / source data being used with the FLTP sample format / AAC encoder works perfect with a S16 sample format / ADPCM_SWF encoder. An alignment problem with the source data most likely would cause a problem in both scenarios. Not true at all. The specific code to deal with each codec type will be radically different - undefined, remember. This isn't a alignment question as in 'off by one sample', it's an alignment issue as in vector operations won't work right. Bruce From Steffen.Roeber at hella.com Mon Apr 29 15:19:19 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Mon, 29 Apr 2013 06:19:19 -0700 (PDT) Subject: [Libav-user] AVCodecTag tag Message-ID: <1367241559432-4657434.post@n4.nabble.com> I want to provide a list of codesc that is supported by a file format. I try to iterate over the codec_tag element in avoutputformat . But this is impossible because it's private. What can I do? -- View this message in context: http://libav-users.943685.n4.nabble.com/AVCodecTag-tag-tp4657434.html Sent from the libav-users mailing list archive at Nabble.com. From klaussfreire at gmail.com Mon Apr 29 18:44:13 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Mon, 29 Apr 2013 13:44:13 -0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On Thu, Apr 25, 2013 at 2:16 PM, Paul B Mahol wrote: > On 4/25/13, Claudio Freire wrote: >> On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: >>> I listened the sample from mentioned github repo. And its evident that >>> there are >>> either holes (end of every? channel data is cut off) or extra noise >>> after each channel is added. >>> >>> Because this does not happen with any of ffmpeg libraries or tools I can >>> conclude with 1000% confidence that bug is in your code. >> >> >> It does happen to me with "ffmpeg" (the tool - no code of mine), when >> encoding to AAC. And the symptom is very similar to that sample >> output. > > Plese open bug report, with exact step to reproduce bug. Revisiting this issue, it doesn't sound at all like the previously linked example output. I was confused, it's similar, but seems to be related to quantization rather than buffer misalignment. It sounds as if some components were allocated too few bits, in spite of a relatively high bitrate selection (256k). I will post a minimal test case in a few days (I've been busy with RL issues). From onemda at gmail.com Mon Apr 29 18:48:16 2013 From: onemda at gmail.com (Paul B Mahol) Date: Mon, 29 Apr 2013 16:48:16 +0000 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On 4/29/13, Claudio Freire wrote: > On Thu, Apr 25, 2013 at 2:16 PM, Paul B Mahol wrote: >> On 4/25/13, Claudio Freire wrote: >>> On Thu, Apr 25, 2013 at 6:29 AM, Paul B Mahol wrote: >>>> I listened the sample from mentioned github repo. And its evident that >>>> there are >>>> either holes (end of every? channel data is cut off) or extra noise >>>> after each channel is added. >>>> >>>> Because this does not happen with any of ffmpeg libraries or tools I >>>> can >>>> conclude with 1000% confidence that bug is in your code. >>> >>> >>> It does happen to me with "ffmpeg" (the tool - no code of mine), when >>> encoding to AAC. And the symptom is very similar to that sample >>> output. >> >> Plese open bug report, with exact step to reproduce bug. > > > Revisiting this issue, it doesn't sound at all like the previously > linked example output. I was confused, it's similar, but seems to be > related to quantization rather than buffer misalignment. It sounds as > if some components were allocated too few bits, in spite of a > relatively high bitrate selection (256k). Note that native aac encoder is experimental and mostly useless. > > I will post a minimal test case in a few days (I've been busy with RL > issues). > _______________________________________________ > Libav-user mailing list > Libav-user at ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > From klaussfreire at gmail.com Mon Apr 29 18:59:41 2013 From: klaussfreire at gmail.com (Claudio Freire) Date: Mon, 29 Apr 2013 13:59:41 -0300 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: On Mon, Apr 29, 2013 at 1:48 PM, Paul B Mahol wrote: >>>> It does happen to me with "ffmpeg" (the tool - no code of mine), when >>>> encoding to AAC. And the symptom is very similar to that sample >>>> output. >>> >>> Plese open bug report, with exact step to reproduce bug. >> >> >> Revisiting this issue, it doesn't sound at all like the previously >> linked example output. I was confused, it's similar, but seems to be >> related to quantization rather than buffer misalignment. It sounds as >> if some components were allocated too few bits, in spite of a >> relatively high bitrate selection (256k). > > Note that native aac encoder is experimental and mostly useless. I see... ...I always understood "experimental" as "immature" but "will get there someday". I'm guessing I misunderstood? From the1evilgenius at gmail.com Mon Apr 29 19:17:45 2013 From: the1evilgenius at gmail.com (Neil Menne) Date: Mon, 29 Apr 2013 13:17:45 -0400 Subject: [Libav-user] Pixel Format Question In-Reply-To: References: Message-ID: To close this out, it was indeed AV_PIX_FMT_BGR24. The combination of 'bgr8' and CV_8UC3 gives us that. I also was able to verify this writing some OpenCV code to get the frame information. -Neil On Fri, Apr 26, 2013 at 9:54 AM, Neil Menne wrote: > They describe it as "any primitive type from the list can be defined by an > identifier in the form CV_{U|S|F}C(). For > example, uchar ~ CV8UC1, 3-element floating-point tuple ~ CV_32FC3, ..." > > That's the best description I can find. > > > On Thu, Apr 25, 2013 at 10:57 PM, Carl Eugen Hoyos wrote: > >> Bjoern Drabeck writes: >> >> > Afaik 8 bit, 3 channels, unsigned char.. >> > so that would sound like AV_PIX_FMT_BGR24 to me.. right? >> >> Or AV_PIX_FMT_RGB24. >> >> Please fix your quoting / don't use html, 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 695215606 at qq.com Tue Apr 30 06:09:39 2013 From: 695215606 at qq.com (=?gb18030?B?0MfT8Lrb?=) Date: Tue, 30 Apr 2013 12:09:39 +0800 Subject: [Libav-user] A question about convert wav sound to orther format? Message-ID: how to convert wav sound to other format? I am trying to writing a process to capture the microphone.I captured the sound Successful.But it is a .wav file?It's too big,So how to convert it by ffmpeg?The file decoding_encoding.c just show me convert the sound,but I don't know how to open my own file and read data into AVFrame.Can you help me? -------------- next part -------------- An HTML attachment was scrubbed... URL: From Steffen.Roeber at hella.com Tue Apr 30 12:17:19 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Tue, 30 Apr 2013 03:17:19 -0700 (PDT) Subject: [Libav-user] how to use qscale in lib av api Message-ID: <1367317039925-4657440.post@n4.nabble.com> I try to use qscale. But the value (whether 1 or 31) does not change the output file size: avcodec_get_context_defaults3(formatContext->streams[0]->codec, codec); if (formatContext->oformat->flags & AVFMT_GLOBALHEADER) { formatContext->streams[0]->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; } formatContext->streams[0]->codec->codec_id = codec->id; formatContext->streams[0]->codec->codec_type = codec->type; formatContext->streams[0]->codec->width = i_image.getWidth(); formatContext->streams[0]->codec->height = i_image.getHeight(); formatContext->streams[0]->codec->time_base.num = factor; formatContext->streams[0]->codec->time_base.den = f; formatContext->streams[0]->codec->bit_rate = bitrate; if (qscale >= 0) { formatContext->streams[0]->codec->flags |= CODEC_FLAG_QSCALE; formatContext->streams[0]->codec->global_quality = FF_QP2LAMBDA * qscale; } -- View this message in context: http://libav-users.943685.n4.nabble.com/how-to-use-qscale-in-lib-av-api-tp4657440.html Sent from the libav-users mailing list archive at Nabble.com. From cehoyos at ag.or.at Tue Apr 30 12:46:11 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 30 Apr 2013 10:46:11 +0000 (UTC) Subject: [Libav-user] how to use qscale in lib av api References: <1367317039925-4657440.post@n4.nabble.com> Message-ID: Steffen writes: > formatContext->streams[0]->codec->bit_rate = bitrate; > if (qscale >= 0) > { > formatContext->streams[0]->codec->flags |= CODEC_FLAG_QSCALE; > formatContext->streams[0]->codec->global_quality = FF_QP2LAMBDA * > qscale; Without testing, I wonder if it makes sense to set both a bitrate and a global quality. Which encoder are you using? Carl Eugen From Steffen.Roeber at hella.com Tue Apr 30 13:07:28 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Tue, 30 Apr 2013 04:07:28 -0700 (PDT) Subject: [Libav-user] how to use qscale in lib av api In-Reply-To: References: <1367317039925-4657440.post@n4.nabble.com> Message-ID: <1367320048383-4657442.post@n4.nabble.com> I set bitrate to 0 or whatever. It plays no role in this case (I tested it). I use different codec (mpeg4, mpeg2video). No difference. -- View this message in context: http://libav-users.943685.n4.nabble.com/how-to-use-qscale-in-lib-av-api-tp4657440p4657442.html Sent from the libav-users mailing list archive at Nabble.com. From Steffen.Roeber at hella.com Tue Apr 30 13:10:13 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Tue, 30 Apr 2013 04:10:13 -0700 (PDT) Subject: [Libav-user] Writing .mkv files with libav API Message-ID: <1367320213286-4657443.post@n4.nabble.com> If I write .mkv files with an arbitrary codec (rawvideo, mpeg2video, mpeg4), then the resulting video is playing very fast in vlc or ffplay. Same code works using .avi or .mp4. What's the difference? -- View this message in context: http://libav-users.943685.n4.nabble.com/Writing-mkv-files-with-libav-API-tp4657443.html Sent from the libav-users mailing list archive at Nabble.com. From Steffen.Roeber at hella.com Tue Apr 30 13:34:35 2013 From: Steffen.Roeber at hella.com (Steffen) Date: Tue, 30 Apr 2013 04:34:35 -0700 (PDT) Subject: [Libav-user] Writing .mkv files with libav API In-Reply-To: <1367320213286-4657443.post@n4.nabble.com> References: <1367320213286-4657443.post@n4.nabble.com> Message-ID: <1367321675195-4657444.post@n4.nabble.com> I found the solution: I have to rescale the pts and dts after encing the packet and before writing it. -- View this message in context: http://libav-users.943685.n4.nabble.com/Writing-mkv-files-with-libav-API-tp4657443p4657444.html Sent from the libav-users mailing list archive at Nabble.com. From ggarra13 at gmail.com Tue Apr 30 16:41:01 2013 From: ggarra13 at gmail.com (Gonzalo Garramuno) Date: Tue, 30 Apr 2013 11:41:01 -0300 Subject: [Libav-user] git head compiling problems Message-ID: <517FD7FD.6010208@gmail.com> make: *** No rule to make target `libavcodec/x86/dsputil_rnd_template.c', needed by `libavcodec/x86/dsputil_mmx.o' After I manually added the file, the compilation later failed with: make: *** No rule to make target `doc/all-components.texi', needed by `doc/ffmpeg.pod'. Stop. From h.leppkes at gmail.com Tue Apr 30 17:00:24 2013 From: h.leppkes at gmail.com (Hendrik Leppkes) Date: Tue, 30 Apr 2013 17:00:24 +0200 Subject: [Libav-user] git head compiling problems In-Reply-To: <517FD7FD.6010208@gmail.com> References: <517FD7FD.6010208@gmail.com> Message-ID: On Tue, Apr 30, 2013 at 4:41 PM, Gonzalo Garramuno wrote: > make: *** No rule to make target `libavcodec/x86/dsputil_rnd_**template.c', > needed by `libavcodec/x86/dsputil_mmx.o' > > After I manually added the file, the compilation later failed with: > > make: *** No rule to make target `doc/all-components.texi', needed by > `doc/ffmpeg.pod'. Stop. > > You need to do a "make clean" or "make distclean" to get rid of all files which no longer exist, afterwards it'll work again. Also, make sure things like "ccache" are not intereferring. -------------- next part -------------- An HTML attachment was scrubbed... URL: From xtingray at gmail.com Tue Apr 30 18:15:17 2013 From: xtingray at gmail.com (=?ISO-8859-1?Q?Gustav_Gonz=E1lez?=) Date: Tue, 30 Apr 2013 11:15:17 -0500 Subject: [Libav-user] ffmpeg-1.2 (libavformat) encoder example Message-ID: Hello there! Right now I am studying the file: doc/examples/decoding_encoding.c aiming to update my own code to make it functional with ffmpeg 1.2 I found this message in the header of that file: * Note that libavcodec only handles codecs (mpeg, mpeg4, etc...), * not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the * format handling So, my question is this: is there any encoder example using libavformat based on the latest version of FFmpeg? I still remember an old file called "output-example.c" that I used to use as base for my video encoding classes. Now it seems that I will have to create different encoding resources depending on the codec/format I want to use, isn't? Thank you for any hint! :) -- ============================ Gustav Gonzalez xtingray at gmail.com ============================ -------------- next part -------------- An HTML attachment was scrubbed... URL: From cehoyos at ag.or.at Tue Apr 30 19:15:06 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 30 Apr 2013 17:15:06 +0000 (UTC) Subject: [Libav-user] ffmpeg-1.2 (libavformat) encoder example References: Message-ID: Gustav Gonz?lez writes: > my question is this: is there any encoder example using > libavformat based onthe latest version of FFmpeg? Which (other) files in doc/examples did you study? Carl Eugen From brado at bighillsoftware.com Tue Apr 30 19:42:39 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 30 Apr 2013 10:42:39 -0700 Subject: [Libav-user] ffmpeg-1.2 (libavformat) encoder example In-Reply-To: References: Message-ID: On Apr 30, 2013, at 9:15 AM, Gustav Gonz?lez wrote: > So, my question is this: is there any encoder example using libavformat based on > the latest version of FFmpeg? libavformat - doc/examples/muxing.c and demuxing.c and metadata.c libswresample - doc/examples/resampling_audio.c libavcodec = doc/examples/decoding_encoding.c libswscale - doc/examples/scaling_video.c libavfilter - doc/examples/filtering_audio.c filtering_video.c Hope that helps, Brad From xtingray at gmail.com Tue Apr 30 19:44:43 2013 From: xtingray at gmail.com (=?ISO-8859-1?Q?Gustav_Gonz=E1lez?=) Date: Tue, 30 Apr 2013 12:44:43 -0500 Subject: [Libav-user] ffmpeg-1.2 (libavformat) encoder example In-Reply-To: References: Message-ID: 2013/4/30 Brad O'Hearne > On Apr 30, 2013, at 9:15 AM, Gustav Gonz?lez wrote: > > > So, my question is this: is there any encoder example using libavformat > based on > > the latest version of FFmpeg? > > libavformat - doc/examples/muxing.c and demuxing.c and metadata.c > libswresample - doc/examples/resampling_audio.c > libavcodec = doc/examples/decoding_encoding.c > libswscale - doc/examples/scaling_video.c > libavfilter - doc/examples/filtering_audio.c filtering_video.c > Thank you! :) -- ============================ Gustav Gonzalez xtingray at gmail.com ============================ -------------- next part -------------- An HTML attachment was scrubbed... URL: From brado at bighillsoftware.com Tue Apr 30 20:39:11 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 30 Apr 2013 11:39:11 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> Message-ID: <1F66D2B0-9114-4AD7-933E-414A5001AAF7@bighillsoftware.com> On Apr 29, 2013, at 9:59 AM, Claudio Freire wrote: >> Note that native aac encoder is experimental and mostly useless. > > I see... > ...I always understood "experimental" as "immature" but "will get > there someday". I'm guessing I misunderstood? As constructive feedback, I recommend removing aac entirely from the codebase if this is the case: "experimental" has a ring similar to "beta" or "on the way" -- like Claudio, I didn't derive "useless" and in effect disavowed from "experimental". If this is indeed the lay of the land with aac, and it is going to be left in, I'd put that in big bold letters in the doc or FAQ somewhere, along with DO NOT USE FOR PRODUCTION CODE. Otherwise, others may think that they are basically being early adopters of a codec that is going to be progressively improving, so if the experimental condition of the codec solves functions fine for their use-case, they would expect nothing but eventual improvement to it. I'd also be interested in what other codecs, if any, fall into this category so that I steer clear. If there is a doc listing which ones are considered production-ready and will be supported going forward, and which ones won't be, that would be a great reference... Brad From cehoyos at ag.or.at Tue Apr 30 22:27:56 2013 From: cehoyos at ag.or.at (Carl Eugen Hoyos) Date: Tue, 30 Apr 2013 20:27:56 +0000 (UTC) Subject: [Libav-user] Audio quality loss while encoding References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> <1F66D2B0-9114-4AD7-933E-414A5001AAF7@bighillsoftware.com> Message-ID: Brad O'Hearne writes: > As constructive feedback, I recommend removing aac entirely > from the codebase The native aac encoder is better than most non-experimental audio encoders for stereo input, it is not good for >2 channels (which is not supported at all by most other encoders). That is completely apart from the fact that FFmpeg would obviously never get a better aac encoder if we remove this one. And honestly: Not being a native speaker, I really wonder what could be unclear about "experimental". Carl Eugen From brado at bighillsoftware.com Tue Apr 30 22:45:31 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 30 Apr 2013 13:45:31 -0700 Subject: [Libav-user] Audio quality loss while encoding In-Reply-To: References: <1366802514683-4657364.post@n4.nabble.com> <6AFDAFCD-E398-452B-9A72-4D701E6B569B@bighillsoftware.com> <84921EB5-A68B-4B6B-A808-F153A3B726C1@bighillsoftware.com> <1F66D2B0-9114-4AD7-933E-414A5001AAF7@bighillsoftware.com> Message-ID: On Apr 30, 2013, at 1:27 PM, Carl Eugen Hoyos wrote: > And honestly: Not being a native speaker, I really wonder > what could be unclear about "experimental". Fair enough. No point debating it -- but suffice to say that other perspectives might misinterpret it. The real crux of the matter is the issue of support and ongoing development -- that's the kicker for people investing their time, development, and product in FFmpeg or any part of it as a direction (especially commercially). All ambiguity can be eliminated by just saying outright -- "This codec is not to be used for production, as it will not continue to be developed or supported." But if those specifics should be inferred from "experimental", then understood. Thanks for the clarification. Brad From brado at bighillsoftware.com Tue Apr 30 22:47:42 2013 From: brado at bighillsoftware.com (Brad O'Hearne) Date: Tue, 30 Apr 2013 13:47:42 -0700 Subject: [Libav-user] av_samples_fill_arrays and memory In-Reply-To: References: <0345028E-8F5B-44D3-85B5-1E984766C081@bighillsoftware.com> Message-ID: <986D117D-98EE-44DC-9586-CC848EBFC12B@bighillsoftware.com> On Apr 28, 2013, at 12:22 PM, Bruce Wheaton wrote: > Why don't you just check the addresses of the data planes and know it? It's 2 minutes to check a few times. Bruce...thanks for the advice. The data in both channel 1 and channel 2 (and as a whole), planar or not, and both in the captured sample buffer and in the source data buffer is 32-byte aligned (has been all along). I tested both. Beyond that, just for good measure, I went through the exercise of moving sample values anyway from the capture buffer to the FFmpeg-allocated source data buffer created with av_samples_alloc_array_and_samples -- so by definition it should have been aligned (checked it still though)....same result, data aligned just as before, but same distortion. It appears however I've found the problem. First, after reading that aac is apparently a dead codec, I dumped it and went to libmp3lame. Ran it, same problem. Did some further debugging...revisited this. In avcodec.h, there is this doc above the frame_rate variable: * Number of samples per channel in an audio frame. * * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame * except the last must contain exactly frame_size samples per channel. * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the * frame size is not restricted. In creating the destination data buffer for resampling and the eventual frame to be streamed, I'd been using the frame_size value computed by libavcodec in avcodec_open2 as my destination number of samples (which the doc would suggest is what should be done -- and in my journeys through code snippets and blogs encountered in the series of tubes, it was suggested this was a proper approach). I otherwise would not have thought anything of it had I not been checking this computed value and noticed that libmp3lame results in a value of 1152, which was different than what I'd seen coming off other codecs. So I ditched using the frame_size, went back to using the number of samples as received by capture. Don't know what to make of the doc above. My frames contain 512 samples, while the frame_size of the codec context is 1152. Result, clear audio, both alone and combined with video, both written to a local file and streamed. More tests are needed to verify consistently problem-free function, but seems to work as desired. Brad