Repository: youtube-dl
Issue: Calling ffmpeg once
Labels: request

It has come to my attention that youtube-dl calls ffmpeg **3 times** if we enable "--write-sub --all-subs --embed-subs --embed-thumbnail --add-metadata" when we can just safely call ffmpeg once to do all stuffs(maybe except thumbnail as it requires atomicparsley).
This is a huge waste in system resources, much more noticeable in embedded environments with limited I/O throughput.

[ffmpeg] Merging formats into "iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4"
[ffmpeg] Adding metadata to 'iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4'
[ffmpeg] Embedding subtitles in 'iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4'

This leaves a clear room to improve.
I personally cannot write Python codes, so it'd be really nice if someone jumps in and improve this.
Thanks :)

```
youtube-dl -v -k -f 137+140 --newline --merge-output-format mp4 --write-sub --all-subs --embed-subs --embed-thumbnail --add-metadata https://www.youtube.com/watch?v=0bAeJ5fJ1M0
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'-k', u'-f', u'137+140', u'--newline', u'--merge-output-format', u'mp4', u'--write-sub', u'--all-subs', u'--embed-subs', u'--embed-thumbnail', u'--add-metadata', u'https://www.youtube.com/watch?v=0bAeJ5fJ1M0']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.02.09
[debug] Python version 2.7.10 - Linux-4.1.16-zen+-x86_64-with-Ubuntu-15.10-wily
[debug] exe versions: avconv 2.7.6-0ubuntu0.15.10.1, avprobe 2.7.6-0ubuntu0.15.10.1, ffmpeg 2.7.6-0ubuntu0.15.10.1, ffprobe 2.7.6-0ubuntu0.15.10.1
[debug] Proxy map: {'no': 'localhost,127.0.0.0/8,::1'}
[youtube] 0bAeJ5fJ1M0: Downloading webpage
[youtube] 0bAeJ5fJ1M0: Downloading video info webpage
[youtube] 0bAeJ5fJ1M0: Extracting video information
[youtube] 0bAeJ5fJ1M0: Downloading MPD manifest
[youtube] 0bAeJ5fJ1M0: Downloading MPD manifest
[info] Writing video subtitles to: iPhone 6s Chipgate-0bAeJ5fJ1M0.en.vtt
[youtube] 0bAeJ5fJ1M0: Downloading thumbnail ...
[youtube] 0bAeJ5fJ1M0: Writing thumbnail to: iPhone 6s Chipgate-0bAeJ5fJ1M0.jpg
[debug] Invoking downloader on u'https://r4---sn-3u-bh2d.googlevideo.com/videoplayback?id=d1b01e2797c9d4cd&itag=137&source=youtube&requiressl=yes&mm=31&mn=sn-3u-bh2d&ms=au&mv=m&pl=19&pcm2cms=yes&ratebypass=yes&mime=video/mp4&gir=yes&clen=33738804&lmt=1444725098607526&dur=147.247&sver=3&key=dg_yt0&mt=1455023178&fexp=9405265,9416126,9417058,9417580,9418199,9420452,9422596,9423661,9423662,9424134,9425730,9426681,9426765,9427037,9427105,9427708,9428294,9428561&upn=Y5isukI8LBo&signature=85BE9BFAA1291F418C27C0F5D8C41A8CE47EDAA4.688B26D0F3051AC0DC3162960A70997B12DBAACB&ip=121.140.87.200&ipbits=0&expire=1455044917&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,pl,pcm2cms,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: iPhone 6s Chipgate-0bAeJ5fJ1M0.f137.mp4
[download]   0.0% of 32.18MiB at 390.46KiB/s ETA 01:24
[download]   0.0% of 32.18MiB at  1.10MiB/s ETA 00:29
[download]   0.0% of 32.18MiB at  2.50MiB/s ETA 00:12
[download]   0.0% of 32.18MiB at  5.24MiB/s ETA 00:06
[download]   0.1% of 32.18MiB at  9.69MiB/s ETA 00:03
[download]   0.2% of 32.18MiB at 12.04MiB/s ETA 00:02
[download]   0.4% of 32.18MiB at 17.08MiB/s ETA 00:01
[download]   0.8% of 32.18MiB at 15.81MiB/s ETA 00:02
[download]   1.6% of 32.18MiB at 14.81MiB/s ETA 00:02
[download]   3.1% of 32.18MiB at 13.60MiB/s ETA 00:02
[download]   6.2% of 32.18MiB at 13.26MiB/s ETA 00:02
[download]  12.4% of 32.18MiB at 13.29MiB/s ETA 00:02
[download]  24.9% of 32.18MiB at 13.01MiB/s ETA 00:01
[download]  37.3% of 32.18MiB at 13.17MiB/s ETA 00:01
[download]  49.7% of 32.18MiB at 13.26MiB/s ETA 00:01
[download]  62.2% of 32.18MiB at 12.97MiB/s ETA 00:00
[download]  74.6% of 32.18MiB at 13.02MiB/s ETA 00:00
[download]  87.0% of 32.18MiB at 13.09MiB/s ETA 00:00
[download]  99.5% of 32.18MiB at 13.13MiB/s ETA 00:00
[download] 100.0% of 32.18MiB at 13.15MiB/s ETA 00:00
[download] 100% of 32.18MiB in 00:02
[debug] Invoking downloader on u'https://r4---sn-3u-bh2d.googlevideo.com/videoplayback?id=d1b01e2797c9d4cd&itag=140&source=youtube&requiressl=yes&mm=31&mn=sn-3u-bh2d&ms=au&mv=m&pl=19&pcm2cms=yes&ratebypass=yes&mime=audio/mp4&gir=yes&clen=2340459&lmt=1444724918594639&dur=147.307&sver=3&key=dg_yt0&mt=1455023178&fexp=9405265,9416126,9417058,9417580,9418199,9420452,9422596,9423661,9423662,9424134,9425730,9426681,9426765,9427037,9427105,9427708,9428294,9428561&upn=Y5isukI8LBo&signature=42CC940A196469F2B6743EFD18458A5E18739EA5.674E78475B5304A57B5170BA5E4B2800EFA9F7B8&ip=121.140.87.200&ipbits=0&expire=1455044917&sparams=ip,ipbits,expire,id,itag,source,requiressl,mm,mn,ms,mv,pl,pcm2cms,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: iPhone 6s Chipgate-0bAeJ5fJ1M0.f140.m4a
[download]   0.0% of 2.23MiB at 663.13KiB/s ETA 00:03
[download]   0.1% of 2.23MiB at  1.85MiB/s ETA 00:01
[download]   0.3% of 2.23MiB at  4.16MiB/s ETA 00:00
[download]   0.7% of 2.23MiB at  8.59MiB/s ETA 00:00
[download]   1.4% of 2.23MiB at 16.98MiB/s ETA 00:00
[download]   2.8% of 2.23MiB at 16.91MiB/s ETA 00:00
[download]   5.6% of 2.23MiB at 24.80MiB/s ETA 00:00
[download]  11.2% of 2.23MiB at 20.37MiB/s ETA 00:00
[download]  22.4% of 2.23MiB at 16.27MiB/s ETA 00:00
[download]  44.8% of 2.23MiB at 14.77MiB/s ETA 00:00
[download]  89.6% of 2.23MiB at 13.08MiB/s ETA 00:00
[download] 100.0% of 2.23MiB at 13.25MiB/s ETA 00:00
[download] 100% of 2.23MiB in 00:00
**[ffmpeg] Merging formats into "iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4"**
[debug] ffmpeg command line: avconv -y -i 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.f137.mp4' -i 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.temp.mp4'
**[ffmpeg] Adding metadata to 'iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4'**
[debug] ffmpeg command line: avconv -y -i 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4' -c copy -metadata 'comment=Does iPhone 6s Chipgate slow your phone down? https://youtu.be/pXmIQJMDv68
Subscribe! http://www.youtube.com/austinevans
The iPhone 6s actually has two different processors, the Apple A9 Samsung edition and TSMC edition. With rumors of Chipgate making a huge difference to battery life and performance I wanted to put it to the test.

iPhone 6s Samsung model number: N71AP
iPhone 6s TSMC model number: N71MAP
iPhone 6s Plus Samsung model number: N66AP
iPhone 6s Plus TSMC model number: N66MAP

Lirum Device Info: https://itunes.apple.com/us/app/lirum-device-info-lite-system/id591660734?mt=8

Chipworks Apple A9 Samsung vs TSMC: http://www.chipworks.com/about-chipworks/overview/blog/a9-is-tsmc-16nm-finfet-and-samsung-fabbed
Thanks to Vsauce 3 for letting me use the awesome ∞ video: https://www.youtube.com/watch?v=8UqYfaxOJOg

Twitter: http://twitter.com/austinnotduncan
Instagram: http://instagram.com/austinnotduncan
Facebook: https://www.facebook.com/austinnotduncan' -metadata 'description=Does iPhone 6s Chipgate slow your phone down? https://youtu.be/pXmIQJMDv68
Subscribe! http://www.youtube.com/austinevans
The iPhone 6s actually has two different processors, the Apple A9 Samsung edition and TSMC edition. With rumors of Chipgate making a huge difference to battery life and performance I wanted to put it to the test.

iPhone 6s Samsung model number: N71AP
iPhone 6s TSMC model number: N71MAP
iPhone 6s Plus Samsung model number: N66AP
iPhone 6s Plus TSMC model number: N66MAP

Lirum Device Info: https://itunes.apple.com/us/app/lirum-device-info-lite-system/id591660734?mt=8

Chipworks Apple A9 Samsung vs TSMC: http://www.chipworks.com/about-chipworks/overview/blog/a9-is-tsmc-16nm-finfet-and-samsung-fabbed
Thanks to Vsauce 3 for letting me use the awesome ∞ video: https://www.youtube.com/watch?v=8UqYfaxOJOg

Twitter: http://twitter.com/austinnotduncan
Instagram: http://instagram.com/austinnotduncan
Facebook: https://www.facebook.com/austinnotduncan' -metadata 'artist=Austin Evans' -metadata 'title=iPhone 6s Chipgate?' -metadata date=20151007 -metadata 'purl=https://www.youtube.com/watch?v=0bAeJ5fJ1M0' 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.temp.mp4'
**[ffmpeg] Embedding subtitles in 'iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4'**
[debug] ffmpeg command line: avconv -y -i 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4' -i 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.en.vtt' -map 0 -c copy -map -0:s -c:s mov_text -map 1:0 -metadata:s:s:0 language=eng 'file:iPhone 6s Chipgate-0bAeJ5fJ1M0.temp.mp4'
[atomicparsley] Adding thumbnail to "iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4"
[debug] AtomicParsley command line: AtomicParsley 'iPhone 6s Chipgate-0bAeJ5fJ1M0.mp4' --artwork 'iPhone 6s Chipgate-0bAeJ5fJ1M0.jpg' -o 'iPhone 6s Chipgate-0bAeJ5fJ1M0.temp.mp4'
```