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

Execute youtube-dl with a faststart flag #5071

Closed
alexbudin opened this issue Feb 26, 2015 · 7 comments
Closed

Execute youtube-dl with a faststart flag #5071

alexbudin opened this issue Feb 26, 2015 · 7 comments

Comments

@alexbudin
Copy link

@alexbudin alexbudin commented Feb 26, 2015

Where can i add the "faststart" flag in the source code or in the command line to get the moov atom at the beginning of the file?

I need this ASAP and its only for a youtube clip and only with ffmpeg.

I just need to know what file i can add that in.

Thank you.

Alex

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Feb 26, 2015

Use the --exec option with this faststart.sh script:

#!/bin/sh

VIDEO=$1
TEMPFILE=$VIDEO.temp
mv "$VIDEO" "$TEMPFILE"

ffmpeg -i "$TEMPFILE" -c copy -movflags faststart "$VIDEO"
rm "$TEMPFILE"

You just need to run youtube-dl URL --exec './faststart.sh {}'
(Closing as a duplicate of #5071)

@jaimeMF jaimeMF closed this Feb 26, 2015
@phihag
Copy link
Contributor

@phihag phihag commented Feb 26, 2015

If there's something wrong with the videos that youtube-dl downloads, please say so - I'd rather fix the problem for all users instead of one.

@alexbudin
Copy link
Author

@alexbudin alexbudin commented Feb 26, 2015

It would be SO USEFUL to the the option of "faststart" so that the index can be at the begining of the file, making the file playable as you download it.

@alexbudin
Copy link
Author

@alexbudin alexbudin commented Feb 26, 2015

@jaimeMF Thank you for your help. Isnt the script that you wrote executed after youtube-dl finishes? I am using youtube-dl on a livestream and it works fine, but because it creates a .part file that doesnt have the index (moov atom is missing) i cannot read that file with ffmpeg while its downloading...

I basically want to be able to grab snippets from that file (that is downloading in real time from the live stream) with ffmpeg, but because ffmpeg doesnt find a moov atom on it, it doesnt work.

@alexbudin
Copy link
Author

@alexbudin alexbudin commented Feb 26, 2015

@jaimeMF @phihag Is what i described above doable?

Also can i download the youtube video on another format like raw h264 stream ? so i can play it even if its not completed?

Thank you.

@phihag
Copy link
Contributor

@phihag phihag commented Feb 26, 2015

Next time, please be upfront about what you want to do - that way, we can help you better.

Judging from the updated post and this cross-posting, it seems like you don't really care about moov in the first place, but want to extract part of a video. So feel free to open a new issue with a detailed explanation of your use case. At least, you should say:

  • What you want to do in the greater scheme of things; this should include the error message and the name of the video player you're using.
  • Which service you're interested in - our suggestions or improvements may depend on the service implementations as well as the streaming protocol.
  • When do you know what part of the video you want (apparently during streaming)
  • What other considerations there are (i.e. do you need the original file untouched? Do you want to stop or continue downloading?)
  • How you identify the part of the video you're interested in - by absolute time, by time from now, by frame count, by byte count, or ...
@alexbudin
Copy link
Author

@alexbudin alexbudin commented Feb 26, 2015

@phihag I am sorry for this but i thought i explained it on here very well.

http://stackoverflow.com/questions/28742775/how-to-extract-a-video-snippet-from-a-video-file-that-is-being-written-in-by-ffm

I am recording a live stream with youtube-dl and i want from time to time to get a video snippet from the created file (while the recording hasnt finished yet).

I have found out that when doing recordings with ffmpeg you can make it so the index (moov atom) is being continuously written at the beginning of the file so that at any time you can get the partial file and it will play.

Does that explain it better?

Can you help?

Thank you.

Alex

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
3 participants
You can’t perform that action at this time.