[Ffmpeg-devel-irc] ffmpeg.log.20150119
burek
burek021 at gmail.com
Tue Jan 20 02:05:01 CET 2015
[01:32] <ac_slater> hey all. I have an AVPacket that is a demuxed h.264 stream. What's the best way to separate the packet.data into NAL units ?
[01:34] <fmiz> Why the startpts of a webcam input is not 0?
[03:38] <pentanol> fmiz not /dev/video0 ?
[06:30] <ac_slater> hey all avformat_find_stream_info() is timing out for me with RTSP streams sometimes. What do you think the chances are that I could fill a demuxer/decoder structure pair myself?
[06:32] <ac_slater> ie - I know the properties before hand
[08:10] <jeanre> guys, im extracting a frame from a video
[08:11] <jeanre> 00:05:00, frame 2 @ 29.95 FPS should be frame 8987
[08:11] <jeanre> but when I open the screenshot
[08:11] <jeanre> the time code is 00:04:59;25
[08:12] <jeanre> so its using the 25th frame on the previous second
[08:14] <jeanre> its not really accurate
[08:17] <jeanre> the command I am using is ffmpeg -i ./fixtures/timecode.mp4 -vf "select=gte(n\, 8987)" -vframes 1 8987.png
[08:21] <jeanre> its accurate until the minutes start inceasing
[08:25] <jeanre> any ideas guys?
[08:32] <jeanre> how can it be this inaccurate?
[08:34] <BtbN> No idea, have you tried frame 9000?
[08:35] <BtbN> which would be 30 fps
[08:36] <jeanre> hmm
[08:37] <jeanre> that gives me 00:05:00;10
[08:37] <jeanre> wtf
[08:38] <jeanre> BtbN thanks though :P
[08:54] <jeanre> im not sure why it is 7 frames out
[08:54] <jeanre> but it seems to shift as the time increases
[08:55] <jeanre> BtbN any other ideas?
[09:12] <jeanre> this has to be possible
[09:28] <jeanre> no one has any ideas?
[09:34] Action: jeanre is confused
[10:06] <jeanre> ok so I got it slightly more accurate but the first frame is still screwed
[10:58] <jeanre> im doing an extraction of frames
[10:59] <jeanre> if I want the first frame is returns 00:04:59;29 the send one is 00:05:00;2
[10:59] <jeanre> why is the first frame off
[11:05] <relaxed> you could cheat and dump them all, then pick what you need
[11:10] <BtbN> maybe there simply is no frame which is at exactly 00:05:00?
[11:22] <k_sze> Who uses the directshow input of ffmpeg on Windows?
[11:24] <BtbN> If you want help with that, asking your actual question is much more likely to get you any.
[11:26] <jeanre> BtbNit should be 00:05:00;01
[11:27] <jeanre> because its the first frame on 5 minutes
[11:27] <jeanre> if there are 29.97 frames per second
[11:27] <jeanre> I think the calculation I am doing
[11:28] <jeanre> BtbN https://github.com/ikhasi/video-frame-extractor
[11:28] <jeanre> thats the code I am running now
[11:28] <jeanre> the first frame is always off
[11:30] <jeanre> it jumps from 00:04:59;29 -> 00:05:00;02
[11:30] <jeanre> which makes no sense
[11:30] <jeanre> its skipping the first frame (maybe dropframes)
[11:31] <jeanre> but not too sure
[11:34] <jeanre> how can it be
[11:40] <jeanre> BtbN any ideas?
[11:41] <BtbN> no
[11:41] <jeanre> BtbN thanks dude
[11:42] <BtbN> I'm not even sure i understand what you are trying to do, except you want to extract one or multiple frames from a video, and some timestamp isn't what you think it should be.
[11:43] <jeanre> one frame
[11:43] <jeanre> so each second has 29.97 frames
[11:44] <jeanre> I want frame 2 on the fifth second
[11:44] <jeanre> or frame 1
[11:44] <jeanre> or frame 3
[11:44] <BtbN> And what makes you think that you don't get that frame?
[11:44] <BtbN> Is it some test video with timestamps in each frame, or some ffmpeg output?
[11:44] <jeanre> because I am using a video with timecode burn
[11:45] <BtbN> And you are sure that the entire test video isn't just off by one?
[11:45] <jeanre> when I open the images created the first extract on 00:05:00 is actually 00:04:59
[11:45] <jeanre> the video is fine, because all other frames are correct
[11:45] <jeanre> you can however check my code on github that does the frame etracting
[11:45] <jeanre> *extracting
[11:46] <jeanre> the second frame and all the others are correct
[11:46] <jeanre> just the first one
[11:46] <BtbN> did you check that the number it calculates are actualy consecutive frames?
[11:47] <jeanre> and the funny thing is
[11:47] <jeanre> if I start extracting from 00:00:00
[11:47] <jeanre> it works fine
[11:47] <jeanre> yes I have
[11:48] <BtbN> I'd blame that on floating point rounding inaccuracies
[11:48] <jeanre> yes
[11:48] <jeanre> but I have no idea how to compensate for that
[11:48] <BtbN> well, don't use floats
[11:48] <jeanre> im not parsing floats
[11:49] <jeanre> well even without doing it
[11:50] <jeanre> same effect without or with floats
[11:50] <jeanre> I think its drop frames
[11:51] <jeanre> this is my calculation to calc the frame
[11:51] <jeanre> seconds = (+hours) * 60 * 60 + (+minutes) * 60 + (+seconds);
[11:51] <jeanre> return (seconds * frameRate) + frameNumber;
[11:51] <jeanre> where frame rate will be 29.97
[11:51] <jeanre> and the frame number 1 or 2 or 3
[11:53] <jeanre> its confusing as hell
[11:54] <jeanre> for instance passing time of 00:01:00 in and extracting the first 10 frames
[11:54] <BtbN> what ffmpeg version are you using?
[11:55] <jeanre> the first extract is 00:01:00;02
[11:55] <jeanre> wtf
[11:55] <ramiro> jeanre: did you try changing -vsync?
[11:56] <jeanre> hmm
[11:56] <jeanre> no idea
[11:57] <BtbN> Also, did you try the -ss option to seek via ffmpeg itself?
[11:57] <BtbN> Instead of calculating frame numbers
[11:57] <BtbN> since ffmpeg 2.1 -ss should be accurate
[11:57] <nichego> hi. is there a way to tell ffmpeg what source address to use for hls? (i have a network interface with multiple addresses)
[11:58] <jeanre> 2.4.4
[11:58] <jeanre> is what I am using
[11:58] <BtbN> So, then just try with -ss
[11:58] <jeanre> so hh:mm:ss.frames?
[11:58] <BtbN> no idea if it expects frames after the seconds
[11:59] <jeanre> its miliseconds
[11:59] <Elirips> Hello. I have an external source which creates one bitmap per second. I need to transform those bitmamps into a "live Stream". Can I take an ffmpeg, and serve one bitmap every second to that ffmpeg and let ffmpeg create a 5 fps stream out of that?
[11:59] <jeanre> so I need to calculate the milisecond per frame
[11:59] <jeanre> if there are 29.97 frames per second
[12:01] <BtbN> why calculate frames at all?
[12:01] <BtbN> -ss takes the exact timestamp you want
[12:02] <jeanre> I need to use the frame
[12:02] <BtbN> But take a timestamp as input?
[12:02] <jeanre> I have a frame no timestamp
[12:02] <Elirips> Could I just use 'ffmpeg -framerate 1/5 -i img%03d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4' but replace 'img%03d.png' with '-' to make ffmpeg read from stdin and then pipe the frames to ffmpeg? Something as simple as 'cat myimg.bmp | ffmpeg-process' ?
[12:03] <BtbN> your code on githut uses a timestamp though
[12:03] <jeanre> timestamp for hh:mm:ss + frame
[12:03] <jeanre> it takes a frame
[12:03] <relaxed> Elirips: cat myimg.bmp | ffmpeg -f image2pipe -i -
[12:03] <jeanre> so it will be 29.97 * frame Iwant
[12:03] <BtbN> yes, i don't see the problem there?
[12:04] <BtbN> Just keep getting the frame like you are right now.
[12:04] <BtbN> And seek to that timestamp via -ss
[12:04] <BtbN> no calculations needed at all
[12:05] <Elirips> relaxed: thank you. My real problem is a little bit more: The images are created constantly from another programm, and I need one ffmpeg that "runs forever" and listens to stdin, and then every second a cron-job will feed one image to ffmpeg. But I guess that could be done somehow. Or is this already built-in?
[12:05] <Elirips> ie, is there a function if ffmpeg like 'Create a video from the file in directory X and refresh that directory every y seconds' ?
[12:06] <jeanre> BtbN
[12:06] <jeanre> I am not understanding what you are saying
[12:06] <jeanre> I need to seek to frame 1 on 00:05:00
[12:06] <BtbN> yes, then just seek to 5 minutes with -ss, and then extract frame 1?
[12:06] <jeanre> 300 seconds in
[12:07] <jeanre> so it should in theory seak to 329.97
[12:07] <jeanre> wait no
[12:07] <relaxed> Elirips: No, you would have to script it
[12:08] <jeanre> it should seek to 300 + frameNumber * frameRate / 60
[12:08] <Elirips> relaxed: okay, I will try. Bad luck that I'm on windows for that part :(
[12:08] <BtbN> jeanre, no, why? Just seek to your timestamp, and extract your frameNumbr.
[12:08] <BtbN> +e
[12:08] <jeanre> BtbN how would I do that
[12:08] <BtbN> <BtbN> yes, then just seek to 5 minutes with -ss, and then extract frame 1?
[12:08] <jeanre> I think my command is wrong
[12:09] <Elirips> relaxed: Need a mfc app that creates the bitmaps every second (needs activeX to access the source, so it must be MFC), on start creates a ffmpeg-instance and the stdouts to that ffmpeg
[12:09] <Elirips> I already now that it will be a pain to pipe to stdin of an external process from an mfc app - hell yea
[12:09] <jeanre> ffmpeg -r 1 -i ' + filePath +' -ss ' + time +' -vframes 1 ' + frameNumber + '.png -y
[12:10] <BtbN> -ss is an input option
[12:10] <BtbN> so it has to be in front of your input file.
[12:10] <BtbN> and you propably want to get rid of that 1
[12:10] <BtbN> also, the -frames:v parameter is the number of frames to extract
[12:10] <relaxed> Elirips: I know zilch about windows scripting
[12:10] <BtbN> why not just keep using the method you currently use?
[12:10] <jeanre> ok
[12:10] <BtbN> and only add -ss
[12:11] <jeanre> command = 'ffmpeg -r 1 -ss ' + time + ' -i ' + filePath +' -vframes 1 ' + frameNumber + '.png -y';
[12:12] <BtbN> That's now how your code on github extracts a specific frame number.
[12:12] <jeanre> ok
[12:12] <jeanre> thats works sorta
[12:12] <jeanre> command = 'ffmpeg -r 1 -ss ' + time + ' -i ' + filePath +' -vf "select=gte(n\\, ' + frameNumber +')" -vframes 1 ' + frameNumber + '.png -y'
[12:12] <jeanre> executing with 00:01:00
[12:12] <jeanre> as the time
[12:13] <jeanre> the video burn is 00:00:59;01 for the first frame
[12:13] <jeanre> second is 00:00:59;02
[12:13] <jeanre> why is it loosing a second?
[12:14] <jeanre> if I remove the -r 1
[12:14] <jeanre> the first image is 00:00:01;02
[12:14] <jeanre> urg
[12:16] <jeanre> if I change the time to 00:05:00
[12:16] <jeanre> the first extracted image is 00:04:59;09
[12:17] <jeanre> that makes no sense
[12:17] <jeanre> even if frame number is 1
[12:17] <BtbN> well, propably something doesn't agree with that framerate.
[12:18] <jeanre> im not even touching the frame rate now
[12:18] <BtbN> ffmpeg still needs to take it into account when seeking to the timestamp
[12:19] <jeanre> so -r is the rate IIRC..
[12:19] <jeanre> so if I set that to 29.97 it still freaks out
[12:19] <jeanre> if I remove -r
[12:20] <jeanre> the first frame is 00:05:00;03
[12:20] <relaxed> -ss is more accurate after the -i
[12:20] <relaxed> (in case you didn't know)
[12:20] <BtbN> I'm not even sure if -r does anything for non-raw input format. At least that's what the manpage says
[12:21] <jeanre> relaxed if I move it to after
[12:21] <jeanre> everything is 00:05:00;02
[12:22] Action: jeanre bashes head
[12:23] <jeanre> relaxed any other ideas?
[12:23] <_vaibhav_> Hi, am trying to make hls playlist, using following command : ./ffmpeg -i ~/source.mp4 -map 0 -codec:v libx264 -codec:a libfaac -f ssegment -segment_list playlist.m3u8 -segment_list_flags +live -segment_time 10 out%03d.ts
[12:24] <_vaibhav_> but it generates playlist which has floating point segments. I want to make those in pure integer so that older players also support.
[12:25] <_vaibhav_> is there any way I can get -no-floating-time , something like that/
[12:25] <_vaibhav_> ?
[12:26] <relaxed> jeanre: maybe, ffmpeg -vsync passthrough -i input -ss 00:05:00.02 ...
[12:27] <BtbN> i think he means frame no. 2 with his timestamp, not milliseconds or something
[12:27] <relaxed> oh
[12:27] <jeanre> relaxed .02 in that timecode is milliseconds not frames
[12:30] <relaxed> do you know the exact timestamp?
[12:30] <jeanre> only hour minutes and seconds
[12:30] <jeanre> and the frame number
[12:32] <jeanre> I'm thinking I could calculate the exact millisecond by taking frameRate and calculating the correct milisecond
[12:32] <jeanre> but alas
[12:32] <jeanre> no idera
[12:32] <jeanre> *idea
[12:34] <relaxed> It's hard to troubleshoot when I can't run it locally
[12:34] <jeanre> you can
[12:34] <jeanre> I have code on github
[13:20] <Elirips> Is there somewhere a windows build from the version 2.6.54 available? Or are there only the 'latest builds' available?
[13:21] <Elirips> err, I mean the version 2.5. 64bit
[13:57] <HebusLeTroll> Hello, is it possible to add a stream and set its language without knowing its output's steam number ?
[13:58] <HebusLeTroll> (or to reference the last steam, no matter how many stream there is ?)
[13:58] <HebusLeTroll> stream*
[15:57] <tmh1999> Hi guys, I hope someone could help me. Can you explain briefly all/ or most of it the options in enum AVPixelFormat in libavutil/pixfmt.h ?
[15:59] <tmh1999> I kind of now have to rescale a video from 1920x1080 to smaller size like 360p 480p 720p, so which source pixel format and destination pixel format should I use?
[15:59] <tmh1999> Thanks.
[18:38] <grepper> what is wrong with this command? ffmpeg -i INFILE.mp4 -c:v copy -i audio1.wav -c:a aac -b:a 240k -y OUTFILE.mp4 . I get "Unknown decoder 'copy'"
[18:39] <Mavrik> grepper, parameter order
[18:39] <Mavrik> grepper, everything before "-i" means "apply to input"
[18:40] <grepper> yes, I know. But I'm not sure how to arrange that then, I thought I was putting it AFTER
[18:41] <grepper> Mavrik: ?
[18:41] <Mavrik> grepper, your "-c:v" parameter is certanly before "-i"
[18:41] <Mavrik> ;)
[18:42] <grepper> ah, so all the input files before the other options
[18:43] <dunpeal> Hi. I have a bunch of classical music CDs. What's a good lossy conversion for them?
[18:44] <Mavrik> dunpeal, high-bitrate mp3 is still the most compatible one
[18:44] <Mavrik> dunpeal, good AAC encoder should be better, but you should probably use iTunes for ripping then
[18:44] <dunpeal> Mavrik: I'm using Rockbox, so compatibility isn't an issue. My priorities are 1) quality, 2) file size
[18:44] <dunpeal> and I'm on Ubuntu, so no iTunes :)
[18:45] <Mavrik> well, filesize is set by the bitrate
[18:45] <Mavrik> and higher bitrate means more quality
[18:45] <Mavrik> also, better encoder means more quality for same bitrate :)
[18:45] <Mavrik> dunpeal, but honestly, 320kbps/48000 mp3 is going to sound awesome
[18:45] <Mavrik> or if you want to listen on the way, 192kbps/44100 AAC should be more than enough
[18:45] <Googol30> I'm partial to AAC as a lossy format. There's no shortage of options, though.
[18:46] <dunpeal> so far in my inquiries, it seemed like the very best option is libfdk_aac with a -vbr setting of 4 or 5
[18:46] <grepper> Thanks Mavrik , that worked. I had wrongly thought since -c:v applied to the video, that it was "after" . Anyway ...
[18:47] <Mavrik> grepper, yeah, ffmpeg is a bit funny about ordering
[18:47] <Mavrik> dunpeal, yes, FDK AAC is the best AAC encoder ffmpeg has
[18:47] <Mavrik> I have no idea what bitrate vbr4/5 will be, but sounds reasonable :)
[18:48] <dunpeal> Mavrik: I just encoded with -vbr 4, and it was about 128 kbps
[18:49] <Mavrik> dunpeal, if it sounds good to you, keep it :)
[18:49] <dunpeal> bitrate= 136.9kbits/s
[18:49] <dunpeal> it does, I can't distinguish between that and the original
[18:49] <dunpeal> for casual listening, I bet even 3 may be good enough
[18:50] <Mavrik> hmm, I wouldn't go lower than that with classical, since it tends to cut off some stuff
[18:51] <dunpeal> Mavrik: one more question: is there a way to preserve the tracks? I have my CDs ripped to FLAC with a .cue file.
[18:52] <Mavrik> dunpeal, you'll have to split the one-piece FLAC file into separate tracks
[18:52] <Mavrik> something like http://danilodellaquila.com/blog/how-to-split-an-audio-.flac-file-using-ubuntu-linux
[18:53] <dunpeal> Mavrik: I thought M4A supported chaptering?
[18:53] <Mavrik> Hmm, I'm not aware of players / tools that would support that well in terms of audio :/
[18:54] <Mavrik> but I might be wrong there
[20:32] <kapetr> Hello. I use avconv to encode MP4 directly from DVB card (m2ts stream). Problem is, that the captured video do not begin with key-frame and output video has damaged beginning. Is there a way to tell avconv to begin encoding at first receive key-frame (to skip no-key-frames on begin of input) ? Thanks.
[20:34] <c_14> kapetr: support for avconv is at #libav, if you want support here try again with ffmpeg from FFmpeg
[20:35] <kapetr> Sorry - is libav and ffmpeg not the same ? Even if not - it is possible in ffmpeg ? THX.
[20:37] <c_14> I don't know if there's an option for it, but I'd try again with a static build and check if the same error occurs.
[20:37] <Mavrik> um
[20:37] <Mavrik> there's no way to encode a video without starting keyframe
[20:37] <Mavrik> so you have an issue somewhere else.
[20:37] <c_14> Mavrik: you can't encode a stream without a starting keyframe, but you can receive a stream without having the starting keyframe
[20:37] <kapetr> See: http://linux.goeszen.com/simple-video-editing-with-ffmpeg.html
[20:38] <Mavrik> c_14, ah, I misread his post -_-
[20:38] <Mavrik> *grumbl*
[20:38] <Mavrik> gonna go sleep rather
[20:38] <Mavrik> "-sameq"?
[20:38] <c_14> kapetr: -sameq doesn't do what you think it does
[20:38] <Mavrik> No.
[20:38] <c_14> And shouldn't be used.
[20:38] <kapetr> CITE: "so the outputted video file might start with garbled data or simply black video (might depend on how your media player renders garbled data/ data without a starting keyframe&)."
[20:40] <Mavrik> it also seems that ffmpeg should discard broken frames before keyframe
[20:40] <c_14> kapetr: if you are using -codec copy, there is an option to copy non-key frames at the beginning (in ffmpeg at least)
[20:41] <Mavrik> when running actual encode
[20:41] <c_14> So as Mavrik just said, the default should be to discard non-keyframes before the first keyframe
[20:47] <kapetr> should ... BUT seems not t be so. E.g. Avidemux (uses libav) set start point at first key-frame, but shows, that there are some frames before it. That's why i mean, there is a way to say ffmpeg/libav to skip them.
[20:48] <c_14> Did you try using ffmpeg? You can get a static build here:
[20:48] <c_14> http://johnvansickle.com/ffmpeg/
[20:49] <c_14> And if you're using the library (which avidemux probably is) finding the first keyframe is as easy as asking for all the frames until one of them is a keyframe
[21:08] <Mavrik> kapetr, libav ISN'T ffmpeg.
[21:08] <Mavrik> so we can't really help you with issues from that software :/
[21:13] <kapetr> I have test now static ffmeg to do the same work on same m2ts file.
[21:15] <kapetr> There is difference - ffmpeg version has on begin till picture and video starts to play in the same "timestamp" as in avconf version the video begins to play withou damage.
[21:15] <kapetr> ... not till -> stil picture
[21:17] <kapetr> ffmeg output is more nice, but there are frames (as audio shows) before first key-frame too.
[21:18] <kapetr> ?? maybe - file output begins from first key-frame - but this frame is from audio stream ?
[21:23] <lyscer> anyone have any good tutorials they recommend for adding audio to an existing mp4? I have tried a couple different ones and can't seem to get the audio to merge into the video
[21:23] <c_14> ffmpeg won't drop the audio just because there isn't a video keyframe, so yeah that makes sense
[21:23] <c_14> lyscer: ffmpeg -i video -i audio -map 0:v -map 1:a -c copy outfile
[21:26] <lyscer> c_14, thanks; Any ideas how to troubleshoot it if the sound still isn't in my video?
[21:27] <lyscer> I tested the mp3 and it plays fine
[21:27] <Mavrik> lyscer, by reading the ffmpegs output
[21:27] <c_14> Throw your full commandline and complete console output on a pastebin service and throw the link here
[21:27] <Mavrik> ^^
[21:27] <lyscer> please hold...
[21:31] <lyscer> http://pastebin.com/N6Hh9959
[21:32] <c_14> So the mp3 plays fine, the video plays fine, but if you play the merged video you don't get audio?
[21:32] <lyscer> correct
[21:32] <c_14> What player?
[21:33] <lyscer> oh... I just had another idea and tried a new player and it works under the new player
[21:33] <lyscer> gah, I wasted soo much time with a non broken file on that player! Thank you for the help!
[21:33] <lyscer> c_14, thanks for the help!!
[21:37] <Mavrik> lyscer, yeah, do use aac in mp4s for maximum compatiblity :)
[21:46] <kapetr> c_14: ant is it possible to say ffmbeg to do so ? I mean to begin encode all streams from first key-frame in selected (video) stream ?
[21:47] <c_14> Can't think of one off the top of my head.
[21:49] <kapetr> thanks anyway. Good night.
[21:49] <Nopik> hi all
[21:51] <Nopik> i'm streaming some music, the source is combining songs from various sources, and therefore producing songs with different volumes, so when you listen to resulting stream, volume is often jumping up or down at song boundaries. Is there any simple way to alter the stream to normalize the volume with ffmpeg? i mean to do that in 1 pass, without knowing the
[21:51] <Nopik> volume adjustment beforehand, i.e. the filter would need to be adaptive
[21:52] <c_14> Try using the compand filter?
[21:52] <Nopik> c_14: let me see its docs first :)
[21:55] <Nopik> c_14: looks very interesting, I'll try it out. Any other options?
[21:57] <c_14> If the tracks have replaygain side-data, I think the volume filter can act on that.
[21:59] <Nopik> yeah, I've just found it as well. But I'm afraid that most of the tracks wont have the replaygain, I cannot reliably base on it
[21:59] <Nopik> anyway, thanks, it seems that compand will do the job, although I'll apparently have to experiment with it a bit
[00:00] --- Tue Jan 20 2015
More information about the Ffmpeg-devel-irc
mailing list