[Ffmpeg-devel-irc] ffmpeg.log.20120907

burek burek021 at gmail.com
Sat Sep 8 02:05:01 CEST 2012


[10:38] <StreamTom> Hello chaps, I'm trying to do something clever with piping and a static image. But I keep getting 'Output file is empty' here's my (sanitised command line
[10:38] <StreamTom> ffmpeg -loop 1 -i staticimage.jpg -strict -2 -f flv -vcodec libx264 -b:v 1024k -b:a 65k -acodec aac -s 580x326 -re -r 25 - | ffmpeg -y -re -f flv -i - -c copy foo.flv
[10:39] <StreamTom> The plan is to replace foo.flv with a series of RTMP servers so I'm only doing the transcode step once
[10:40] <StreamTom> Problem is the second ffmpeg process doesn't seem to start, like it's waiting for something and it doesn't go until the first process has stopped. Is there some flag I need to put on the flv so the second process knows to start working on it before it's done
[10:44] <StreamTom> Or could I replace the pipe with some sort of network socket and pull from localhost
[10:47] <StreamTom> I'm trying to fix a problem the guys with FMLE can't ;)
[10:51] <StreamTom> Any ideas? I just think I'm missing something really simple
[10:52] <StreamTom> Hmm, if I push to a named pipe it does pick up, but only after the first process has terminated
[10:58] <StreamTom> I've got the -re flag in all the places I can think of...
[11:06] <StreamTom> What if I pushed out in a different encapsulation to flv?
[11:16] <StreamTom> No, not working, seems to mess up the codec in he second process
[11:26] <StreamTom> A-ha, it seems to be because the duration header isn't set, now is there a way of getting FFMpeg to ignore that?
[11:32] <StreamTom> Ah, it looks like it just buffers like 10m of video before trying to pick up the stream, fortunately this box doe 200fps
[11:34] <JEEB> there's a way to set the amount it tries to prefetch for checking what's inside
[11:34] <JEEB> just don't remember the setting
[11:34] <JEEB> have fun http://ffmpeg.org/ffmpeg.html
[11:40] <killown> somebody have any clue why this http://bpaste.net/show/rSZKqYpaVHKCY0w5mjpa/ exit with no error
[11:40] <killown> without the strace this command line shows nothing
[11:40] <StreamTom> JEEB: Thanks, if I could cut that down I'd breathe a little easier
[11:40] <killown> just a new clean line
[12:06] <killown> can anyone help me http://bpaste.net/show/w92zWN3OxMO4tUzs8UNa/ ?
[12:10] <saste> killown: alsa is autodetected, you need to install alsa-dev or some dev package to have that
[12:11] <killown> alsa-devel alsa-devel-32bit glibc-devel linux-glibc-devel
[12:11] <killown> installed and still same problem
[12:12] <saste> killown: libasound2-dev
[12:12] <saste> if it fail, pb your config.log
[12:15] <killown> man I am trying to find out the libasound2-dev on opensuse
[12:18] <killown> saste, I don't believe, there is no libasound devel package on opensuse distro
[12:22] <relaxed> killown: search for whatever package includes asoundlib.h
[12:55] <killown> saste, are you here eyet?
[12:55] <killown> yet
[13:07] <relaxed> killown: alsa-devel
[13:07] <killown> relaxed, already installed
[13:07] <killown> relaxed, http://bpaste.net/show/ATWqT4rCv7qmVUaYqsia/
[13:09] <relaxed> and you don't have alsa support?
[13:09] <killown> relaxed, on my system I have
[13:09] <killown> are you saying alsa support on ffmpeg?
[13:09] <relaxed> of course
[13:10] <saste> killown: config.log
[13:10] <killown> saste, config.log from where?
[13:10] <killown> this is not compiled ffmpeg
[13:10] <killown> has no config.log
[13:10] <killown> I am going to compile it right now
[13:12] <saste> killown: config.log is created when you configure ffmpeg
[13:13] <killown> saste, the ffmpeg that I was talking about is from distro repos
[13:14] <saste> killown: ffmpeg -formats
[13:14] <saste> will tell you the in/out devices
[13:14] <saste> check if alsa is listed
[13:14] <saste> if not you're out of luck
[13:15] <killown> saste, not listed
[13:15] <saste> killown: then you may need to compile from sources
[13:17] <killown> rpmbuild -ba ffmpeg.spec
[13:28] <MadPig> "Warning: first frame is no keyframe" <-- ?
[13:36] <JEEB> first frame that was come up with was not a frame that could be decoded and shown fully without some frames it depends on
[13:36] <JEEB> in most cases that's a TV capture or something that wasn't cut at keyframes
[13:37] <MadPig> :S
[13:37] <MadPig> Oh... they have "keyframes" in video encoding too.
[13:37] <MadPig> But it means (kinda) something different there.
[13:37] <JEEB> yes, also called IDR frames
[13:41] <MadPig> Hmm...
[13:42] <MadPig> JEEB: I got a DVD sent from the TV company upon my request, with an old programme dumped onto it. Supposedly professionally. I noticed a bunch of "jumps" or "cuts" in it when I watched it on my computer through VLC. After I had dumped the .VOB files and converted them with ffmpeg just now, and watching the resulting .avi files, the cuts/jumps appear to be gone.
[13:42] <MadPig> JEEB: Does that make any sense?
[13:43] <JEEB> dunno
[13:43] <MadPig> I first assumes that the jumps/cuts were done by their equipment OR by the original recording... then I suspected my software.
[13:43] <MadPig> But clearly, the jumps don't really exist since ffmpeg was able to "heal" them.
[13:43] <MadPig> *assumed
[13:44] <JEEB> could be ffmpeg just masking them (or on the other hand just discarding some data), or VLC just having a fit with something -- I just cannot know :)
[13:44] <MadPig> Hrm.
[13:44] <JEEB> you would have to see the logs of ffmpeg and friends (as well as VLC possibly, it has logging too)
[13:44] <MadPig> It's very bizarre when a ffmpeg convertion actually HEALS or makes files SMALLER while retaining the same quality.
[13:45] <JEEB> if you are re-encoding to some newer format being able to compress something more isn't exactly a surprise
[13:47] <MadPig> JEEB: Dammit. Now I just realized that if I use the "record" feature in VLC on these resulting, fixed files, there are additional sound cuts and desynched sound.
[13:48] <MadPig> JEEB: Nothing special. Just to .avi with -sameq.
[13:48] <JEEB> sameq does not do what you think it does
[13:48] <MadPig> Fixes tons of things, apparently.
[13:48] <MadPig> Well, whatever it really means, doing this has fixed a ton of problems for me.
[13:48] <MadPig> But I have to conclude that VLC's record feature is useless.
[13:49] <JEEB> it has nothing to do with the "fixes" you see that might be because VLC can have its own share of bugs or problems depending on versions
[13:49] <JEEB> I'm just saying that sameq is not "Same Quality"
[13:49] <JEEB> if you thought it was that
[13:49] <JEEB> it's "copy quantizers from source"
[13:49] <JEEB> which is a possible debugging feature
[13:49] <JEEB> only useful for developers
[13:49] <MadPig> I honestly have no idea what kind of compression algorithm/codec ffmpeg uses by default when outputting to .avi, but it clearly uses SOMETHING, and something GOOD at that.
[13:50] <MadPig> Because the resulting files are very small and nice.
[13:50] <JEEB> look at the log?
[13:50] <JEEB> output onto the terminal/command line
[13:50] <JEEB> anyways, just don't use sameq, I can give you alternatives for that
[13:50] <JEEB> don't start another ghetto voodoo usage case please
[13:50] <MadPig> I do use the command line (is there a GUI at all?), but it's gone once it finishes.
[13:51] <MadPig> Ghetto voodoo usage case? :S
[13:51] <JEEB> let me guess, you're on windows :P
[13:51] <MadPig> Yes.
[13:51] <JEEB> anyways, start the cmd.exe before running the command, or add a pause command to the batch file
[13:51] <JEEB> to keep the command line open
[13:52] <MadPig> It runs the command directly through a special thing... kinda hard to explain.
[13:52] <MadPig> But in general, what does it do?
[13:52] <MadPig> It is like magic.
[13:52] <JEEB> it does exactly what it does, depends on the version too
[13:52] <JEEB> older versions of ffmpeg defaulted to 200kbps MPEG-1
[13:53] <JEEB> newer versions actually have saner defaults for various containers
[13:53] <MadPig> Hmm...
[13:53] <JEEB> and some encoders got saner defaults, like libx264 (instead of the usual "200kbps, everything set to the same line as an MPEG-1 encoder" you get -preset medium -crf 23, which is the default of the library too)
[13:53] <MadPig> "it does exactly what it does" makes no sense.
[13:54] <MadPig> But let me explain a discovery I just made...
[13:54] <MadPig> I was going to look up the "sameq" thing in the manual, but I found that it is gone. No mention of it left.
[13:54] <JEEB> yes it makes, there is a default set somewhere in the source code and I just told you that it even differs between versions (from like a year ago and before that)
[13:54] <MadPig> The closest is: "-same_quant"
[13:54] <MadPig> "Note that this is NOT SAME QUALITY. Do not use this option unless you know you need it."
[13:54] <JEEB> yup, that's sameq too
[13:54] <MadPig> They must have updated the manual in the last couple of months.
[13:55] <JEEB> they removed it completely from the docs for a reason and gave it a new alternative name
[13:55] <MadPig> To remove all mentions of "sameq".
[13:55] <MadPig> I who felt that it made a difference...
[13:55] <JEEB> yeah, we still get people using sameq every month or so
[13:55] <MadPig> It was all in my head?
[13:55] <JEEB> it can make a difference, but you seriously don't want to generally copy quants from the input
[13:55] <JEEB> you really don't
[13:56] <MadPig> Can make a difference in what sense?
[13:56] <MadPig> And what is the downside to this?
[13:56] <JEEB> it might make an input that looks good in some case, in other case it might just overblob the output size and in other case it might just look atrocious
[13:56] <JEEB> downside is that you're just blindingly taking quants from the input
[13:56] <JEEB> even if it's a completely different format
[13:56] <JEEB> yes, different formats have different quant ranges
[13:56] <JEEB> and really, visual quality has nothing to do with having the same quants
[13:57] <MadPig> Hmm...
[13:57] <MadPig> I hate it when I realize that I've been doing something wrong.
[13:57] <JEEB> we all do
[13:57] <MadPig> I also hate it when I don't know how many of the issues I've had were caused by this.
[13:58] <MadPig> Okay... I just made another discovery.
[13:58] <JEEB> the closest to a "set visual quality" is libx264's -crf, which is constant rate factor (variable variable (latter per macroblock) quantizer depending on the "complexity" of the area)
[13:58] <MadPig> Please hear my out.
[13:58] <MadPig> So I have this .avi which I ffmpeged with -sameq a few minutes ago before this convo, from the .vob, right?
[13:59] <MadPig> I just ran the new ffmpeg command WITHOUT -sameq on that .avi... and the result was not another 1 GB file but a 57 MB large one... with TERRIBLE, visibly much worse video quality.
[13:59] <JEEB> yes, because you're letting ffmpeg to select some default which is not always sane
[14:00] <JEEB> just launch it in a way that you see what it outputs into the log damn it
[14:00] Action: JEEB kicks MadPig 
[14:00] <MadPig> JEEB: I don't get what you mean now.
[14:01] <MadPig> Clearly, this must be automated. I cannot be forced to look at the output and adjust some command line option each time.
[14:01] Action: JEEB sighs
[14:01] <MadPig> JEEB: I also ran a conversion from straight .flv to .avi without -sameq, and it also produced worse quality.
[14:01] <JEEB> just... let me finish this sentence, ok?
[14:01] <MadPig> Sure...
[14:02] <JEEB> I'm just telling you that the bit rate/rate control mode you might be getting by default in ffmpeg is not always what you want. Libx264 lately got a very good change to the library defaults (crf 23 and the medium speed/compression preset), but this does not go around all possible video/audio codecs available.
[14:02] <JEEB> To see what on earth ffmpeg selected for you, you _probably_ want to look at that command line output it did
[14:03] <JEEB> which autocloses for you right now
[14:03] <JEEB> are you catching up to what I'm saying?
[14:03] <JEEB> what I'm hinting at is that leaving ffmpeg without any options isn't always what you want, even now when some defaults have gotten rather nice
[14:03] <MadPig> The thing is, I'm normally not at all interested what ffmpeg selected for me, nor in looking it up myself and editing command line arguments. It must be automated.
[14:04] <JEEB> yes, we all wish we had 9000 chinese kids to pick the best settings for us so we wouldn't have to think
[14:05] <JEEB> but /really/ , do you think EVERYONE who ever f.ex. uses the AVI container wants the same video/audio codec to be used?
[14:05] <JEEB> do you think everyone has the same rate control needs?
[14:05] <MadPig> This may be some kind of bizarre coincidence, but so far, not using -sameq has produced terrible, horrible abominations of video conversions, whereas using -sameq has produced identical copies in a better format and often much smaller size. I don't know how to judge this in any other way.
[14:05] <MadPig> I don't know. I'm not an expert.
[14:05] <MadPig> That's why I'm talking to you.
[14:06] <JEEB> And for me you are right now looking like an obnoxious person who insists that ffmpeg should be reading their mind
[14:06] <JEEB> anyways
[14:06] <JEEB> let's demonstrate something
[14:06] <MadPig> Not reading my mind... reading the file. :-)
[14:06] <JEEB> and what should be input file saying to it?
[14:06] <JEEB> the input is the input
[14:06] <JEEB> output is the output
[14:07] <MadPig> "Play this back for your inner tin eye and output something that looks and sounds identical but in a better format."
[14:07] <JEEB> sorry, that's just impossible.
[14:07] <JEEB> as I said, the crf option of libx264 is the closest for that, but you still have to set it to your eye
[14:07] <MadPig> It appears to be exactly what it is doing, but again, I could be insanely lucky (which would be a nice change).
[14:08] <JEEB> yes, so far you've been lucky probably because of the quantizer difference/similarity in MPEG-2 and MPEG-4 Part 2 (xvid/divx, which I /guess/ ffmpeg picks with dot-avi output)
[14:08] <MadPig> Another thing I've considered is that this -sameq option might be doing something I don't want in theory, but also enables something else that I do want.
[14:08] <JEEB> but as I already said, copying quantizers does not mean you will keep the quality
[14:09] <JEEB> anyways, just as a test, check out ffmpeg -i derp.input -c:v libx264 -crf 20 out.mp4
[14:09] <MadPig> Well, my eyes think so. I see a VERY noticable difference when I compare it to not using -sameq. But I think you're trying to say that one should have to know the... stuff... and manually enter the value for each video file?
[14:09] <MadPig> Alright. Give me a minute.
[14:10] <JEEB> yes, without sameq it just falls upon the shoulders of ffmpeg to select a default. That default can either be from the ancient times of "everything defaults to 200kbps" or it can be more sane (libx264's -crf 23 -preset medium)
[14:10] <MadPig> That command you provided worked for the .flv I tested.
[14:11] <JEEB> libx264 probably gets selected by default for mp4/mkv, but I know I want H.264 so I set the video codec to libx264 (the best H.264 encoder around)
[14:11] <JEEB> I set crf to 20
[14:12] <JEEB> 20 is an arbitrary number that picked from the bin of "what generally looks good for someone and what can then be reworked to find the highest that still works good"
[14:12] <MadPig> Hmm...
[14:12] <JEEB> on the background it is now only setting the audio codec and the preset for libx264
[14:12] <JEEB> preset is defaulted to "medium"
[14:12] <JEEB> audio I dunno, but you should have seen by the output of ffmpeg
[14:12] <JEEB> s/still works good/still looks good/
[14:13] <JEEB> (because the highest crf value that still looks good for you will offer you the highest compression)
[14:13] <MadPig> Hrm...
[14:15] <MadPig> Well, you've certainly given me things to think about in regards of ffmpeg and video conversion.
[14:15] <MadPig> Having said that, I will probably keep my setup until I fully understand it.
[14:15] <JEEB> also, crf is not perfect, just like any other algorithm, and does have several edge cases. if the thing you're encoding is wildly different than the other, the quality might differ because the source is quite different. for SD content you usually zoom it up when you watch it so usually you need to use a bit lower crf value to get the same visual quality, and for HD it's usually not blown up as much so you can use a higher one
[14:16] <JEEB> there's nothing to understand in your setup and start running ffmpeg in a damn way that shows you the log already
[14:16] <JEEB> you're just leaving stuff to the defaults which might pretty surely be not what you want
[14:16] <JEEB> I'm trying to point you towards the best video encoder and then one of the best audio encoders to get you the best bang out of it
[14:17] Action: JEEB sighs
[14:17] <MadPig> Does ffmpeg offer a way to pause itself after running as a parameter? Because this ffmpeg command is run directly, so it cannot "pause" like a bat file.
[14:17] <JEEB> you can hit the pause key on the keyboard IIRC, at least x264's command line encoding tool has that, ffmpeg could have it too. Also, just open up a damn terminal/command line already
[14:18] <JEEB> or use a damn batch file
[14:18] <MadPig> That would defeat the whole purpose of the convenient shortcut setup.
[14:18] <JEEB> eh
[14:18] <JEEB> you can have batch files that you can just drag and drop files onto
[14:18] <JEEB> you can have batch files that deal with all files in the folder
[14:19] <JEEB> you have on some systems even powershell or whatever it was if you like it the DotNet way
[14:19] <MadPig> I am aware of the drag-and-drop-ability of files into bat files, but it's still much more annoying than a context menu item and whatnot.
[14:20] <JEEB> to the expense that you ABSOLUTELY ZERO IDEA OF WHAT YOU ARE DOING
[14:20] <JEEB> *you have
[14:20] <MadPig> While I personally like to understand things, most people (and me as well in many cases) want a "black box where you throw stuff into and then get what you want out of it".
[14:21] <JEEB> you can set the thing to just use libx264 and some aac encoder, and produce an mp4 file out of that that's playable in flash even
[14:21] <JEEB> and have that be quite what you need for that kind of stuff
[14:21] <JEEB> "set up once and then just be braindead" is OK
[14:21] <MadPig> I guess I'm confused as to why that's not the default (zero arguments except for the input and output file) behaviour.
[14:22] <JEEB> because ffmpeg's defaults were never really like that. I guess if you actually look at the output right now by doing ffmpeg -i input out.mp4 you might actually get H.264+AAC with crf 23 and preset medium, but that is definitely not set for most other stuff
[14:22] <JEEB> I think mkv now has H.264+vorbis
[14:23] <JEEB> ffmpeg has been getting better, but it's still in many cases not something you can just do ffmpeg -i input output with
[14:23] <relaxed> the default used to be 200k for mpeg4/mpeg2
[14:23] <JEEB> I think it was even mpeg-1
[14:23] <JEEB> at 200kbps
[14:23] <relaxed> which of course looked awful
[14:23] <JEEB> and yeah, I think the MPEG-4 Part 2 encoder still does 200kbps which would explain the removal of -sameq looking /awful/
[14:23] <JEEB> (and being small)
[14:24] <MadPig> I get that ffmpeg is very powerful and has many obscure uses, but do you at least understand what I'm trying to say? I think that it would make sense for the default to be "ffmpeg figures out everything and outputs an identical copy in the format I want".
[14:24] <relaxed> The whole point of a batch script is to define a new default. ffmpeg isn't a mind reader.
[14:24] <JEEB> "ffmpeg figures out everything and outputs an identical copy in the format I want" <- define "identical copy"
[14:24] <MadPig> "As close as possible".
[14:24] <JEEB> we have some ways of defining the amount of difference from a source
[14:25] <JEEB> but those have NOTHING to do with visual quality
[14:25] <JEEB> PSNR for example is one of the older ways of doing that, and that LOVES blurring
[14:25] <JEEB> SSIM is a newer one, but still has plenty of problems
[14:26] <MadPig> :S
[14:26] <JEEB> long story short, we just don't have that AI that'd be needed to compare visual quality
[14:26] <JEEB> not to mention, do we make the default something to my eyes, or to your eyes, or to the eyes of the masses?
[14:26] <JEEB> my eyes have grown so accustomed to compression artifacts I spot them easily in most cases
[14:27] <JEEB> bad screens don't help at showing off dithering either
[14:27] <MadPig> It sure appears to be even more complicated than I first thought.
[14:27] <JEEB> glad you are finally kind of grasping it
[14:28] <relaxed> Things like support for 6 aac encoders doesn't help either.
[14:28] <relaxed> Or that there's an internal vorbis encoder that sucks.
[14:29] <relaxed> You just have to read, bang your head against a desk or use something like handbrake if that's too much.
[14:29] <JEEB> anyways, you might actually get closer to what you want if you would have used dot-mp4 or dot-mkv as output instead of dot-avi without other settings depending on the ffmpeg version and so forth
[14:29] <JEEB> but still, it just shows that defaults be defaults and they are there for various reasons and they're not all equal
[14:29] <JEEB> they used to be equal, equal in crappiness before
[14:29] <JEEB> (all video codecs at 200kbps etc.)
[14:30] <JEEB> heck, libx264 until this day has a special error pop up if you try to use the old ffmpeg defaults
[14:30] <JEEB> because they sucked
[14:30] <Tjoppen> I find the avi defaults rather embarassing. ffmpeg.c could at least do something like "hmm, let's go with width+height kbps"
[14:31] <relaxed> I think mpeg* should default to -q 3 or 4
[14:32] <JEEB> I wish something like crf could be ported to the older formats
[14:32] <Tjoppen> that'd be lovely
[14:32] <relaxed> indeed
[14:32] <JEEB> although to be honest I'm just thankful if not having something like crf would make people use those formats less
[14:33] <Tjoppen> let's improve my cinepak encoder for -crf support! :>
[14:33] <JEEB> kekeke
[14:33] <quizme> hi, i would like to compile a C program to generate an H.264 stream from a sequence of jpeg images.
[14:34] <quizme> can anybody advise me on how to do that ?
[14:34] <quizme> pretty please?
[14:34] <quizme> with a cherry on top
[14:35] <Tjoppen> follow some generic ffmpeg+x264 encoding guide and give it -i foo%d.jpg?
[14:35] <saste> quizme: doc/example/decoding_encoding.c
[14:35] <Tjoppen> wrap it as a script
[14:35] <quizme> thank you
[14:35] <Tjoppen> if it *must* be a program, then strip down ffmpeg.c until it does what you want :)
[14:36] <quizme> hmm ok
[14:36] <JEEB> MadPig, anyways the "best" alternative for you if you also need to have the thing opened in something non-open source (flash/commercial player) right now is libx264 and some AAC encoder in mp4 (I think the latter is currently a default for mp4 output, but you might want to play with the audio bitrate [-b:a 192k f.ex.])
[14:36] <JEEB> so find the slowest preset you can take, and the highest crf value that still looks good and start running stuff like that
[14:36] <JEEB> list of presets: http://mewiki.project357.com/wiki/X264_Settings#preset
[14:36] <Tjoppen> libfdk_aac is the way to go at the moment, right?
[14:36] <JEEB> yes, too bad it's not GPL compatible :<
[14:37] <Tjoppen> yeah, I noticed that :\
[14:37] <JEEB> I hope Google/fraunhofer settle that
[14:37] <Tjoppen> luckily it doesn't prevent using it on backends
[14:37] <JEEB> yeah
[14:37] <JEEB> because for some reason fraunhofer just opted for a custom license that is very close to GPL, but can be read in a non-GPL-compatible way
[14:38] <JEEB> the money-related stuff
[14:40] <quizme> if i had a sequence of jpeg images, 320 X 200 pixels, using C, could i turn that into an H.264 stream in real time @ say 30 fps on a newish 2012 computer?
[14:41] <Tjoppen> yes
[14:42] <Tjoppen> you can try with something like ffmpeg -i foo%d.jpg -vcodec libx264 -crf 20 out.mp4
[14:42] <quizme> Tjoppen thank you, i'll try that
[14:43] <Tjoppen> then as I said above: either stick your settings in a shell script, or modify/stip ffmpeg.c down. those should be the easiest ways I think
[14:43] <quizme> tjoppen: i am trying to have native client do it in Chrome
[14:44] <quizme> tjoppen so probably modify/strip ffmpeg.c down is the way to go
[14:44] <Tjoppen> uh.. ok
[14:45] <Tjoppen> yeah, just try something like hacking around with the argument parsing
[14:46] <Tjoppen> that way you maintain the possibility of say changing the framerate etc. if you like
[14:46] <quizme> tjoppen thanks so much for the advice
[14:46] <Tjoppen> you might also want to ./configure stuff so you don't include tons and tons of crap. else your binary with be tens of megs larger than it needs to be
[14:57] <Yexo> quizme: if you don't mind really hacky, rename the main function in ffmpeg.c to main2 and write your own main function: int main(int argc, char **argv) { main2(4, {argv[0], "-i", "input_files_%d.jpg", "output.mp4"}); }
[15:01] <Tjoppen> yeah, that works too
[15:20] <aimzz> hey guys, I could need some help. I am filling AVFrames with microphone input. that works, i have already written the frames into a file and played the
[15:21] <aimzz> file with audacity. Now i want to encode to mp3 using avcodec_encode_audio2. the function returns 0, which tells me the paket got filled. got_output is 1.
[15:22] <aimzz> now i try to save the pakets to a file like in the encoding/decoding example using fwrite: fwrite(pkt.data, 1, pkt.size, f2);
[15:23] <aimzz> if i play the generated mp3 it contains a lot of random noise and what i spoke into the mic is not recognizable
[15:23] <aimzz> any ideas what could be wrong?
[15:25] <saste> aimzz: try to encode to MP2, i'm not sure an MP3 file can be written that way (without a muxer)
[15:25] <aimzz> saste, thanks i will try that right now
[15:26] <saste> also check that what you're capturing is correct, that seems the more error prone part
[15:27] <aimzz> ok i tried mp2, gives me the same problem
[15:28] <saste> aimzz: are you sure it is not a problem with the input?
[15:28] <saste> also when you encode, you have to make sure that the parameters of the raw data match the parameters set in the codec context
[15:28] <aimzz> well i think capturing itself works. If i save the not-encoded avframes to a file and open that file with audacity (can open uncompressed audiofiles) everything is perfect
[15:28] <aimzz> yes
[15:29] <saste> can you still recognize the audio?
[15:29] <saste> i mean it somehow resembles what you record?
[15:29] <aimzz> yes a bit
[15:29] <saste> maybe an endian issue
[15:29] <saste> you pass LE, and the encoder expects BE, or the other way
[15:30] <saste> the result is that the input is strongly distorted, but still recognizable
[15:30] <aimzz> yeah my AVFrames are LE
[15:30] <aimzz> ok i will maka a quick test change my recordings to BE
[15:32] <aimzz> same problem :/
[15:33] <saste> aimzz: check that data params == codec params
[15:35] <aimzz> i checked frame.nb_samples=c.frame_size. thats ok, both values are 1152. Next parameter is the format/sample_fmt. My incoming data is Unsigned 8bit(frame.format=AV_SAMPLE_FMT_U8), mp3 doesnt accept that sample_fmt, so i had set c.sample_fmt to AV_SAMPLE_FMT_S16.
[15:35] <aimzz> Might that be the problem?
[15:36] <saste> aimzz: you nailed it
[15:37] <saste> aimzz: libavcodec doesn't automatically perform sample conversion, it's not his job
[15:37] <saste> libswresample can do that
[15:38] <aimzz> great, thank you. I will take a look at it now.
[15:48] <aimzz> saste are those the correct functions for sample conversion? http://ffmpeg.org/doxygen/trunk/group__lavc__resample.html
[15:49] <saste> aimzz, that interface is deprecated and will be dropped soon or later
[15:49] <saste> you should use libswresample
[15:50] <JEEB> or libavresample, whichever API you like
[15:50] <JEEB> (yes, there are two APIs now)
[15:50] <saste> still we miss use examples in doc/examples
[15:50] <saste> aimzz, check how it is used in libavfilter/af_aresample.c
[15:50] <aimzz> ok thanks i will take a look at af_aresample.c
[16:02] <ubitux> libswresample/swresample-test.c as well
[16:04] <JEEB> I really wonder if anyone has compared the libavresample and libswresample APIs. nev f.ex. used libavresample in LAV Filters (he uses ffmpeg so the selection didn't come out of "he uses the other fork")
[16:16] <saste> JEEB: what about asking him?
[16:16] <saste> I didn't follow much development of both so can't say
[17:35] <nebiki> i was wondering, since there are already a few encoding programs out there which use cuda/nvenc/quicksync/opencl to offload the encoding to the gpu. is it planned to have that feature included in ffmpeg at some point? or is it already possible and i'm just too blind/dumb to see it?
[20:00] <zimbatm> nebiki: most of GPU offloading that you'll fine are for decode. and that's also the case with ffmpeg
[21:29] <Element9> how can I pad the output video and not the input video?
[21:30] <spal> how can I add an image to an mp3 and make a video?
[21:37] <spal> I am using ffmpeg version 0.11.1
[21:37] <relaxed> spal: ffmpeg -i audio.mp3 -loop 1 -i image.jpg -c:a copy -c:v mpeg4 -q:v 4 output.mkv
[21:38] <relaxed> put -shortest after image.jpg
[21:50] <killown> how can ffmpeg detect alsa if opensuse 12.2 has no libasound2-devel it's called alsa-devel?
[22:08] <relaxed> killown: it doesn't care about the name of the package, it's looking for certain headers
[22:09] <relaxed> run ./configure and look for "Enabled indevs:" and see if alsa is listed. If so, ffmpeg will be compiled with alsa support.
[22:10] <killown> relaxed, it wouldn't automatically find the headers? it's not finding alsa-devel
[22:12] <killown> relaxed, http://bpaste.net/show/SntjMZfsin0EGLvjfmln/
[22:12] <killown> still has no alsa on ffmpeg -formats
[22:19] <relaxed> what are you passing to configure?
[23:03] <jordan__> how is it that video editors are able to jog through the video so effortlessly such as Windows MovieMaker which seems to have a dependency on WMP, and my .net mediaelement which is dependent on WMP as well sucks at jogging
[23:04] <jordan__> what's the trick?
[23:05] <jordan__> how are these movie editors able to jog so fast, my jogging is too laggy
[23:06] <jordan__> or at least be able to hover over the the timelline to see an image like in netflix
[23:53] <ike__> Informational Question.  Why is there no 23.98 and 24 fps support in MXF muxer? It seems like this would be a common request because of the Digital Cinema Package format standards.
[23:55] Action: JEEBsv peeks at the source
[23:58] <JEEBsv> it seems like the format has timestamps as well as a timecode_base, as well as a rational timebase
[23:58] <JEEBsv> int timecode_base;       ///< rounded time code base (25 or 30)
[23:59] <JEEBsv> what specification are the 24000/1001 and 24 frames per second formats specified?
[23:59] <JEEBsv> *specified in?
[00:00] --- Sat Sep  8 2012


More information about the Ffmpeg-devel-irc mailing list