{"action":"created","issue":{"url":"https://api.github.com/repos/rg3/youtube-dl/issues/10328","repository_url":"https://api.github.com/repos/rg3/youtube-dl","labels_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10328/labels{/name}","comments_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10328/comments","events_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10328/events","html_url":"https://github.com/rg3/youtube-dl/issues/10328","id":171006516,"number":10328,"title":"Post-processing failure","user":{"login":"kunal394","id":6339991,"avatar_url":"https://avatars.githubusercontent.com/u/6339991?v=3","gravatar_id":"","url":"https://api.github.com/users/kunal394","html_url":"https://github.com/kunal394","followers_url":"https://api.github.com/users/kunal394/followers","following_url":"https://api.github.com/users/kunal394/following{/other_user}","gists_url":"https://api.github.com/users/kunal394/gists{/gist_id}","starred_url":"https://api.github.com/users/kunal394/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kunal394/subscriptions","organizations_url":"https://api.github.com/users/kunal394/orgs","repos_url":"https://api.github.com/users/kunal394/repos","events_url":"https://api.github.com/users/kunal394/events{/privacy}","received_events_url":"https://api.github.com/users/kunal394/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-13T12:19:48Z","updated_at":"2016-08-13T12:43:36Z","closed_at":"2016-08-13T12:43:36Z","body":"I am using youtube-dl with python. \r\n`$ youtube-dl --version `\r\n`2016.08.12`\r\n\r\nPython code for downloading a video from youtube and then converting it to mp3 format is as follows:\r\n\r\n```\r\nimport youtube_dl, sys\r\n\r\nmp3 = {\r\n        'verbose': True,\r\n        'fixup': 'detect_or_warn',  # Automatically correct known faults of the file.\r\n        'format': 'bestaudio/best', # choice of quality\r\n        'postprocessors': [{\r\n            'key': 'FFmpegExtractAudio',\r\n            'preferredcodec': 'mp3',\r\n            'preferredquality': '320',\r\n            }],\r\n        'extractaudio' : True,      # only keep the audio\r\n        'audioformat' : \"mp3\",      # convert to mp3 \r\n        'outtmpl': '%(title)s',     # name the file the title of the video\r\n        'noplaylist' : True,        # only download single song, not playlist\r\n    }\r\n\r\nmp4 = {\r\n        'verbose': True,\r\n        'fixup': 'detect_or_warn',  # Automatically correct known faults of the file.\r\n        'format': 'bestvideo+bestaudio/bestvideo[ext=mp4]+bestaudio/bestvideo[ext=mkv]+bestaudio/best', # choice of quality\r\n        #'extractaudio' : True,      # only keep the audio\r\n        'videoformat' : \"mp4\",      # convert to mp4\r\n        'outtmpl': '%(title)s',     # name the file the title of the video\r\n        'noplaylist' : True,        # only download single song, not playlist\r\n    }\r\n\r\nmp3_playlist = {\r\n        'verbose': True,\r\n        'fixup': 'detect_or_warn',  # Automatically correct known faults of the file.\r\n        'format': 'bestaudio/best', # choice of quality\r\n        'postprocessors': [{\r\n            'key': 'FFmpegExtractAudio',\r\n            'preferredcodec': 'mp3',\r\n            'preferredquality': '320',\r\n            }],\r\n        'extractaudio' : True,      # only keep the audio\r\n        'audioformat' : \"mp3\",      # convert to mp3 \r\n        'outtmpl': '%(title)s',     # name the file the title of the video\r\n        'noplaylist' : False,        # only download single song, not playlist\r\n    }\r\n\r\nmp4_playlist = {\r\n        'verbose': True,\r\n        'fixup': 'detect_or_warn',  # Automatically correct known faults of the file.\r\n        'format': 'bestvideo+bestaudio/bestvideo[ext=mp4]+bestaudio/bestvideo[ext=mkv]+bestaudio/best', # choice of quality\r\n        'videoformat' : \"mp4\",      # convert to mp4 \r\n        'outtmpl': '%(title)s',     # name the file the title of the video\r\n        'noplaylist' : False,        # only download single song, not playlist\r\n    }\r\n\r\ndef down(url, t):\r\n    if t == 'mp4':                                                                                                                                    \r\n        options = mp4\r\n    elif t == 'mp3':\r\n        options = mp3\r\n    elif t == 'mp4p':\r\n        options = mp4_playlist\r\n    elif t == 'mp3p':\r\n        options = mp3_playlist\r\n    ydl = youtube_dl.YoutubeDL(options)\r\n    r = ydl.extract_info(url)\r\n\r\nif __name__ == \"__main__\":\r\n    url = sys.argv[1]\r\n    t = sys.argv[2]\r\n    down(url, t)\r\n```\r\n\r\nBut sometimes the post-processing faces the following error:\r\n\r\n```\r\n$ ytd 'https://www.youtube.com/watch?v=saxV9TtubV8&list=PLMy-e1JL4mgvDHXin6IsfnAu4zpzqbpwU&index=2' mp3p\r\nWARNING: Parameter outtmpl is bytes, but should be a unicode string. Put  from __future__ import unicode_literals  at the top of your code file or consider switching to Python 3.x.\r\n[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8\r\n[debug] youtube-dl version 2016.08.12\r\n[debug] Python version 2.7.12 - Linux-4.4.0-34-generic-x86_64-with-Ubuntu-16.04-xenial\r\n[debug] exe versions: avconv 2.8.6-1ubuntu2, avprobe 2.8.6-1ubuntu2, ffmpeg 2.8.6-1ubuntu2, ffprobe 2.8.6-1ubuntu2\r\n[debug] Proxy map: {'ftp': 'ftp://proxy.iiit.ac.in:8080/', 'all': 'socks://proxy.iiit.ac.in:8080/', 'http': 'http://proxy.iiit.ac.in:8080/', 'https': 'https://proxy.iiit.ac.in:8080/', 'no': 'localhost, 127.0.0.1, iiit.ac.in, .iiit.ac.in, iiit.net, .iiit.net, 172.16.0.0/12, 192.168.0.0/16, 10.0.0.0/8', 'socks': 'socks://proxy.iiit.ac.in:8080/'}\r\n[youtube:playlist] Downloading playlist PLMy-e1JL4mgvDHXin6IsfnAu4zpzqbpwU - add --no-playlist to just download video saxV9TtubV8\r\n[youtube:playlist] PLMy-e1JL4mgvDHXin6IsfnAu4zpzqbpwU: Downloading webpage\r\n[download] Downloading playlist: Log Horizon OST\r\n[youtube:playlist] playlist Log Horizon OST: Downloading 35 videos\r\n[download] Downloading video 1 of 35\r\n[youtube] pdg7Q9f4tvo: Downloading webpage\r\n[youtube] pdg7Q9f4tvo: Downloading video info webpage\r\n[youtube] pdg7Q9f4tvo: Extracting video information\r\n[youtube] pdg7Q9f4tvo: Downloading MPD manifest\r\n[debug] Invoking downloader on u'https://r5---sn-o3o-itql.googlevideo.com/videoplayback?id=a5d83b43d7f8b6fa&itag=251&source=youtube&requiressl=yes&pcm2cms=yes&mn=sn-o3o-itql&mm=31&ms=au&mv=m&initcwndbps=10407500&pl=24&ratebypass=yes&mime=audio/webm&gir=yes&clen=3292766&lmt=1409062005469245&dur=163.001&sver=3&upn=uq4_HQEud8A&key=dg_yt0&mt=1471090057&fexp=9419452,9422596,9428398,9429983,9431012,9433096,9433223,9433946,9435526,9435667,9436835,9438327,9438662,9438805,9439580,9439811,9440833,9440903,9441192,9442094,9442331,9442424,9442426,9442550,9442982,9443269,9443423,9443680&signature=9848B8681C28CEA374BD62AA22EAE6E248DCCFCC.5D7B320C28688E019C932FACF54B139229F9514B&ip=14.139.82.6&ipbits=0&expire=1471112317&sparams=ip,ipbits,expire,id,itag,source,requiressl,pcm2cms,mn,mm,ms,mv,initcwndbps,pl,ratebypass,mime,gir,clen,lmt,dur'\r\n[download] Log Horizon OST 1 - Main 'Log Horizon' Theme has already been downloaded\r\n[download] 100% of 3.14MiB\r\n[debug] avconv command line: avprobe -show_streams 'file:Log Horizon OST 1 - Main '\"'\"'Log Horizon'\"'\"' Theme'\r\n[ffmpeg] Destination: mp3\r\n[debug] ffmpeg command line: avconv -y -i 'file:Log Horizon OST 1 - Main '\"'\"'Log Horizon'\"'\"' Theme' -vn -acodec libmp3lame -b:a 320k file:mp3\r\nERROR: audio conversion failed: file:mp3: Invalid argument\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 1832, in post_process\r\n    files_to_delete, info = pp.run(info)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/postprocessor/ffmpeg.py\", line 294, in run\r\n    'audio conversion failed: ' + e.msg)\r\nPostProcessingError\r\n\r\nTraceback (most recent call last):\r\n  File \"/home/networking/Desktop/ks/iiit/network_sec/ytdl/ytdl.py\", line 80, in <module>\r\n    down(url, t)\r\n  File \"/home/networking/Desktop/ks/iiit/network_sec/ytdl/ytdl.py\", line 75, in down\r\n    r = ydl.extract_info(url)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 702, in extract_info\r\n    return self.process_ie_result(ie_result, download, extra_info)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 863, in process_ie_result\r\n    extra_info=extra)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 755, in process_ie_result\r\n    extra_info=extra_info)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 702, in extract_info\r\n    return self.process_ie_result(ie_result, download, extra_info)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 748, in process_ie_result\r\n    return self.process_video_result(ie_result, download=download)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 1430, in process_video_result\r\n    self.process_info(new_info)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 1768, in process_info\r\n    self.post_process(filename, info_dict)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 1834, in post_process\r\n    self.report_error(e.msg)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 565, in report_error\r\n    self.trouble(error_message, tb)\r\n  File \"/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py\", line 535, in trouble\r\n    raise DownloadError(message, exc_info)\r\nyoutube_dl.utils.DownloadError: ERROR: audio conversion failed: file:mp3: Invalid argument\r\n```\r\n\r\nI am not able to figure out whether I have made some mistake in the code or if this is a bug? But since this does not happens every time, I am guessing this is a bug. Also, I think everyone can notice that the file parameter is missing from the avconv command, so maybe this bug is present in the post-processing part of the youtube-dl module.\r\n\r\nAlso please suggest any other changes I should make to my code so that the file being downloaded always gets converted to the mp3 format. "},"comment":{"url":"https://api.github.com/repos/rg3/youtube-dl/issues/comments/239619055","html_url":"https://github.com/rg3/youtube-dl/issues/10328#issuecomment-239619055","issue_url":"https://api.github.com/repos/rg3/youtube-dl/issues/10328","id":239619055,"user":{"login":"dstftw","id":1908898,"avatar_url":"https://avatars.githubusercontent.com/u/1908898?v=3","gravatar_id":"","url":"https://api.github.com/users/dstftw","html_url":"https://github.com/dstftw","followers_url":"https://api.github.com/users/dstftw/followers","following_url":"https://api.github.com/users/dstftw/following{/other_user}","gists_url":"https://api.github.com/users/dstftw/gists{/gist_id}","starred_url":"https://api.github.com/users/dstftw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dstftw/subscriptions","organizations_url":"https://api.github.com/users/dstftw/orgs","repos_url":"https://api.github.com/users/dstftw/repos","events_url":"https://api.github.com/users/dstftw/events{/privacy}","received_events_url":"https://api.github.com/users/dstftw/received_events","type":"User","site_admin":false},"created_at":"2016-08-13T12:43:36Z","updated_at":"2016-08-13T12:43:36Z","body":"Add extension to `outtmpl`: `%(title)s.%(ext)s`."}}
{"actor":{"display_login":"dstftw"}}