On Sun, 17 Mar 2013 13:02:21 -0400, Keith Lawson 
<[email protected]> wrote:
> 
> 
> On 16.03.2013 17:45, Anton Khirnov wrote:
> > On Sat, 16 Mar 2013 16:46:47 -0400, Keith Lawson
> > <[email protected]> wrote:
> >>
> >>
> >> On 12.03.2013 15:02, Anton Khirnov wrote:
> >> > Hi,
> >> > On Mon, 11 Mar 2013 19:23:12 -0400, Keith Lawson
> >> > <[email protected]> wrote:
> >> >>
> >> >>
> >> >> Hello,
> >> >>
> >> >> I'm attempting "mask" a time selection of a video using the
> >> >> split, select and delogo filters but I just can't seem to get my
> >> >> head
> >> >> around the split filter. Looking at the start of the example[1] 
> >> at
> >> >> the
> >> >> start of the libav documentation it certainly appears that what I
> >> >> want
> >> >> to do is possible but I'm struggling to build the proper filter.
> >> >>
> >> >> For
> >> >> example I would like to mask the entire video of a 640x480 video
> >> >> from 0
> >> >> - 10 seconds. Based on the example in the docs and this[2]
> >> >> stackoverflow
> >> >> posting I've tried things like:
> >> >>
> >> >> ./avconv -i input -vf "[in] split
> >> >> [T1], fifo, [T2] overlay [out]; [T1]
> >> >> fifo,select='gte(t,0)*lte(t,10)',delogo=x=0:y=0:w=640:h=480 [T2]"
> >> >> output
> >> >>
> >> >> Hoping that would do something like :
> >> >>
> >> >> input --> split --> fifo
> >> >> -----------------------------------------------------> overlay 
> >> -->
> >> >> output
> >> >>  | ^
> >> >>  | |
> >> >>  +------> fifo --> select 0-10 seconds --> delogo
> >> >> --------+
> >> >>
> >> >> But I'm either completely unable to get the command to run or
> >> >> when I do I don't get the desired results. Any help or 
> >> suggestions
> >> >> for a
> >> >> more appropriate approach would be greatly appreciated.
> >> >>
> >> >
> >> > First of all, when you ask for help with avconv, please always 
> >> attach
> >> > full
> >> > commandlines that you tried and the output avconv printed. That
> >> > eliminates a lot
> >> > of pointless guessing on our part.
> >> >
> >> > Secondly, I'm afraid those docs are a little obsolete. For one 
> >> thing,
> >> > you should
> >> > never insert the fifo filter manually. It is always done
> >> > automatically when
> >> > needed.
> >> >
> >> > Also in those complex situations when you deal with filters with
> >> > multiple inputs
> >> > or outputs, it's better to explicitly label everything and not 
> >> rely
> >> > on automatic
> >> > mappings, as it's more clear what's going on.
> >> >
> >> > In any case, i think that
> >> > -vf '[in] split [split_main][split_delogo];
> >> > [split_main][delogoed]overlay[out];
> >> > [split_delogo] select=gte(t\,0)*lte(t\,10),delogo=<delogo
> >> > params>[delogoed];'
> >> > should do roughly what you want EXCEPT for a problem with overlay.
> >>
> >> This filter isn't working for me. I get:
> >>
> >> avconv -i test.avi -vf "[in] split
> >> [split_main][split_delogo];[split_delogo]
> >> select=gte(t\,0)*lte(t\,10),delogo=x=0:y=0:w=640:h=480[delogoed];
> >> [split_main][delogoed]overlay[out];" testmask.avi
> >> avconv version 0.8.5-6:0.8.5-1~bpo60+1, Copyright (c) 2000-2012 the
> >> Libav developers
> >>    built on Jan 24 2013 17:05:37 with gcc 4.4.5
> >> Input #0, avi, from 'test.avi':
> >>    Duration: 00:05:12.64, start: 0.000000, bitrate: 785 kb/s
> >>      Stream #0.0: Video: wmv2, yuv420p, 640x480, 25 tbr, 25 tbn, 25 
> >> tbc
> >> File 'testmask.avi' already exists. Overwrite ? [y/N] y
> >> [buffer @ 0x6c64a0] w:640 h:480 pixfmt:yuv420p
> >> No such filter: ''
> >> Error opening filters!
> >>
> >
> > I think it's the final ; that's doing it. ; is supposed to separate 
> > distinct
> > parts of the filtergraph description, so it could be that the code 
> > expects to
> > find a filter name after it. That's probably a bug and should 
> > probably be fixed.
> >
> 
> Yup that was it.
> 
> >> I can't for the life of me figure out where it's getting the "no 
> >> such
> >> filter" so I played with it a bit more and tried the following using
> >> copy as an output to overlay and ended up segfaulting avconv:
> >>
> >> avconv -i test.avi -vf
> >> 
> >> "[in]split[copy][mask];[copy]copy[copyout];[mask]select=gte(t\,5)*lte(t\,10),delogo=x=0:y=0:w=640:h=480[maskout];[copyout][maskout]overlay[out]"
> >> testmask.avi
> >> avconv version 0.8.5-6:0.8.5-1~bpo60+1, Copyright (c) 2000-2012 the
> >> Libav developers
> >>    built on Jan 24 2013 17:05:37 with gcc 4.4.5
> >> Input #0, avi, from 'test.avi':
> >>    Duration: 00:05:12.64, start: 0.000000, bitrate: 785 kb/s
> >>      Stream #0.0: Video: wmv2, yuv420p, 640x480, 25 tbr, 25 tbn, 25 
> >> tbc
> >> File 'testmask.avi' already exists. Overwrite ? [y/N] y
> >> [buffer @ 0x10744a0] w:640 h:480 pixfmt:yuv420p
> >> [overlay @ 0x10a5c40] auto-inserting filter 'auto-inserted scaler 0'
> >> between the filter 'Parsed filter 3 delogo' and the filter 'Parsed
> >> filter 4 overlay'
> >> [scale @ 0x10a45a0] w:640 h:480 fmt:yuv420p -> w:640 h:480 
> >> fmt:yuva420p
> >> flags:0x4
> >> [overlay @ 0x10a5c40] main w:640 h:480 fmt:yuv420p overlay x:0 y:0
> >> w:640 h:480 fmt:yuva420p
> >> [overlay @ 0x10a5c40] main_tb:1/1000000 overlay_tb:1/1000000 ->
> >> tb:1/1000000 exact:1
> >> Output #0, avi, to 'testmask.avi':
> >>    Metadata:
> >>      ISFT            : Lavf53.21.1
> >>      Stream #0.0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 
> >> 25
> >> tbn, 25 tbc
> >> Stream mapping:
> >>    Stream #0:0 -> #0:0 (wmv2 -> mpeg4)
> >> Press ctrl-c to stop encoding
> >> Segmentation fault
> >>
> >
> > I should most definitely look into fixing the segfault with 0.8, but 
> > note that
> > both libavfilter itself and the parts of avconv that deal with 
> > filters have been
> > significantly changed since 0.8. So I'd very strongly recommend you 
> > to get
> > either the recent 9 release or a git master if you want to play with 
> > this.
> 
> I just built from git master and tried both filters. Now avconv seems 
> to be consuming all system memory. Shortly after launching the process 
> it grows to over a gig resident and then the systems starts thrashing so 
> bad it's unresponsive. I was able to it to encode a very small file by 
> letting the system thrash and just rebooting once disk activity slowed 
> down. The resulting file was exactly as you described in your first 
> posting, the overlay filter just keeps adding the last "delogoed" frame 
> over and over resulting in "masked" video from the start of the select 
> to the end of the video.
> 
> Is there anything I can do to help diagnose the memory issue? Just for 
> comparison I built ffmpeg from git master and I was able to run these 
> filters with it.

Hmm..just realized that this isn't going to work so easily.
The problem is that the select filter doesn't know that there won't ever be any
more frames while will be let through, so it doesn't signal end of stream to the
overlay's second input. So overlay keeps waiting for new frames on its second
input while more and more frames get queued on its main input.

So for this arrangement to work there needs to be some way to signal end of
stream on the secondary input.
I'm considering either an option to the select filter, or perhaps a new 'trim'
filter would be better.

-- 
Anton Khirnov
_______________________________________________
libav-tools mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-tools

Reply via email to