Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Can't download extracted audio as mp3 #152

Closed
kjames79 opened this issue May 20, 2024 · 9 comments · Fixed by #196
Closed

Can't download extracted audio as mp3 #152

kjames79 opened this issue May 20, 2024 · 9 comments · Fixed by #196
Labels
bug Something isn't working

Comments

@kjames79
Copy link

I've tried about all i can think to do. tried different arguments. always results in .opus

@marcopiovanello
Copy link
Owner

Can you please try this template -o '%(playlist_title)s/%(title)s.%(ext)s' --extract-audio --audio-format mp3?

@kjames79
Copy link
Author

kjames79 commented May 20, 2024 via email

@dj3500
Copy link
Contributor

dj3500 commented May 21, 2024

Works for me with template -x -f m4a (makes m4a, not mp3 - this might be easier as m4a is apparently always available as a stream from youtube?).

@lwsrbrts
Copy link

This works for me to produce an mp3 with the metadata/ID3 tag populated in most circumstances..

-x --audio-format mp3 --audio-quality 256 --embed-thumbnail --parse-metadata "title:%(title)s" --parse-metadata "uploader:%(album_artist)s" --embed-metadata --no-embed-info-json

@eric2788
Copy link
Contributor

eric2788 commented Sep 13, 2024

That just made a folder called NA and the files inside when downloaded were .webm

On Mon, May 20, 2024, 2:45 AM Marco Piovanello @.> wrote: Can you please try this template -o '%(playlist_title)s/%(title)s.%(ext)s' --extract-audio --audio-format mp3? — Reply to this email directly, view it on GitHub <#152 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABL5LB4QYQ7HMUA6VBLYMCLZDGLX7AVCNFSM6AAAAABH6Y5F36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZG44DCMRWGY . You are receiving this because you authored the thread.Message ID: @.>

same, no matter I changed to audio or not, it always using .webm leads that 404 not found. Download it instantly in Archive is the only solution for now.

@eric2788
Copy link
Contributor

@marcopeocchi the problem is here

func (p *Process) GetFileName(o *DownloadOutput) error {
    cmd := exec.Command(
        config.Instance().DownloaderPath,
        "--print", "filename",
        "-o", fmt.Sprintf("%s/%s", o.Path, o.Filename),
        p.Url,
    )
    cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

    out, err := cmd.Output()
    if err != nil {
        return err
    }

    p.Output.SavedFilePath = strings.Trim(string(out), "\n")
    return nil
}

even I added audio format argument --audio-format mp3, the print --filename still printing xxxxx.webm, better find an alternative approach for this.

eric2788 added a commit to eric2788/yt-dlp-web-ui that referenced this issue Sep 14, 2024
eric2788 added a commit to eric2788/yt-dlp-web-ui that referenced this issue Sep 15, 2024
@marcopiovanello
Copy link
Owner

@marcopeocchi the problem is here

func (p *Process) GetFileName(o *DownloadOutput) error {
    cmd := exec.Command(
        config.Instance().DownloaderPath,
        "--print", "filename",
        "-o", fmt.Sprintf("%s/%s", o.Path, o.Filename),
        p.Url,
    )
    cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

    out, err := cmd.Output()
    if err != nil {
        return err
    }

    p.Output.SavedFilePath = strings.Trim(string(out), "\n")
    return nil
}

even I added audio format argument --audio-format mp3, the print --filename still printing xxxxx.webm, better find an alternative approach for this.

It's indeed the GetFileName func :(
I'll try to come with a solution but in this time period I'm a little busy.

@marcopiovanello marcopiovanello added the bug Something isn't working label Sep 17, 2024
@eric2788
Copy link
Contributor

eric2788 commented Sep 17, 2024

@marcopeocchi the problem is here

func (p *Process) GetFileName(o *DownloadOutput) error {
    cmd := exec.Command(
        config.Instance().DownloaderPath,
        "--print", "filename",
        "-o", fmt.Sprintf("%s/%s", o.Path, o.Filename),
        p.Url,
    )
    cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}

    out, err := cmd.Output()
    if err != nil {
        return err
    }

    p.Output.SavedFilePath = strings.Trim(string(out), "\n")
    return nil
}

even I added audio format argument --audio-format mp3, the print --filename still printing xxxxx.webm, better find an alternative approach for this.

It's indeed the GetFileName func :(
I'll try to come with a solution but in this time period I'm a little busy.

I have forked with a solution that extacting the final output from progress log, you can check if it's suitable to you 😀
eric2788@f6cda25

@marcopiovanello
Copy link
Owner

Thank you so much! Seems pretty solid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants