Convert YouTube DASH audio (youtube-dl) to m4a (AAC DL)

7

8

I am unable to listen to m4a DASH audio I download from YouTube via youtube-dl on Winamp. Is there an option in youtube-dl to remove the DASH audio part of m4a file and download/save it as an m4a (AAC LC) without loss of quality? So far, I am using ffmpeg -i input.m4a -vn -acodec copy output.m4a to convert each file so it plays properly in Winamp.

Sun

Posted 2014-11-07T08:17:48.447

Reputation: 5 198

Answers

5

youtube-dl 2015.01.23.4 and newer will automatically correct the header of the m4a file if ffmpeg is present on the system.

Source: youtube-dl : Youtube m4a files downloaded with --extract-audio can't play in some players
All you have to do is to add the path to the directory containing the ffmpeg binary to your system path variable (like so in Windows 7):

Or use the --ffmpeg-location <path to ffmpeg binary or its containing directory> command line argument when calling youtube-dl, to allow youtube-dl through ffmpeg to automatically correct this.

galacticninja

Posted 2014-11-07T08:17:48.447

Reputation: 5 348

My question was appropriate in Nov 14. youtube-dl author addressed the issue in Jan 15. Glad it is part of youtube-dl now. – Sun – 2015-03-11T15:51:11.493

6

No, you need a second conversion step.

The problem is that for YouTube DASH, the MP4 container's ftyp has the "major brand" set to dash instead of m4a. This is the correct approach for DASH streaming, but Winamp is too old to recognize it (and many other programs are).

Now, what would be a reasonable suggestion is to create a feature request for youtube-dl to add post-processing support for ffmpeg to convert the major brand of the MP4 container to something more compatible. But at the moment, such a thing does not exist.

Or, file a bug report for Winamp to include decoding support for dash brands. Since it's likely to rely on a third-party decoder plugin, this probably means raising a bug report somewhere else, too.

slhck

Posted 2014-11-07T08:17:48.447

Reputation: 182 472

Do you think the ffmpeg parameters I am currently using is best for converting it from MPEG DASH m4a to AAC LC m4a? – Sun – 2014-11-07T08:44:31.823

2Yes. You're not actually converting the audio bitstream itself – you're just changing the metadata. This is a lossless process, so you won't lose audio quality. – slhck – 2014-11-07T08:45:51.863

It's not an opinion. The build of Winamp appears to be too old to have implemented the (rather recent) MPEG-4 brands from the MPEG-DASH standard. Other software supports it. And like I said, some other programs may fail. – slhck – 2014-11-07T18:49:00.860

1

I took the liberty of using your ffmpeg command and this is what I got: yt "My Youtube File.mp4"

A file yt.bat placed in system32 containing:

@echo off
mv %1 "_%~n1"
ffmpeg -i "_%~n1" -vn -c:a copy "%~n1.m4a"
rm "_%~n1"

*renames automatically to m4a, which can be changed in the code.

**it needs to be through temp file and then using rm, mv, otherwise the file and filename get corrupted.

Qwerty

Posted 2014-11-07T08:17:48.447

Reputation: 308

1@sunk818 You are absolutely right about the file deletion in case something goes wrong. I guess I could add some kind of a check. ..But then, I run this command right after youtube download, so I can just download it again. – Qwerty – 2014-12-04T13:01:59.320