Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting to MKV in python script being ignored. #12668

Closed
ankenyr opened this issue Apr 6, 2017 · 1 comment
Closed

Converting to MKV in python script being ignored. #12668

ankenyr opened this issue Apr 6, 2017 · 1 comment
Labels

Comments

@ankenyr
Copy link
Contributor

@ankenyr ankenyr commented Apr 6, 2017

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 that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.04.03. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2017.04.03

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • [x ] Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • 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

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


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 -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

running things via python scripts on windows. I can confirm that I am on the latest.
(Pdb) print youtube_dl.version.__version__
2017.04.03

youtube-dl: error: You must provide at least one URL.
https://www.youtube.com/channel/UC8KxkYgafaJnzyWz1pq_glg

---


### Description of your *issue*, suggested solution and other information

So I have the following script

--------------------------------------------------------
from __future__ import unicode_literals

import datetime
import getpass
import json
import os
import sys
import youtube_dl

class MyLogger(object):
  def __init__(self, log_file):
    self.log_file = log_file
    self.errors = []

  def debug(self, msg):
    self.log_file.write(msg.encode('utf-8'))
    self.log_file.write('\n')

  def warning(self, msg):
    self.log_file.write(msg)
    self.log_file.write('\n')

  def error(self, msg):
    if 'YouTube said' in msg and msg not in self.errors:
        self.errors.append(msg)
        self.log_file.write('ERROR!')
        self.log_file.write('\n')
        self.log_file.write(msg)
        self.log_file.write('\n')

pwd = getpass.getpass()
timestamp = datetime.datetime.now()
timestamp = timestamp.strftime('%Y-%m-%d-%H-%M-%S')
log_file = open(timestamp+'log.txt', 'w', 0)

download_list = [
    {'name': 'curtis_lasam',
     'outtmpl': 'Z:/Media/Youtube/CurtisLasam/%(upload_date)s-%(title)s [%(id)s].%(ext)s',
     'download_link': ['https://www.youtube.com/channel/UC8KxkYgafaJnzyWz1pq_glg']},
  ]
ydl_opts = {
  'noprogress': True,
  'ignoreerrors': True,
  'restrictfilenames': True,
  'nooverwrites': True,
  'writeinfojson': True,
  'writeannotations': True,
  'writedescription': True,
  'writesubtitles': True,
  'subtitleslangs': ['en'],
  'username': 'my_username',
  'password': pwd,
  'cookiefile': 'cookie.txt',
  #'ratelimit': '2M',
  'outtmpl': '',
  'recodevideo': 'mkv',
  'logger': MyLogger(log_file),
}
while True:
    for download_item in download_list:
      print download_item['name']
      ydl_opts['outtmpl'] = download_item['outtmpl']
      with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download(download_item['download_link'])
log_file.close()
------------------------------------

This ends up causing me some problems. I would like to have it download and convert everything to mkv. I believe I have it correct. Looking through the code recodevideo should set the [postprocessors correctly ](https://github.com/rg3/youtube-dl/blob/d212c93d16bbb6aeb8645f1dbb15a78f3d9414a8/youtube_dl/__init__.py#L257). The thing is when I use this script it seems to convert to other formats. See the following lines from my logs

[download] Downloading video 42 of 47
[youtube] jGnrRub3YzQ: Downloading webpage
[youtube] jGnrRub3YzQ: Downloading video info webpage
[youtube] jGnrRub3YzQ: Extracting video information
video doesn't have subtitles
[youtube] jGnrRub3YzQ: Searching for annotations.
[youtube] jGnrRub3YzQ: Downloading MPD manifest
[info] Writing video description to: Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].description
[info] Writing video annotations to: Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].annotations.xml
[info] Writing video description metadata as JSON to: Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].info.json
[download] Destination: Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].f137.mp4
[download] Download completed
[download] Destination: Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].f140.m4a
[download] Download completed
[ffmpeg] Merging formats into "Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].mp4"
Deleting original file Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].f137.mp4 (pass -k to keep)
Deleting original file Z:\Media\Youtube\CurtisLasam\20130202-Cube_Drone_-_Source_Control [jGnrRub3YzQ].f140.m4a (pass -k to keep)
[download] Downloading video 43 of 47

I am wondering why this is happening. I imagine I am the problem. I looked through the code some. I also looked through the FAQs and the other issues and didn't see anything that is strictly related. I think this has to do with the fact it is picking the best quality and ignoring my request to convert it to mkv.
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Apr 6, 2017

There is no such option recodevideo. You should add postprocessor instead.

@dstftw dstftw closed this Apr 6, 2017
@dstftw dstftw added the invalid label Apr 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.