Repository: youtube-dl
Issue: Filename truncation should apply on actual filename instead of title (was: FFMPEG chokes on default filename)
Labels: bug

## Please follow the guide below

- You will be asked some questions and requested to provide some information, please read them **carefully** and answer honestly
- Put an `x` into all the boxes [ ] relevant to your *issue* (like this: `[x]`)
- Use the *Preview* tab to see what your issue will actually look like

---

### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is *2017.10.15.1*. If it's not, read [this FAQ entry](https://github.com/rg3/youtube-dl/blob/master/README.md#how-do-i-update-youtube-dl) and update. Issues with outdated version will be rejected.
- [x] I've **verified** and **I assure** that I'm running youtube-dl **2017.10.15.1**

### Before submitting an *issue* make sure you have:
- [x] At least skimmed through the [README](https://github.com/rg3/youtube-dl/blob/master/README.md), **most notably** the [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections
- [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones

### What is the purpose of your *issue*?
- [x] Bug report (encountered problems with youtube-dl)
- [ ] Site support request (request for adding support for a new site)
- [ ] Feature request (request for a new functionality)
- [ ] Question
- [ ] Other

---

### If the purpose of this *issue* is a *bug report*, *site support request* or you are not completely sure provide the full verbose output as follows:

Add the `-v` flag to **your command line** you run youtube-dl with (`youtube-dl -v <your command line>`), copy the **whole** output and insert it here. It should look similar to one below (replace it with **your** log inserted between triple ```):

_**Sanitized output**_
```
PS G:\test> .\youtube-dl --cookies '.\cookies.txt' 'https://www.blah.com/video/mnff?manifest=https%3A%2F
%2Fwmvideocdn.streaming.mediaservices.windows.net%2Ffbbcda92-5518-4b65-a0b5-ec3f1a18b81e_prores_out.i
sm%2FManifest%28format%3Dm3u8-aapl%2Caudio-only%3Dfalse%2Cfilter%3Dpreset2%29&token=Bearer%3DeyJ0eXAiOiJKV1QiLCJhbGciOiJ
IUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi
1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI6MTUwOD
M2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0Ei6YC8Zul-WyjaYipqIHevyc-lH7m_sFhte_uPc&idepisode=3672&numero=1&idserie=272' -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--cookies', '.\\cookies.txt', 'https://blah.com/video/mnff?manifest=htt
ps%3A%2F%2Fwmvideocdn.streaming.mediaservices.windows.net%2Ffbbcda92-5518-4b65-a0b5-ec3f1a18b81e_pror
es_out.ism%2FManifest%28format%3Dm3u8-aapl%2Caudio-only%3Dfalse%2Cfilter%3Dpreset2%29&token=Bearer%3DeyJ0eXAiOiJKV1QiLCJ
hbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1ND
EtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cC
I6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0Ei6YC8Zul-WyjaYipqIHevyc-lH7m_sFhte_uPc&idepisode=3672&numero=1&idserie=272
', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2017.10.15.1
[debug] Python version 3.4.4 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-87871-g7480f232d2, ffprobe N-87871-g7480f232d2
[debug] Proxy map: {}
[generic] mnff?manifest=https://wmvideocdn.streaming.mediaservices.windows.net/fbbcda92-5518-4b65-a0b5-ec3f1a18
b81e/_prores_out.ism/Manifest(format=m3u8-aapl,audio-only=false,filter=preset2)&token=Bearer=eyJ0eXAiOiJKV1QiLCJh
bGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDE
tODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI
6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ: Requesting header
[generic] mnff?manifest=https://wmvideocdn.streaming.mediaservices.windows.net/fbbcda92-5518-4b65-a0b5-ec3f1a18
b81e/_prores_out.ism/Manifest(format=m3u8-aapl,audio-only=false,filter=preset2)&token=Bearer=eyJ0eXAiOiJKV1QiLCJh
bGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDE
tODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI
6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://blah.com/video/mnffsnd?manifest=https%3a%2f%2fwmvideocdn.st
reaming.mediaservices.windows.net%2ffbbcda92-5518-4b65-a0b5-ec3f1a18b81e%_prores_out.ism/QualityLevels(1465184)
/Manifest(video,format=m3u8-aapl,filter=preset2)&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJl
Om1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZF
IiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0E
i6YC8Zul-WyjaYipqIHevyc-lH7m_sFhte_uPc'
[download] Destination: mnff-mnffmanifest=https -__wmvideocdn.streaming.mediaservices.windows.net_fbbcda92-5518
-4b65-a0b5-ec3f1a18b81e__prores_out.ism_Manifest(format=m3u8-aapl,audio-only=false,filter=preset2)&token=Bearer=e
yJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1
ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2Fr
YW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.f1644.mp4
[debug] ffmpeg command line: ffmpeg -y -loglevel verbose -headers "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Cookie: ai_user=DYSPI|2017-10-17T20:40:48.829Z; WMV2Consent=true; ; ASP.NET_SessionId=iqpx4vtkyw1pa5rn
lkyjxmnt; =; .Auth=ZclG-YhW_wYUTZtXSV4ss2XGhyeMVI-eKydZH0Ed5bqg-ctn4o_r_EHxrjyMT2HuLnC1Qp-sgCbDO
x-iDFy8El8Cs_5r6SbuoF2zYZpfGDDJ5cl9mzdtjfG9WLhJYAtY8e3e4NuQikVALUyCvarLxYj61N80J4bJ37xtpB7kzxj_9g3CNMoXH78K1HfOdTpZk4qXQ
0YvHujCwuuSVNz_2dLC0vlDpV_NM9Ykf29yil05clVJw607vYfY7j6LfdEexEIf0kvO12LAHcjB0tOWOHv8xS3VmhmKIqnBTof8KaGO6dyBuVFyXUVfzR1xx
_OAWLSFCNxHuZG2h193dNpOPMFmqdkQyG6j7xclWdH2OgOFBd3FZXBq3EHsoyyxNZ8Q7ixfWMuoNkwChWL8dcKb9Lhx0WEvbOXvl-XcwEnPAmwTbAWUsvmuk
VfFY1D9p_7cVgPcuIssPyDXwUBQLgz0PYvgEdpWfPGceyalHygQH7pPSoWKQuRzcjFSOitE1l4f1u8Rl859TYAbRWhJIxiPIDwbKlk_jPRFEJlEUehVBKpVg
ElsdoaWMqcr4jRGabIhEHfSxKdurS5rjVSEcejxDg; _ga=GA1.2.183824678.1508272849; _gid=GA1.2.1732356944.1508272849
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
" -i "https://blah.com/video/mnffsnd?manifest=https%3a%2f%2fwmvideocdn.streaming.mediaservices.wind
ows.net%2ffbbcda92-5518-4b65-a0b5-ec3f1a18b81e%_prores_out.ism/QualityLevels(1465184)/Manifest(video,format=m3u
8-aapl,filter=preset2)&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udG
VudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UVi
IsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0Ei6YC8Zul-WyjaYipqIHevyc-lH
7m_sFhte_uPc" -c copy -f mp4 "file:mnff-mnffmanifest=https -__wmvideocdn.streaming.mediaservices.windows.net_fb
bcda92-5518-4b65-a0b5-ec3f1a18b81e__prores_out.ism_Manifest(format=m3u8-aapl,audio-only=false,filter=preset2)&tok
en=Bearer=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZ
XIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6L
y93d3cud2FrYW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.f1644.mp4.part"
ffmpeg version N-87871-g7480f232d2 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enabl
e-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopu
s --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-
libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-z
lib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --e
nable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 79.100 / 55. 79.100
  libavcodec     57.108.100 / 57.108.100
  libavformat    57. 84.100 / 57. 84.100
  libavdevice    57. 11.100 / 57. 11.100
  libavfilter     6.108.100 /  6.108.100
  libswscale      4.  9.100 /  4.  9.100
  libswresample   2. 10.100 /  2. 10.100
  libpostproc    54.  8.100 / 54.  8.100
[hls,applehttp @ 00000000004cc6c0] HLS request for url 'https://wmvideocdn.streaming.mediaservices.windows.net/
fbbcda92-5518-4b65-a0b5-ec3f1a18b81e/_prores_out.ism/QualityLevels(1465184)/Fragments(video=0,format=m3u8-aapl)',
 offset 0, playlist 0
[hls,applehttp @ 00000000004cc6c0] Opening 'https://blah.com/video/key?KID=9c55d229-1e39-4541-84b6-ed644276b
ee9&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZ
XIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6L
y93d3cud2FrYW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0Ei6YC8Zul-WyjaYipqIHevyc-lH7m_sFhte_uPc' for r
eading
[hls,applehttp @ 00000000004cc6c0] Opening 'crypto+https://wmvideocdn.streaming.mediaservices.windows.net/fbbcd
a92-5518-4b65-a0b5-ec3f1a18b81e/_prores_out.ism/QualityLevels(1465184)/Fragments(video=0,format=m3u8-aapl)' for r
eading
[h264 @ 000000000058a7a0] Reinit context to 960x544, pix_fmt: yuv420p
[hls,applehttp @ 00000000004cc6c0] max_analyze_duration 5000000 reached at 5005000 microseconds st:0
Input #0, hls,applehttp, from 'https://blah.com/video/mnffsnd?manifest=https%3a%2f%2fwmvideocdn.str
eaming.mediaservices.windows.net%2ffbbcda92-5518-4b65-a0b5-ec3f1a18b81e_prores_out.ism/QualityLevels(1465184)/
Manifest(video,format=m3u8-aapl,filter=preset2)&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlO
m1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDEtODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFI
iwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.weq0Ei
6YC8Zul-WyjaYipqIHevyc-lH7m_sFhte_uPc':
  Duration: 00:23:03.34, start: 0.083411, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(left), 960x540 (960x544) [SAR 1
:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
    Metadata:
      variant_bitrate : 0
file:mnff-mnffmanifest=https -__wmvideocdn.streaming.mediaservices.windows.net_fbbcda92-5518-4b65-a0b5-ec3f1a18
b81e__prores_out.ism_Manifest(format=m3u8-aapl,audio-only=false,filter=preset2)&token=Bearer=eyJ0eXAiOiJKV1QiLCJh
bGciOiJIUzI1NiJ9.eyJ1cm46bWljcm9zb2Z0OmF6dXJlOm1lZGlhc2VydmljZXM6Y29udGVudGtleWlkZW50aWZpZXIiOiI5YzU1ZDIyOS0xZTM5LTQ1NDE
tODRiNi1lZDY0NDI3NmJlZTkiLCJDS1R5cGUiOiJFTlZFIiwiaXNzIjoiV2FrYW5pbS5UViIsImF1ZCI6Imh0dHA6Ly93d3cud2FrYW5pbS50diIsImV4cCI
6MTUwODM2MDc0OCwibmJmIjoxNTA4Mjc2NDQ4fQ.f1644.mp4.part: No such file or directory


ERROR: ffmpeg exited with code 1
  File "__main__.py", line 19, in <module>
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\__init__.py", line 465, i
n main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\__init__.py", line 455, i
n _real_main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 1985,
 in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 795,
in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 849,
in process_ie_result
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 1619,
 in process_video_result
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 1886,
 in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 1831,
 in dl
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\downloader\common.py", li
ne 361, in download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\downloader\external.py",
line 57, in real_download
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\downloader\common.py", li
ne 163, in report_error
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 612,
in report_error
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmplnz97faa\build\youtube_dl\YoutubeDL.py", line 574,
in trouble
<end of log>
```
---

### Description of your *issue*, suggested solution and other information

I was trying to download a video from an M3U8. Everything was going fine until FFMPEG suddenly quits saying "No such file or directory".

Turns out, the output filename Youtube-DL was feeding FFMPEG was bad, causing FFMPEG to quit. The simple solution is to use the `-o` flag on Youtube-DL to specify an output name. Though ideally, Youtube-DL shouldn't be outputting bad filenames to begin with.