ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.22k stars 9.94k forks source link

QuickTime Player and Windows Media Player playback problems! #16575

Open dan-lootcrate opened 6 years ago

dan-lootcrate commented 6 years ago

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

I ran ./youtube-dl --update beforehand just to be sure

Before submitting an issue make sure you have:

What is the purpose of 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:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.05.26
[debug] Python version 2.7.10 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: none
[debug] Proxy map: {}
Usage: youtube-dl [OPTIONS] URL [URL...]

Description of your issue, suggested solution and other information

Similar to this: https://github.com/rg3/youtube-dl/issues/5048

Problem is that just about any downloaded video file appears to not work correctly with default media players on popular Operating Systems. When using QuickTime player on Mac OS or Windows Media Player on Windows 10, both media players are unable to playback the downloaded videos "normally". They both do something similarly weird. The total video duration will be 2x the time of the actual video duration. The video will play normally up until this time and then anything after that the video will appear frozen at the last frame in the video. However. when using VLC player or vanilla YouTube page, the video plays 100% normal as expected.

Explicit example:

./youtube-dl --abort-on-error -o "%(title)s.%(ext)s" --no-playlist -f "bestvideo[height<=480]" https://www.youtube.com/watch?v=tFPoNZoFBXM

[youtube] tFPoNZoFBXM: Downloading webpage
[youtube] tFPoNZoFBXM: Downloading video info webpage
[youtube] tFPoNZoFBXM: Extracting video information
[download] Destination: Super Mario Bros. 2 USA - Mario Madness (NES) HD Complete Walkthrough.mp4
[download] 100% of 171.46MiB in 00:22

Opening the resulting file Super Mario Bros. 2 USA - Mario Madness (NES) HD Complete Walkthrough.mp4 in QuickTime Player shows a duration 3:17:05 but VLC player and YouTube player shows a duration of 1:38:32. Now, if you open the local file in QuickTime (or Windows Media Player) this video will play normally up until the 1:38:32 mark but after that it shows the last frame of the video continuously until the 2x mark.

Upon further research, this may be the issue:

https://superuser.com/questions/820134/why-cant-quicktime-play-a-movie-file-encoded-by-ffmpeg

You may need to use -pix_fmt yuv420p for your output to work in QuickTime and most other players. These players only supports the YUV planar color space with 4:2:0 chroma subsampling for H.264 video. Otherwise, depending on your source, ffmpeg may output to a pixel format that may be incompatible with these players.

I suppose this could be an issue on my end but I'm using vanilla binary and OS... I'm writing a Java application so have tested this problem on both the latest versions of Mac OS and Windows 10. Any help is appreciated.. thanks!

dan-lootcrate commented 6 years ago

Here's what VLC player shows the video codec to be.. it does say

screen shot 2018-05-30 at 10 35 32 am

CODEC: H264 - MPEG-4 AVC (part 10) (avc1)
DECODED FORMAT: PLANAR 4:2:0 YUV

not sure if that confirms or denies an issue with classical/legacy media players.

dan-lootcrate commented 6 years ago

Upon further investigation I was able to get videos with audio attached to them to playback normally (as expected) in Quicktime Player and Windows Media Player. I changed the command from video only to video and audio. See below:

-f "bestvideo[height<=480]"

to

-f "best[height<=480][ext=mp4]"

So this issue is only occurring when you want to rip video but with no audio. Thanks!

rowanz commented 6 years ago

I wanted to chime in and say I'm experiencing the same problem when I download video-only. The problem occurs on both Ubuntu and OSX platforms. Interestingly, on my end, using VLC doesn't seem to fix the problem, but including the audio does help.

Example output:

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'worstvideo[ext=mp4]', 'http://youtube.com/watch?v=745HeLp-0sA']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.06.25
[debug] Python version 3.6.1 (CPython) - Darwin-17.5.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.0, ffprobe 4.0
[debug] Proxy map: {}
[youtube] 745HeLp-0sA: Downloading webpage
[youtube] 745HeLp-0sA: Downloading video info webpage
[debug] Invoking downloader on 'https://r4---sn-n4v7snee.googlevideo.com/videoplayback?fexp=23709359&expire=1529973940&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2%2Cpl%2Crequiressl%2Csource%2Cexpire&key=yt6&mime=video%2Fmp4&ip=65.153.250.122&dur=599.599&keepalive=yes&lmt=1528805709137850&itag=160&pcm2=yes&requiressl=yes&ipbits=0&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&ei=VDgxW_vvLo-s-wPW1oS4Dg&fvip=9&pl=23&ms=au%2Crdu&mv=m&mt=1529952257&signature=7BB92310F0A886E9AF028EDE2AF8F7A28B5DAD6C.DFA057532C9C25C2514CDB2144BC5D75FF11B400&source=youtube&c=WEB&initcwndbps=765000&id=o-ANW_T6yzE2Q9LowV5lBWg8MZ3ncFp_5KuUTB_2QvOx6m&mm=31%2C29&mn=sn-n4v7snee%2Csn-nx57yn76&gir=yes&clen=1522994&ratebypass=yes'
[download] Destination: Ten Minute History - The Austro-Hungarian Empire (Short Documentary)-745HeLp-0sA.mp4
[download] 100% of 1.45MiB in 00:00

I'd be happy to answer any other questions if it helps diagnose/fix the issue 😄 thanks!