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

Please allow passing of -ss and -to (-t) to ffmpeg #4803

Closed
tyll opened this issue Jan 28, 2015 · 1 comment
Closed

Please allow passing of -ss and -to (-t) to ffmpeg #4803

tyll opened this issue Jan 28, 2015 · 1 comment

Comments

@tyll
Copy link
Contributor

@tyll tyll commented Jan 28, 2015

It's nice that you can dump youtube videos into audio and even have it convert using ffmpeg. What would be nice is to allow youtube-dl to pass START and STOP (duration) through to either ffmpeg or whatever is used as alternative.

Reason behind my request:

Some movies have some talking before or after the music-video (or whatever I watch). I would really like to avoid using youtube-dl AND ffmpeg afterwards only to convert one file. It would be a huge benefit to have this offered by youtube-dl. So I only need to deal with youtube-dl alone.

Reported in Red Hat Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1065746

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Jan 28, 2015

For a few versions, youtube-dl has the --exec option which allows you to execute arbitrary commands after each file has been downloaded. This can be used for you usercase:

  1. Create the file cut.sh and make it executable:

    #!/bin/sh
    
    start=$1
    duration=$2
    file="$3"
    tempfile="$file.tmp"
    mv "$file" "$tempfile"
    
    ffmpeg -y -i "$tempfile" -ss "$start" -t "$duration" -c copy "$file"
    
    rm "$tempfile"
  2. Then run, for example, youtube-dl test:youtube_1 --exec "./cut.sh 20 40 {}". You can even use options like --extract-audio. You may want to give it a proper name to the script and put it in your $PATH, so that you can call it from everywhere.

I thinks that's enough and youtube-dl shouldn't have special support for it, for a few reasons:

  • You can adapt it to any options you need.
  • You can use any program you want, you are not limited to ffmpeg/avconv.
  • We could of course ad an option --ffmpeg-options which would add the arguments in the ffmpeg command (before the output filename). But this can't be done in the existing postprocessors (for example if you combine the --add-metadata and --embed-subtitles options, ffmpeg would be run twice with -ss 20 -t 40 which is not the expected behaviour). So it would need its own postprocessor, which would be equivalent to the script I posted.

This is just my opinion, so if you (or someone else) thinks that we should really add support for passing these options, I don't mind reopening the issue.

@jaimeMF jaimeMF closed this Jan 28, 2015
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.