Rudloff / alltube

Web GUI for youtube-dl
GNU General Public License v3.0
2.96k stars 582 forks source link

M4a files missing file info #302

Closed AmyXS closed 4 years ago

AmyXS commented 4 years ago

New issue

Your environment

Please answer these questions when reporting a new issue:

What is your operating system (Windows, Linux, OSX, etc.)?

OSX visiting https://alltubedownload.net/ I will skip the following questions as I was using alltubedownload.net

What is your web server (Apache, IIS, etc.)?

What version of AllTube are you using?

How did you install AllTube (with Git or with a release package)?

What version of PHP are you using?

What version of Python are you using?

What version of youtube-dl are you using?

Do you get any PHP-related errors in your webserver's logs?

What is the content of your config/config.yml file?

# Insert content here.

Please provide the URL of a video that causes the issue. https://www.youtube.com/watch?v=4hPv6EuV7dM

Describe your issue

When downloading a file as m4a, the file is missing file info such as maximum packet size. As a result, the file can't be opened by some music players such as Audacity. Here's the output of file info related to this file.

Actual output from afinfo videoplayback.mp4:

File:          videoplayback.mp4
File type ID:   mp4f
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
                no channel layout.
estimated duration: 220.054059 sec
audio bytes: 0
audio packets: 9479
bit rate: 0 bits per second
packet size upper bound: 0
maximum packet size: 0
audio data file offset: 1824
not optimized
audio 9704384 valid frames + 2112 priming + 0 remainder = 9706496
format list:
[ 0] format:      2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Stereo (L R)
----

Expected output: (here's the output from afinfo on the file downloaded from command youtube-dl -f "bestaudio[ext=m4a]" -o "%(title)s.%(ext)s" https://www.youtube.com/watch\?v\=4hPv6EuV7dM)

File:           Fleetwood Mac - Big Love (Official Music Video).m4a
File type ID:   mp4f
Num Tracks:     1
----
Data format:     2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
                no channel layout.
estimated duration: 220.101950 sec
audio bytes: 3521631
audio packets: 9479
bit rate: 127999 bits per second
packet size upper bound: 598
maximum packet size: 598
audio data file offset: 44
not optimized
audio 9706496 valid frames + 0 priming + 0 remainder = 9706496
format list:
[ 0] format:      2 ch,  44100 Hz, 'aac ' (0x00000000) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Channel layout: Stereo (L R)
----

Any idea why the file is different than what I get from calling youtube-dl -f "bestaudio[ext=m4a]" ?

Thanks very much in advance!

Rudloff commented 4 years ago

Hello,

Thanks for the report.

Alltube downloads the M4A file from the server without modifying it. But it seems youtube-dl uses ffmpeg to somehow fix the file:

[ffmpeg] Correcting container in "Fleetwood Mac - Big Love (Official Music Video)-4hPv6EuV7dM.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Fleetwood Mac - Big Love (Official Music Video)-4hPv6EuV7dM.m4a' -c copy -f mp4 'file:Fleetwood Mac - Big Love (Official Music Video)-4hPv6EuV7dM.temp.m4a'

I guess we could do something similar, but only if stream mode is enabled (which means not on https://alltubedownload.net/).

AmyXS commented 4 years ago

Thanks for looking into it Rudloff! That makes sense :)