Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Youtube m4a files downloaded with --extract-audio can't play in some players #3681

Closed
epitron opened this issue Sep 4, 2014 · 12 comments
Closed

Comments

@epitron
Copy link
Contributor

epitron commented Sep 4, 2014

A number of audio players use libfaad to decode M4A/AAC files, and this library has a shortcoming: it can't play the files that are downloaded from youtube using youtube-dl --extract-audio.

The problem is that youtube's MP4 container has an empty "time-to-sample atom" (a.k.a. seek table).

This can be easily fixed using ffmpeg's remuxer:

$ ffmpeg -i in.m4a -acodec copy -movflags faststart out.m4a

I was thinking that this would be good to add as a postprocessing filter for sites whose audio files have no seek table.

Thoughts?

@fogoat
Copy link

fogoat commented Nov 7, 2014

I've been told by Winamp support they do not support playing files that are MPEG DASH (m4a).

I use ffmpeg to convert the m4a DASH audio to m4a AAC LC via

ffmpeg -i input.m4a -vn -c:a copy output.m4a

Wondering myself if there's an easier way to achieve this inside youtube-dl.
Seems like you have a similar issue...?

@hymced
Copy link

hymced commented Jan 18, 2015

Hi,

I have tried to pipe the youtube-dl output directly through ffmeg, but it appears not to be that simple if you want to keep the filenaming scheme of youtube-dl (I am trying to download a 1000 tracks playlist).

From my point of view, the simplier here would be to add an option into youtube-dl script with your command line @sunk818 , allowing to easily retrieve the filenames with internal variables

@fogoat
Copy link

fogoat commented Jan 19, 2015

This works for me in Windows 7 and will work on a certain file mask (ext) within one folder (fold) and save it to the designated folder (dest).

Save the below as a batch file such as convert.bat
Then from the command line, use convert > run.bat
This will create a batch file called run.bat
Run.bat is the actual script that will perform the convert of the M4A DASH to just M4A.

set fold=c:\music\youtube-dl
set ext=*.m4a
set dest=c:\music\youtube-dl\converted\

for %%f in ("%fold%%ext%") do ECHO ffmpeg -i "%%f" -vn -acodec copy "%dest%%%~nxf"

@hymced
Copy link

hymced commented Jan 19, 2015

I am on Mac OS X 10.9.4 :)

@fogoat
Copy link

fogoat commented Jan 19, 2015

It's not hard to find a unix equivalent. Try superuser.com

On Jan 18, 2015, at 10:39 PM, Ced notifications@github.com wrote:

I am on Mac OS X 10.9.4 :)


Reply to this email directly or view it on GitHub.

@hymced
Copy link

hymced commented Jan 19, 2015

I don't know anything about windows batch files (if that's how it's called...) but do your method allows to execute a conversion immediately after downloading each track, or is it something you run after downloading all the DASH audio tracks ?

@fogoat
Copy link

fogoat commented Jan 20, 2015

I do it after I download the entire playlist.

On Jan 19, 2015, at 1:31 PM, Ced notifications@github.com wrote:

I don't know anything about windows batch files (if that's how it's called...) but do your method allows to execute a conversion immediately after downloading each track, or is it something you run after downloading all the DASH audio tracks ?


Reply to this email directly or view it on GitHub.

@jaimeMF
Copy link
Collaborator

jaimeMF commented Jan 20, 2015

You can use the --exec option, which runs a shell command for each video. For example: youtube-dl test:youtube --extract-audio --exec 'ffmpeg -y -i {} -vn -c:a copy {}.new.m4a'. If you want to keep the original filename you can just write a script (process-dash-audio.sh):

#!/bin/sh
inputname=$1

tempname=${inputname}.temp.m4a

echo "Processing dash audio: $inputname"
ffmpeg -y -i "$inputname" -vn -c:a copy "$tempname"

mv "$tempname" "$inputname"

Give it executable permissions and you can just run youtube-dl test:youtube --extract-audio --exec './process-dash-audio.sh {}'.

@hymced
Copy link

hymced commented Jan 20, 2015

Sounds good ! I'll try that thanks :)

phihag added a commit that referenced this issue Jan 23, 2015
@phihag
Copy link
Contributor

phihag commented Jan 23, 2015

youtube-dl 2015.01.23.4 and newer will automatically correct the header of the m4a file if ffmpeg is present on the system. I am therefore closing this issue. See our FAQ if you need help updating. Thank you for the report!

@phihag phihag closed this as completed Jan 23, 2015
@hymced
Copy link

hymced commented Jan 24, 2015

thanks for this update :) works fine

@stephenhartley
Copy link

@phihag I ran youtube-dl version 2017.06.12 on MacOS 10.12.5, with ffmpeg version 3.3.1 on the path, and the header doesn't get corrected, I guess because youtube-dl can't find ffmpeg?

If I run the ffmpeg command given by @sunk818 as a manual step on the download then all is OK, but I thought youtube-dl should invoke this using the PATH location?

Specifying --ffmpeg-location (plus folder path) does not do the header correction.

Bit puzzled here, maybe this in an OSX-specific thing? The permissions of ffmpeg look OK - I deleted the extended attributes on the ffmpeg executables while checking...

Peters-iMac:~ steve$ youtube-dl -v -f bestaudio "http://aod-dash-uk-live.akamaized.net/usp/auth/vod/piff_abr_full_audio/2011d5-b08spht3/vf_b08spht3_1bc5a5b3-a907-49d0-a46c-a13b0c1aa708.ism/pc_hd_abr_v2_uk_dash_master.mpd?__gda__=1497319576_2df07de3fa5ec99bba9667b59d5f6461" -o Texas_with_the_BBC_Scottish_Symphony_Orchestrav6.m4a
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'-f', u'bestaudio', u'http://aod-dash-uk-live.akamaized.net/usp/auth/vod/piff_abr_full_audio/2011d5-b08spht3/vf_b08spht3_1bc5a5b3-a907-49d0-a46c-a13b0c1aa708.ism/pc_hd_abr_v2_uk_dash_master.mpd?__gda__=1497319576_2df07de3fa5ec99bba9667b59d5f6461', u'-o', u'Texas_with_the_BBC_Scottish_Symphony_Orchestrav6.m4a']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.06.12
[debug] Python version 2.7.10 - Darwin-16.6.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.1, ffprobe 3.3.1
[debug] Proxy map: {}
[generic] pc_hd_abr_v2_uk_dash_master: Requesting header
WARNING: Falling back on generic information extractor.
[generic] pc_hd_abr_v2_uk_dash_master: Downloading webpage
[generic] pc_hd_abr_v2_uk_dash_master: Extracting information
[debug] Invoking downloader on u'http://aod-dash-uk-live.akamaized.net/usp/auth/vod/piff_abr_full_audio/2011d5-b08spht3/vf_b08spht3_1bc5a5b3-a907-49d0-a46c-a13b0c1aa708.ism/dash/'
[dashsegments] Total fragments: 626
[download] Destination: Texas_with_the_BBC_Scottish_Symphony_Orchestrav6.m4a
[download] 100% of 153.29MiB in 04:33

oskar456 referenced this issue in oskar456/youtube-dl Jul 9, 2017
This fixes issue #3681 and other similar for non-YouTube video sites
that use MPEG-DASH.

Signed-off-by: Ondřej Caletka <ondrej@caletka.cz>
oskar456 referenced this issue in oskar456/youtube-dl Dec 19, 2017
This fixes issue #3681 and other similar for non-YouTube video sites
that use MPEG-DASH.

Signed-off-by: Ondřej Caletka <ondrej@caletka.cz>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants
@epitron @phihag @jaimeMF @hymced @fogoat @stephenhartley and others