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

burek burek021 at gmail.com
Fri Sep 14 03:05:02 EEST 2018


[00:24:14 CEST] <Naan> has anyone used ffmpeg-python and experienced this https://github.com/kkroening/ffmpeg-python/issues/115 ?
[00:28:33 CEST] <Naan> nvm i figured it out
[03:09:46 CEST] <gustavbarnacle> Looking for some overlay help.... I'm creating a four panel video using the overlay filter and running into a speed issue.  I take four videos of similar duration (ranging from 00:05:20.00 to 00:05:21.15 duration).  All come in at about 30 fps.  I feed them into the overlay filter and it returns a final video is sped up.  All four input videos have about a 30 fps, but the output video is 25 fps.  Why?  How can I force the output video to be 30
[03:09:46 CEST] <gustavbarnacle> fps?  I'm using overlay=shortest=1 on the input and I think that might be causing my issues.  Here's my pastebin: https://pastebin.com/cK5HqPPC
[03:24:08 CEST] <furq> gustavbarnacle: it's because you're overlaying onto a 25fps source
[03:24:40 CEST] <furq> which you don't need to do at all, you can just use hstack and vstack
[03:25:40 CEST] <gustavbarnacle> furq:  Are you saying the black base I'm dropping everything on to is 25fps?  If so, how can I change that?
[03:26:12 CEST] <furq> color=r=30
[03:26:19 CEST] <furq> but like i said, you should use hstack and vstack
[03:27:43 CEST] <furq> [0:v][1:v]hstack=shortest=1[t];[2:v][3:v]hstack=shortest=1[b];[t][b]vstack=shortest=1[out]
[03:27:48 CEST] <gustavbarnacle> OK.  I'll need to do some digging about hstack/vstack and learn that.  Will hstack/vstack be faster/slower or the same.
[03:27:53 CEST] <furq> should be quicker
[03:28:09 CEST] <furq> you also don't usually need to use setpts with file sources as they should all start at 0 anyway
[03:28:19 CEST] <furq> but you can obviously still add it if you need to
[03:29:53 CEST] <gustavbarnacle> furq - all really good info.  I need to read up on this.  This 4 panel video is the last part of an extensive process which takes 20-25 minutes to produce a 5ish min video.  Speed improvements are very much appreciated.
[04:24:57 CEST] <gustavbarnacle> furq:  Thank you very much.  hstack is faster, with a much smaller output file:  200 MB vs. 250 MB.  Your help was really appreciated!
[10:55:24 CEST] <LZZ> hello, I want to encode a vp9 video with alpha transparent background to h264, where I can have alpha channel, so I want to set the background to white.
[10:55:30 CEST] <LZZ> can this be done with ffmpeg?
[10:55:47 CEST] <LZZ> where I can have alpha channel*
[10:55:53 CEST] <LZZ> can´t*
[10:57:56 CEST] <durandal_1707> LZZ: you can have alpha channel with ffmpeg
[10:58:12 CEST] <LZZ> in h264/mp4?
[10:58:27 CEST] <LZZ> will it work with browsers?
[10:59:09 CEST] <durandal_1707> LZZ: h264 does not support alpha
[10:59:21 CEST] <LZZ> yep
[10:59:40 CEST] <LZZ> so, when I encode to mp4, transparent pixels become black
[10:59:47 CEST] <LZZ> I wanted to get them white
[10:59:51 CEST] <LZZ> Is that possible?
[11:02:31 CEST] <durandal_1707> LZZ: yes, with filtering, also chech -alphablend option
[11:02:58 CEST] <LZZ> thanks, I´ll search
[11:31:16 CEST] <gryffus> Hello, i have found many examples how to loop video in length of audio, but how do i loop audio in length of video?
[11:38:06 CEST] <gryffus> I have tried this : ffmpeg -i inputvideo.mkv -i inputaudio.mp3 -map 0 -map 1 -af aloop=loop=-1 -c copy output.mkv , but i am getting "Filtergraph 'aloop=loop=-1' was defined for audio output stream 0:1 but codec copy was selected." error
[11:39:25 CEST] <LZZ> I ended up converting the video to pngs, using imagemagik to set the background to white and then joining the frames again
[11:44:12 CEST] <BtbN> gryffus, you cannot use filters in stream copy mode.
[11:44:46 CEST] <gryffus> BtbN: so should i merge the audio, cut it and then add to the video? to spped up the process?
[11:45:00 CEST] <gryffus> s/spped/speed
[11:45:12 CEST] <gryffus> i would like to avoid reencoding the video
[11:45:23 CEST] <BtbN> Just re-encode the audio
[11:45:55 CEST] <gryffus> BtbN: how do i reencode only audio and not the video?
[11:46:16 CEST] <BtbN> Specify copy for video and your codec of choice for audio.
[11:47:47 CEST] <gryffus> got it:  -af aloop=-1 -vcodec copy -acodec mp3 output.mkv
[11:47:49 CEST] <gryffus> thanks :)
[11:48:23 CEST] <gryffus> ok, the audio is not looped :(
[11:49:16 CEST] <BtbN> vcodec and acodec are deprecated, use -c:X
[11:50:47 CEST] <durandal_1707> gryffus: how long is audio?
[11:50:53 CEST] <gryffus> BtbN: ok, did, but the audio is still there only one-time :(
[11:51:27 CEST] <gryffus> durandal_1707: video: 00:02:42 , audio: 00:02:00
[11:51:47 CEST] <durandal_1707> LZZ: same can be done with overlay filterr
[11:53:37 CEST] <LZZ> durandal_1707: yes, but when I was reading about I noticed it would take longer to learn how to do that way
[11:53:42 CEST] <LZZ> thank you anyway
[11:54:28 CEST] <durandal_1707> gryffus: try -af aloop=-1:X where X is 120 * sample rate of your audio
[11:55:04 CEST] <gryffus> durandal_1707: i need to loop the audio, so it needs to be 162 then?
[11:55:49 CEST] <durandal_1707> gryffus: what is sample rate of your audio?
[11:56:40 CEST] <durandal_1707> LZZ: well what you do is very inefficient and banned here
[11:56:59 CEST] <gryffus> durandal_1707: 44.1 kHz
[11:58:08 CEST] <durandal_1707> gryffus: -af aloop=-1:5292000
[11:59:13 CEST] <gryffus> -map 0 -map 1 -af aloop=-1:5292000 -c:v copy -c:a mp3 out.mkv
[11:59:20 CEST] <gryffus> this is trying to re-encode the video
[11:59:49 CEST] <gryffus> oh sorry, i misread the output
[12:00:25 CEST] <gryffus> durandal_1707: it is encoding indefinetely
[12:00:29 CEST] <gryffus> it now has over 30 minutes
[12:00:34 CEST] <durandal_1707> stop it
[12:00:37 CEST] <durandal_1707> with q
[12:00:44 CEST] <gryffus> yeah
[12:01:16 CEST] <durandal_1707> how long you want it to be?
[12:01:34 CEST] <gryffus> durandal_1707:  00:02:42
[12:03:32 CEST] <durandal_1707> gryffus: -af aloop=-1:5292000,atrim=duration=162
[12:10:51 CEST] <gryffus> durandal_1707: sorry, got system freeze :x
[12:11:00 CEST] <gryffus> durandal_1707: i will try again
[12:11:05 CEST] <durandal_1707> gryffus: no
[12:11:19 CEST] <durandal_1707> gryffus: what you tried?
[12:11:31 CEST] <gryffus> -af aloop=-1:5292000,atrim=duration=162
[12:11:48 CEST] <durandal_1707> gryffus: what ffmpeg version ?
[12:12:30 CEST] <durandal_1707> i mean aloop should allocate 100mb max
[12:13:18 CEST] <gryffus> durandal_1707: i have 24GB RAM
[12:13:28 CEST] <gryffus> durandal_1707: -map 0 -map 1 -af aloop=-1:5292000,atrim=duration=162 -vcodec copy -acodec mp3 output.mkv
[12:13:42 CEST] <durandal_1707> then why your system freezed?
[12:13:43 CEST] <gryffus> durandal_1707: ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
[12:13:56 CEST] <gryffus> durandal_1707: cannot say, i will just try again
[12:14:41 CEST] <durandal_1707> if it again freeze, than something is really fishy, because on my side with only 4GB RAM works fine
[12:15:01 CEST] <gryffus> Trying now: -map 0 -map 1 -af aloop=-1:5292000,atrim=duration=162 -c:v copy -c:a mp3 output.mkv
[12:22:36 CEST] <gryffus> durandal_1707: https://paste.opensuse.org/93538391
[12:22:39 CEST] <gryffus> again
[12:23:12 CEST] <gryffus> got frozen on frame 4757
[12:24:21 CEST] <durandal_1707> gryffus: strange, instead of aloop=-1, just try -af aloop=2:5292000,atrim=duration=162
[12:37:42 CEST] <gryffus_> durandal_1707: ok, i got some kernel stack traces related to iwlwifi. I will unload it and try again...
[12:40:17 CEST] <gryffus_> aloop=2:5292000 worked
[12:40:36 CEST] <gryffus_> trying again with aloop=-1:5292000 and without iwlwifi :D
[12:43:33 CEST] <gryffus> that's a nice memleak over here :D
[12:44:40 CEST] <durandal_1707> what? it crashed again?
[12:45:07 CEST] <durandal_1707> i'm on ubuntu, 4.15.0-22-generic
[12:45:12 CEST] <gryffus> yes, this time no backtrace, just OOM i gues...
[12:45:33 CEST] <gryffus> opensuse 4.18.5-1-default
[12:46:47 CEST] <durandal_1707> gryffus: you could loop with concat demuxer or filter
[12:47:17 CEST] <gryffus> well, no problem, aloop=2:5292000 is working
[12:48:02 CEST] <gryffus> i can try to strace it or run in gdb, with some guidance and if requested... byt i'm done atm :) so thanks durandal_1707 :)
[15:47:58 CEST] <hans_> if i have a million images i want to give to ffmpeg, windows & linux are probably not going to allow me to give them all to ffmpeg as an input argument because the command line will be too big, right?
[15:48:59 CEST] <fling> hans_: right if bash
[15:49:13 CEST] <hans_> oh nvm, seems i can use -i "*.jpg"  , then -i can deal with it, nvm
[15:49:22 CEST] <DHE> if you're making an animation from stills, use "*.jpg" as an input in glob mode
[15:49:28 CEST] <hans_> oh wait no, i need to ensure ffmpeg gets the images in the correct order =/
[15:49:40 CEST] <hans_> some way to dictate which order  -i  collects files?
[15:49:45 CEST] <fling> hans_: feed the list to the concat filter
[15:49:45 CEST] <hans_> when using '*.jpg'
[15:49:48 CEST] <DHE> ffmpeg -f image2 -pattern_type glob -i "*.jpg" ....
[15:49:56 CEST] <furq> glob is ordered the same way your shell orders it
[15:50:06 CEST] <DHE> yes, ordered in asciibetical order
[15:50:07 CEST] <fling> I need to write this one down
[15:50:29 CEST] <DHE> ffmpeg -h demuxer=image2    # options and parameters accepted by the image processor
[15:50:41 CEST] <hans_> hmm ok
[15:50:43 CEST] <DHE> make sure you specify them all BEFORE the -i "*.jpg" parameter
[15:51:02 CEST] <furq> if they contain ascending numbers you can also do -i foo%d.jpg
[15:51:20 CEST] <DHE> largely I expect framerate and pattern_type to be enough for most users.
[16:35:59 CEST] <hans_> [image2 @ 0000000000428c80] Pattern type 'glob' was selected but globbing is not
[16:35:59 CEST] <hans_>  supported by this libavformat build
[16:35:59 CEST] <hans_> exp/*.jpg: Function not implemented
[16:36:11 CEST] <hans_> well.. i guess that's an issue with the zeranoe windows builds?
[16:36:49 CEST] <hans_> the invocation was: ffmpeg -f image2 -pattern_type glob -framerate 12 -i 'exp/*.jpg' 'test.mp4'
[16:37:37 CEST] <DHE> or its' not a feature of windows?
[16:38:02 CEST] <DHE> because glob() is a POSIX function
[16:38:39 CEST] <hans_> great. is there a windows alternative?
[16:42:40 CEST] <hans_> hmm seems i can make due with -pattern_type sequence
[17:31:46 CEST] <th3_v0ice> What would be the proper way to duplicate/copy entire AVPacket to a new packet?
[17:39:32 CEST] <th3_v0ice> To be more precise, how to call av_packet_ref() and be sure that I dont have another reference but hard copy of the data?
[18:02:31 CEST] <kepstin> th3_v0ice: av_copy_packet() ?
[18:02:42 CEST] <Kadigan> Hey. I think I may've asked this in the past, but... why does ffmpeg sometimes crap out when run in a "while read" loop?
[18:02:50 CEST] <kepstin> i'm actually kind of surprised there isn't a function analogous to av_frame_make_writable
[18:03:42 CEST] <Kadigan> Specifically, it fails to split the argument list. For example, if filename is, say, "10-20s-Production-WWW.aiff", I sometimes could get "unknown option: -WWW" and I might sometimes get "-WWW.aiff: no such file or directory:"
[18:04:04 CEST] <kepstin> Kadigan: you're not correctly escaping a filename which contains a space :/
[18:04:27 CEST] <Kadigan> No spaces in filenames.
[18:04:30 CEST] <Kadigan> Not one space.
[18:04:40 CEST] <Kadigan> But! I think I know what's causing this.
[18:04:53 CEST] <Kadigan> Just hit me. It's probably how `find` returns the arguments.
[18:04:55 CEST] <kepstin> well, something in your command pipeline is adding a space or some other special character that your shell is interpreting as a space
[18:05:02 CEST] <Kadigan> I'm sniffing a null or \n there somewhere perhaps.
[18:07:24 CEST] <kepstin> it might make sense to make use of the feature where find can run a command per file, passing the filename as an argument. Then you don't have to worry about encoding/splitting filenames
[18:07:44 CEST] <kepstin> (if you need to generate the ffmpeg commandline, consider having find run a script that wraps ffmpeg)
[18:08:04 CEST] <th3_v0ice> kepstin: There is a warning behind that method that its deprecated, still safe to use?
[18:08:30 CEST] <th3_v0ice> kepstin: There is also a message that we should use av_packet_ref
[18:08:58 CEST] <kepstin> th3_v0ice: hmm, I was looking at too-old docs, yeah
[18:09:44 CEST] <kepstin> th3_v0ice: oh, with newer versions of ffmpeg there is a make_writable function
[18:09:45 CEST] <kepstin> just use that
[18:11:02 CEST] <kepstin> https://www.ffmpeg.org/doxygen/4.0/group__lavc__packet.html#gaaa304ffdab83984ac995d134e4298d4b
[18:11:46 CEST] <th3_v0ice> But i actually want to make a data copy? Is this still applicable?
[18:11:48 CEST] <Kadigan> kepstin: I honestly don't get it. If I do a while loop on ffmpeg, it craps out -- BUT, if I put the output of the while in a file and run THAT, it runs PERFECTLY
[18:12:18 CEST] <kepstin> th3_v0ice: that will copy the data if it needs to
[18:12:36 CEST] <kepstin> th3_v0ice: if there's more than one ref on the buffer, it will copy.
[18:13:17 CEST] <th3_v0ice> kepstin: Oh, so that's the trigger to a copy operation, if the number of refernces is bigger then 1.
[18:13:33 CEST] <th3_v0ice> kepstin: Thanks!
[18:13:47 CEST] <kepstin> th3_v0ice: if there's only one reference, nobody could access the old buffer if a copy was done, so there's no point in doing a copy
[18:14:12 CEST] <kepstin> (if you have a pointer to the old buffer without a reference on the packet, that's a bug in your code)
[18:15:46 CEST] <th3_v0ice> kepstin: What would be the simplest example of that particular case?
[18:22:37 CEST] <kepstin> th3_v0ice: not really sure how to describe it. Just that you should never access the data in a packet in any way unless the code "owns" a reference on the packet
[18:23:13 CEST] <kepstin> th3_v0ice: and you should never write to a packet's data without calling av_packet_make_writable first
[18:24:12 CEST] <kepstin> for example, if you call a function that takes ownership of the packet that you give it (i.e. transfers the reference), then you shouldn't touch the packet again after that function call.
[18:24:48 CEST] <kepstin> if you wanted to keep using the packet after calling that function, you'd have to call av_packet_re() *before*, so you'd have an extra reference that you could keep using afterwards
[18:25:31 CEST] <th3_v0ice> Oh, ok. I was thinking about something else :)
[18:25:54 CEST] <th3_v0ice> I dont think that I am doing it anywhere, but good to know.
[18:25:55 CEST] <kepstin> (note that av_packet_ref() and av_packet_unref() act as memory barriers in multithreaded code, so it's important that they're put in the correct order relative to accessing the packet contents)
[18:26:58 CEST] <th3_v0ice> Well in my particular case I managed to have it ordered even tho they are distributed across the threads.
[18:27:21 CEST] <th3_v0ice> It seems that av_packet_make_writable is a code newer then 4.0 that I am using.
[19:19:13 CEST] <Kadigan> Well, thanks for your input, I managed to work around the issue - whatever it was.
[19:32:40 CEST] <kepstin> th3_v0ice: make_writable is in ffmpeg 4.0, according to the docs :/
[21:15:30 CEST] <th3_v0ice> kepstin: You are correct, I forgot to update my includes :)
[23:37:34 CEST] <marcurling> Hello, when I "ffmpeg -t 30 -i in out" it encodes only 30 seconds (as requested) but parses the whole in file. Can I set a proper option for a quicker treatment?
[23:40:51 CEST] <BtbN> Put it after -i
[23:43:15 CEST] Action: marcurling Thanks BtbN !


More information about the Ffmpeg-devel-irc mailing list