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.34k stars 9.95k forks source link

no sound in youtube video unless the audio .webm gets ffmpeg-ed into .ogg with "-c copy" first #7048

Closed ghost closed 8 years ago

ghost commented 8 years ago

youtube-dl --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0" -k https://www.youtube.com/watch?v=DYGc-31mEec

That pulls a *.f136.mp4 video, a *.f251.webm audio , and they get converted into a .mkv but with vlc there's no sound (either on the .webm or the .mkv files, in fact the sound card goes to sleep, even though statistics say that audio gets decoded just fine). If I run opusinfo *.webm I get some errors which say that's not a valid ogg. Then if I convert the webm into ogg via ffmpeg(this shaves 453,728 bytes) then there's audio on the resulting .ogg; this ffmpeg command: ffmpeg -i "file: ASMR Ear (Cleaning) Groomers & Spa Roleplay (unisex)-DYGc-31mEec.f251.webm" -c copy "file:stuff.ogg" I tried renaming webm to ogg but there's still no audio, so that ffmpeg conversion is needed apparently. Maybe's my vlc acting out? (latest git, but config options may matter)

EDIT: forgot to mention youtube-dl version, since it's not latest git: $ youtube-dl --version 2015.09.28-gentoo_no_offensive_sites

ghost commented 8 years ago

Looks like for extracting audio only, the sound works fine(in vlc player) because it gets transformed from webm into opus by youtube-dl via this command: ffmpeg -y -i "file:Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.webm" -vn -acodec copy "file:Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.opus"

Command I used: youtube-dl --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0" --extract-audio https://www.youtube.com/watch?v=BNyuHH7kUJk

And if I pass the -k param, it gets the video file too, but vlc-ing the webm file (or the resulting mkv) still no sound! (good thing it does an opus too, with the -k arg, although maybe it shouldn't pull the video? guess that's another issue though)

$ downaudio -k https://www.youtube.com/watch?v=BNyuHH7kUJk
[youtube] BNyuHH7kUJk: Downloading webpage
[youtube] BNyuHH7kUJk: Downloading video info webpage
[youtube] BNyuHH7kUJk: Extracting video information
[youtube] BNyuHH7kUJk: Downloading DASH manifest
[youtube] BNyuHH7kUJk: Downloading DASH manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.f136.mp4
[download] 100% of 29.82MiB in 00:08
[download] Destination: Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.f251.webm
[download] 100% of 4.36MiB in 00:01
[ffmpeg] Merging formats into "Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.mkv"
[ffmpeg] Destination: Epic Action _ Path of Aroha - In The Shadow of a Colossus - EpicMusicVN-BNyuHH7kUJk.opus
dstftw commented 8 years ago

Post the full output of youtube-dl when run with --verbose option.

ghost commented 8 years ago
$ cd /tmp;downvideo -k --verbose https://www.youtube.com/watch?v=DYGc-31mEec
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--user-agent', u'Mozilla/5.0 (X11; Linux x86_64; rv:39.0) Gecko/20100101 Firefox/39.0', u'-k', u'--verbose', u'https://www.youtube.com/watch?v=DYGc-31mEec']
[debug] Encodings: locale ANSI_X3.4-1968, fs ANSI_X3.4-1968, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2015.09.28-gentoo_no_offensive_sites
[debug] Python version 2.7.10 - Linux-4.1.7-hardened-r1-g45b4b78-x86_64-AMD_A6-3400M_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
[debug] exe versions: ffmpeg 2.8, ffprobe 2.8
[debug] Proxy map: {}
[youtube] DYGc-31mEec: Downloading webpage
[youtube] DYGc-31mEec: Downloading video info webpage
[youtube] DYGc-31mEec: Extracting video information
[youtube] DYGc-31mEec: Downloading DASH manifest
[youtube] DYGc-31mEec: Downloading DASH manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r1---sn-h5bt5guxax3vh-qxce.googlevideo.com/videoplayback?id=0d819cfb7d6611e7&itag=136&source=youtube&requiressl=yes&mn=sn-h5bt5guxax3vh-qxce&mm=31&ms=au&pl=20&mv=m&ratebypass=yes&mime=video/mp4&gir=yes&clen=281392417&lmt=1443527915463881&dur=2028.392&sver=3&mt=1443862895&upn=YpMeCBHRxjw&signature=3C75E272EF86A991C4B4D4E5CD82F3A7F7DB2131.4E7A9E5F3F45272D93E6E9C82E6F7EBB484E094A&fexp=9405998,9406852,9407116,9408710,9409069,9415365,9415485,9416023,9416126,9416729,9416838,9417707,9417815,9418153,9418391,9418448,9419743,9420348,9421013,9421252,9421351&key=dg_yt0&ip=84.2.91.186&ipbits=0&expire=1443884631&sparams=ip,ipbits,expire,id,itag,source,requiressl,mn,mm,ms,pl,mv,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination:  ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.f136.mp4
[download] 100% of 268.36MiB in 01:13
[debug] Invoking downloader on u'https://r1---sn-h5bt5guxax3vh-qxce.googlevideo.com/videoplayback?expire=1443884631&dur=2028.401&ipbits=0&sver=3&key=yt6&mime=audio%2Fwebm&gir=yes&signature=5F5F8CF2852A20A5A5804E03D7BA8B318347AEC8.45155720EC4DDA897517BD6B270239A8F1A95284&clen=34031062&itag=251&upn=EsLdmunxJdc&source=youtube&initcwndbps=902500&lmt=1443338875369980&keepalive=yes&sparams=clen%2Cdur%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&mv=m&mt=1443862895&ms=au&fexp=9405998%2C9406852%2C9407116%2C9408710%2C9409069%2C9415365%2C9415485%2C9416023%2C9416126%2C9416729%2C9416838%2C9417707%2C9417815%2C9418153%2C9418391%2C9418448%2C9419743%2C9420348%2C9421013%2C9421252%2C9421351&requiressl=yes&ip=84.2.91.186&mn=sn-h5bt5guxax3vh-qxce&mm=31&pl=20&id=o-APZzVMD8hSghX6adxuJzu6QsOfBULxljI48-K4IAbDdX&ratebypass=yes'
[download] Destination:  ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.f251.webm
[download] 100% of 32.45MiB in 00:08
[ffmpeg] Merging formats into " ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.mkv"
[debug] ffmpeg command line: ffmpeg -y -i 'file: ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.f136.mp4' -i 'file: ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file: ASMR Ear (Cleaning) Groomers & Spa Roleplay  (unisex)-DYGc-31mEec.temp.mkv'

real    1m28.506s
user    0m21.053s
sys 0m14.987s
dstftw commented 8 years ago

Works fine for me with vlc 2.2.0 and mplayer. So it's probably something wrong with either your ffmpeg or vlc.

ghost commented 8 years ago

Thanks for looking into this. I can confirm it works with mplayer. Sorry for the trouble.

$ mplayer audio.webm 
Creating config file: /home/zazdxscf/.mplayer/config
MPlayer SVN-r37440 (Gentoo)-5.2.0 (C) 2000-2015 MPlayer Team

Playing audio.webm.
libavformat version 56.40.101 (external)
libavformat file format detected.
[lavf] stream 0: audio (opus), -aid 0, -alang eng
Clip info:
 encoder: google
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 56.60.100 (external)
AUDIO: 48000 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->384000)
Selected audio codec: [ffopus] afm: ffmpeg (FFmpeg opus)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Video: no video
Starting playback...
A:  26.6 (26.6) of 2028.4 (33:48.4)  1.6% 

Exiting... (Quit)

EDIT: It's definitely vlc(not ffmpeg) because it does the same thing when compiled without ffmpeg, and this is vlc 2.2.0 (it decodesdemuxes just like the git version, but still no sound) screenshot_2015-10-03_21-38-12

ghost commented 8 years ago

Can you look in vlc Tools->Messages(Ctrl+M) in the Modules Tree tab and say whether the demux is "avformat" or "ogg" while the audio of the .webm is working for you? That's under libvlc->playlist->input->demux...

Looks like for .opus is demux "ogg" but for .webm is demux "avformat" and in the latter case Audio decoded/played remains 0 (for me). (in Tools->Media Information(Ctrl+i) Statistics tab) whether I'm using vlc 2.2.0 or the git version. With or without ffmpeg compiled in. I've no idea how to fix it currently. But clearly since with mplayer works, it must be something on my side.

dstftw commented 8 years ago

This is for 251 webm: vlc

ghost commented 8 years ago

Amazing! I didn't have --enable-mkv which is because gentoo has the matroska USE flag disabled by default, and now it works as it does for you, with demux "mkv" and audio works fine! It previously was demux "avformat" (with no audio being heard)

If any gentoo users stumble upon this no audio (no sound) issue on (some of) the .webm and .mkv files, just remember to USE=matroska when emerging vlc.

Thanks a lot for the help @dstftw ! Much appreciated!

EDIT: for consistency, I'm posting the emerge --info of the working setup:

# emerge --info vlc ffmpeg mplayer
Portage 2.2.22 (python 3.4.3-final-0, hardened/linux/amd64/no-multilib, gcc-5.2.0, glibc-2.21-r1, 4.1.7-hardened-r1-g45b4b78 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.1.7-hardened-r1-g45b4b78-x86_64-AMD_A6-3400M_APU_with_Radeon-tm-_HD_Graphics-with-gentoo-2.2
KiB Mem:    15870032 total,   1742256 free
KiB Swap:   33554428 total,  33546468 free
Timestamp of repository gentoo: Sat, 03 Oct 2015 00:45:01 +0000
sh bash 4.4_alpha-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
ccache version 3.2.3 [enabled]
app-shells/bash:          4.4_alpha-r1::gentoo
dev-lang/perl:            5.22.0::gentoo
dev-lang/python:          2.7.10::gentoo, 3.4.3::gentoo
dev-util/ccache:          3.2.3::gentoo
dev-util/cmake:           3.3.2::gentoo
dev-util/pkgconfig:       0.29::gentoo
sys-apps/baselayout:      2.2::gentoo
sys-apps/openrc:          0.17::gentoo
sys-apps/sandbox:         2.9::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r1::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            5.2.0::gentoo
sys-devel/gcc-config:     1.8::gentoo
sys-devel/libtool:        2.4.6-r1::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.2::gentoo (virtual/os-headers)
sys-libs/glibc:           2.21-r1::gentoo
Repositories:

gentoo
    location: /usr/portage
    priority: -1000

tox-overlay
    location: /var/lib/layman/tox-overlay
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -ggdb -fvar-tracking-assignments -fno-omit-frame-pointer -ftrack-macro-expansion=2 -fstack-protector-all -fPIC"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native -ggdb -fvar-tracking-assignments -fno-omit-frame-pointer -ftrack-macro-expansion=2 -fstack-protector-all -fPIC"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs binpkg-multi-instance ccache cgroup collision-protect config-protect-if-modified distlocks downgrade-backup ebuild-locks fakeroot fixlafiles force-mirror installsources ipc-sandbox merge-sync multilib-strict network-sandbox news nostrip parallel-fetch parallel-install prelink-checksums preserve-libs sandbox sfperms split-elog split-log strict unknown-features-warn unmerge-backup unmerge-logs userfetch userpriv usersandbox webrsync-gpg"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gd.tuwien.ac.at/opsys/linux/gentoo/ http://ftp.romnet.org/gentoo/ http://tux.rainside.sk/gentoo/ http://de-mirror.org/gentoo/  http://www.las.ic.unicamp.br/pub/gentoo/"
INSTALL_MASK="/lib/systemd /lib32/systemd /lib64/systemd /usr/lib/systemd /usr/lib32/systemd /usr/lib64/systemd /etc/systemd"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="3dnow 3dnowext X acl amd64 berkdb bindist btrfs bzip2 cli consolekit cracklib crypt cryptsetup cscope cxx dbus device-mapper dri egl extensions gdbm git gpg gpm gtk3 hardened iconv jpeg justify lm_sensors lock mmx mmxext modules mosh-hardening ncurses nptl ogg openmp opus pam pax_kernel pcre pie png policykit popcnt pulseaudio qt4 readline seccomp session smp sse sse2 sse3 sse4a ssl ssp startup-notification strong-security system-icu system-jpeg system-libvpx system-sqlite urandom xattr xcomposite xtpax zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="radeon" XFCE_PLUGINS="brightness clock trash battery power" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

media-video/vlc-9999::gentoo was built with the following:
USE="X a52 avcodec avformat bluray dbus debug dvb dvbpsi dvd encode faad ffmpeg flac gcrypt gme gnutls jpeg libnotify libsamplerate live matroska modplug mp3 mpeg mtp ncurses ogg opengl opus png postproc pulseaudio qt4 rdp rtsp sdl sdl-image swscale theora v4l vpx x264 x265 xcb xv -aalib -alsa (-altivec) -atmo (-audioqueue) -bidi -cdda -cddb -chromaprint -dc1394 -directfb (-directx) -dts (-dxva2) -fdk -fluidsynth -fontconfig -gnome -growl -httpd -ieee1394 -jack -kate -kde -libass -libav -libcaca -libtar -libtiger -linsys -lirc -lua (-macosx-dialog-provider) (-macosx-eyetv) (-macosx-qtkit) (-macosx-quartztext) (-media-library) -musepack (-neon) -omxil -opencv -optimisememory -projectm -qt5 -run-as-root -samba -schroedinger -sftp -shout -sid -skins -speex -svg -taglib -test -tremor -truetype -twolame -udev -upnp -vaapi -vcdx -vdpau -vlm -vnc -vorbis -wma-fixed -xml -zeroconf -zvbi" CPU_FLAGS_X86="mmx sse"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -L/usr/lib64/sidplay/builders/"

media-video/ffmpeg-2.8::gentoo was built with the following:
USE="X bzip2 encode gpl hardcoded-tables iconv mp3 network opus postproc pulseaudio threads zlib -aac -aacplus -alsa (-altivec) -amr -amrenc (-armv5te) (-armv6) (-armv6t2) (-armvfp) -bluray -bs2b -cdio -celt -cpudetection -debug -doc -examples -faac -fdk -flite -fontconfig -frei0r -fribidi -gme -gnutls -gsm -iec61883 -ieee1394 -jack -jpeg2k -ladspa -libass -libcaca -librtmp -libsoxr -libv4l -lzma (-mipsdspr1) (-mipsdspr2) (-mipsfpu) -modplug (-neon) -openal -opengl -openssl -oss -pic -quvi -samba -schroedinger -sdl -snappy -speex -ssh -static-libs -test -theora -truetype -twolame -v4l -vaapi -vdpau -vorbis -vpx -wavpack -webp -x264 -x265 -xcb -xvid -zvbi" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext sse sse2 sse3 -avx -avx2 -fma3 -fma4 -sse4_1 -sse4_2 -ssse3 -xop" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher"

media-video/mplayer-1.2_pre20150730::gentoo was built with the following:
USE="X cdio dvd dvdnav enca encode iconv jpeg libass osdmenu png pulseaudio shm truetype xscreensaver xv -a52 -aalib -alsa (-altivec) (-aqua) -bidi -bl -bluray -bs2b -cddb -cdparanoia -cpudetection -debug -dga -directfb -doc -dts -dv -dvb -faac -faad -fbcon -ftp -ggi -gif -gsm -ipv6 -jack -joystick -jpeg2k -ladspa -libcaca -libmpeg2 -lirc -live -lzo -mad -md5sum -mng -mp3 -nas -network -nut -openal -opengl -oss -pnm -pvr -radio -rar -rtc -rtmp -samba -sdl (-selinux) -speex -tga -theora -toolame -tremor -twolame -unicode -v4l -vdpau (-vidix) -vorbis -x264 -xanim -xinerama -xvid -xvmc -zoran" CPU_FLAGS_X86="3dnow 3dnowext mmx mmxext sse sse2 -ssse3" VIDEO_CARDS="-mga -s3virge -tdfx"