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

opus streams embedded into mp4 containers support #3

Open
byblo opened this issue Nov 18, 2022 · 10 comments
Open

opus streams embedded into mp4 containers support #3

byblo opened this issue Nov 18, 2022 · 10 comments
Labels
enhancement New feature or request

Comments

@byblo
Copy link

byblo commented Nov 18, 2022

Please support opus streams embedded into mp4 containers like in this sample:

https://www49.zippyshare.com/v/VP3KEjwX/file.html (opus_stream_in_mp4_container.zip)

@RamonUnch
Copy link
Owner

Would be nice indeed, Unfortunately it would require a lot of work because in_opus is based on the libopusfile library that can only handle ogg container.

For now when I encounter such files I use ffmpeg to fix it:

ffmpeg -i opusfileinMP4.mp4 -acodec copy opusfile_in_OGG.opus

With the latest version of ffmpeg even tags get converted properly so this is what I use. It is perfectly lossless as well.

If I get more time for this project I might support more containers in the future.

@RamonUnch RamonUnch added the enhancement New feature or request label Nov 18, 2022
@byblo
Copy link
Author

byblo commented Nov 18, 2022

That would be nice.

I save some opus alone into mp4 container since it is allowing to keep both thumbnail and chapters time positions+chapters titles from youtube videos for instance.

I did not tried ogg container yet, will try ASAP. (edit: does not work with ogg or ogm containers)

@RamonUnch
Copy link
Owner

.opus files are ogg containing opus stream so it must work.
The proper way to name those files is .opus even though the container is .ogg
Y=The rason is that .ogg files are assumed to be ogg/vorbis files instead of ogg/opus files.

Use the above command line and it should work as long as the extension is .opus
If for some reason you want to use the .ogg extension for your ogg/opus files, there is a dirty hack that you can enable in the .ini file (have a look at the in_opus.txt for more details.

@RamonUnch
Copy link
Owner

Keep in mind that for a Winamp plugin the file filter is only based on file extension so if the extension is not .opus, Winamp will not even try to call the in_opus.dll plugin.

@byblo
Copy link
Author

byblo commented Nov 20, 2022

The problem is the thumnail PNG seems to be lost at the conversion mp4 to opus. Is there a way to preserve it?

@RamonUnch
Copy link
Owner

Try to add -map 0 so that all channels are kept.

@byblo
Copy link
Author

byblo commented Nov 20, 2022

-map 0 seems to convert the thumbail from png to video stream, which makes it hard to read on some player like MPV
Same for -c:v libtheora -q:v 10

It seems that there is a fix available for ffmpeg to force it to keep the png format but no idea how to compile it: https://trac.ffmpeg.org/ticket/4448#comment:6

@RamonUnch
Copy link
Owner

RamonUnch commented Nov 20, 2022

more info about this:

https://stackoverflow.com/questions/64561570/ffmpeg-convert-audio-to-ogg-and-keep-album-cover
https://trac.ffmpeg.org/ticket/4448

Actually try with:

~~ffmpeg -i input.mp4 -acodec copy -vcodec libtheora output.opus~~

EDIT:

ffmpeg -i input.mp4 -map 0 -acodec copy -vcodec libtheora -q:v 10 output.opus

EDIT2: Sorry I hand not seen your latest post

@RamonUnch
Copy link
Owner

Well indeed it is a shame that such a simple matter of embedding a cover image in an ogg stream is not supported.
I guess we should look for other encoders.

@byblo
Copy link
Author

byblo commented Nov 20, 2022

I think I will keep for now the current format of opus into mp4 container and keep playing them with MPV, since it mainly allows me to keep everything into one file while being able to save youtube streams+posted dates using yt-dlp_x86.exe and youtube-dl-FE.exe(a frontend i wrote for the first one)

But thank you for your efforts, having an opus plugin for winamp is great :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants