JuanBindez / pytubefix

Python3 library for downloading YouTube Videos.
http://pytubefix.rtfd.io/
MIT License
699 stars 100 forks source link

mp3=True not resulting in error free file. #325

Open KS-HTK opened 9 hours ago

KS-HTK commented 9 hours ago

Describe the bug Using yt.streams.get_audio_only().download(mp3=True) does not produce issue free mp3 file. The file can be played back but the id3 metadata is broken somehow. Neither eyed3 nor Windows explorer can add or modify the metadata of the downloaded file.


code that was used that resulted in the bug

import os
from pytubefix import YouTube
from pytubefix.exceptions import AgeRestrictedError
import eyed3

yt = YouTube("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
yt.streams.get_audio_only().download(mp3=True, output_path="music", filename="test")
audpath = os.path.join("music", "test.mp3")
file = eyed3.load(audpath)
if file is None:
  print("Error Could not load audiofile")

Expected behavior eyed3 should be able to load the file as it should be an mp3 mime-type.

converting from downloaded mp4 to mp3 using moviepy and then using eyed3 to load works fine.


Desktop (please complete the following information):

JuanBindez commented 5 hours ago

it is not corrupted, in fact it is not a real mp3

JuanBindez commented 5 hours ago

so it returns None

JuanBindez commented 5 hours ago
ExifTool Version Number         : 12.65
File Name                       : Rick Astley - Never Gonna Give You Up (Official Music Video).mp3
Directory                       : .
File Size                       : 3.4 MB
File Modification Date/Time     : 2024:11:14 22:11:54-03:00
File Access Date/Time           : 2024:11:14 22:18:44-03:00
File Inode Change Date/Time     : 2024:11:14 22:20:38-03:00
File Permissions                : -rw-rw-r--
File Type                       : M4A
File Type Extension             : m4a
MIME Type                       : audio/mp4
Major Brand                     : Unknown (dash)
Minor Version                   : 0.0.0
Compatible Brands               : iso6, mp41
Movie Header Version            : 0
Create Date                     : 2024:05:30 05:43:29
Modify Date                     : 2024:05:30 05:43:29
Time Scale                      : 44100
Duration                        : 0:03:32
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 2
Track Header Version            : 0
Track Create Date               : 2024:05:30 05:43:29
Track Modify Date               : 2024:05:30 05:43:29
Track ID                        : 1
Track Duration                  : 0:03:32
Track Layer                     : 0
Track Volume                    : 100.00%
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2024:05:30 05:43:29
Media Modify Date               : 2024:05:30 05:43:29
Media Time Scale                : 44100
Media Duration                  : 0:03:32
Media Language Code             : eng
Handler Description             : ISO Media file produced by Google Inc.
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Balance                         : 0
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Encoder                         : Google
Movie Fragment Sequence         : 22
Media Data Size                 : 38539
Media Data Offset               : 3395066
Avg Bitrate                     : 128 kbps