[FFmpeg-devel] [PATCH 3/3] avformat: add youtube-dl based demuxer

Nicolas George george at nsup.org
Wed Apr 8 21:59:17 CEST 2015

Le nonidi 19 germinal, an CCXXIII, Gilles Chanteperdrix a écrit :
> As I explained, I did it this way for portability. system is ANSI
> not POSIX, redirections work with windows shell too, and av_tempfile
> is implemented by ffmpeg, so I expect it to be portable.

Implementing pipe reading for other systems looks like a better time

> Well, actually, it looks not so hard to me.

Every person who got it wrong thought that too.

> One argument is an URL so, we could url encode it before passing it to
> youtube-dl

No, you can not, because it is probably already URL-encoded.

> Well, actually, vfork() + exec() is better than fork() + exec(),
> both performance wise and because it works on machines without an
> MMU, and the implementation of posix_spawn() in glibc is too
> conservative and uses fork() + exec() even in situations where
> vfork() could be used, see:
> https://sourceware.org/bugzilla/show_bug.cgi?id=10354
> So, better use vfork() + exec() (that is what system does for
> instance). I did not use it simply because I thought ffmpeg could
> have to be compiled on machines without the POSIX interface.

That was arguments for 20 years ago. Nowadays, vfork() was left to bitrot
for compatibility reasons while fork() was insanely optimized. And in the
meantime, threads were invented, with their own set of problems when it
comes to spawning a child process.

So the short of it: use posix_spawn().

The way it is implemented is at best not your concern, at worst premature

> I did not use it simply because I thought ffmpeg could have to be compiled
> on machines without the POSIX interface.

FFmpeg requires POSIX. posix_spawn() is a POSIX option, yet, so it requires
a configure check. But apart from that, let someone who cares implement for
other systems.


> > Then I suggest you just endeavour to write a pseudo-demuxer for the output
> > of "youtube-dl -J". No need of a shell or an external command.

Just do that, no need for any fancy system call for that, and it would serve
as a base for a more fully automatic version anyway later.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150408/2190f762/attachment.asc>

More information about the ffmpeg-devel mailing list