-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Support decoding Coub videos (was: Downloaded Coub video file broken) #13754
Comments
This is what coub serves. |
I found something interesting inside their js:
And indeed, zeroing out the first two bytes with a hex editor makes the files playable. |
@catdog2 I see that
Looking deeper I see that this I tried making a request and setting 'User-Agent' header to something like IE8 but that didn't work, not sure if I'm doing it right, just thought I'd share. |
@niranjanshr13 Thx, I'm gonna incorporate that into my (primitive) wrapper script till a proper solution is implemented. |
@niranjanshr13 seems like that doesn't work anymore too. It worked for me few days ago. |
Here is simple script to construct videos that should looks similar to the ones played on the site. I didn't try to make it fancy, just the minimal proof of concept. #!/usr/bin/env bash
set -e
youtube-dl -o 1.mp4 "$1"
youtube-dl -f html5-audio-high -o 1.mp3 "$1"
printf '\x00\x00' | dd of=1.mp4 bs=1 count=2 conv=notrunc
for i in `seq 1 100`; do echo "file '1.mp4'" >> 1.txt; done
ffmpeg -hide_banner -f concat -i 1.txt -i 1.mp3 -c copy -shortest -movflags faststart out.mp4
rm 1.mp4 1.mp3 1.txt |
Okay, here's my take on that shell script:
|
@Kagami @affinityv Is there a way to download just the video and not the 55 second loop of the video? |
@arisboch here is the code without any loop.
|
I've written a Python based tool for this a while ago: https://git.strongds.hu/mrtoth/coub-dl |
@niranjanshr13 But it's muted ;-( |
@arisboch it is muted, if you want the audio then try Kagami code, basically his code loop the video until the audio ends.
|
@niranjanshr13 Don't use /usr/bin/env to find a program (or shell)..... you should know exactly where the program (or shell) is on your system and it should be in a safe directory. I'm sure you can find other advice, but quite simply, don't use /usr/bin/env ... EVER. |
@affinityv this is not my code, i copied from @Kagami code for the @arisboch question. |
for the python user.
|
FWIW, I just tested this again and it is still not working with the latest version of youtube-dl. |
FYI, the Python example listed in the comment above still works, although it's only the video, obviously. |
Yeah, can confirm, downloaded videos from coub seems to be broken. Fix it pls. |
In a few months this gonna be 2 years old and still not fixed. |
Still need proper Coub downloading. |
I disagree with this. if you move scripts often between platform this is useful. |
This would download the mute video
I was hoping the --exec would work as by documentation it says "Execute a command on the file after downloading" But it's a lie :P because it executes AFTER merging. because otherwise you could use -f 'html5-video-med[ext=mp4]+html5-audio-high[ext=mp3]' then exec on the mp4, but instead the exec doens't happen as it's on the final output file which fails cause the mp4 is broken. :( so you still need 3 lines of code to download a coub... life has no meaning :) |
re-edited because if the coub is video only it will only get the fragment. now it gets the video correctly with or without audio. the first -e is because if you try to download the same url it will create fragments and then say it already made the file and exit. that's the smallest I could do, I did it this way because if I download the pieces separately then you don't have the name and you're still going to need to call --get-filename for each "fragment" if --exec would really run after download this could be 1 line :(
but it doesn't work cause it will try to execute on the post-processed, but it doesn't reach it as ffmpeg won't recognize the video as a video. |
hi. can anybody make last script in windows .bat to work with youtube-dl.exe please? if it only works. even if i must paste url in it every time it will be ok |
Please follow the guide below
x
into all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --version
and ensure your version is 2017.07.23. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
casval@casval-X6815 /tmp % youtube-dl http://coub.com/view/eq9pa -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'http://coub.com/view/eq9pa', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.07.23
[debug] Python version 2.7.13 - Linux-4.10.0-28-generic-x86_64-with-Ubuntu-17.04-zesty
[debug] exe versions: avconv 3.2.4-1build2, avprobe 3.2.4-1build2, ffmpeg 3.2.4-1build2, ffprobe 3.2.4-1build2, rtmpdump 2.4
[debug] Proxy map: {}
[Coub] eq9pa: Downloading JSON metadata
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on u'http://s3.storage.akamai.coub.com/get/b130/p/coub/simple/cw_file/30cf7df5d5e/aa6e6b21fbdf78b11538d/muted_mp4_big_size_1473445250_muted_big.mp4'
[download] Destination: Spergberb-eq9pa.mp4
[download] 100% of 1.77MiB in 00:00
casval@casval-X6815 /tmp % mpv Spergberb-eq9pa.mp4
Playing: Spergberb-eq9pa.mp4
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
[ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: moov atom not found
[lavf] avformat_open_input() failed
Failed to recognize file format.
Exiting... (Errors when loading file)
When I try to download a Coub video, the resulting video file is unplayable (I tried VLC, as well) and judging by the URL is also tried to download the muted version of the video.
The text was updated successfully, but these errors were encountered: