Opus : difference between .opus and .ogg file extension

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Opus : difference between .opus and .ogg file extension

nerbrume
Hello all,

I'm encoding my audio files to opus, with the following command:
> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus
(Debian squeeze, ffmpeg version 3.3.5)

According to wikipedia, the "opus" container should just be an ogg container (https://en.wikipedia.org/wiki/Opus_%28audio_format%29).
However, encoding my file with an ogg extension :
> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.ogg
produces a different file from the previous one (md5 are mismatched).

Indeed, ffmpeg tells me so : "(...)Output #0, ogg, to 'test.ogg':(...)" instead of "(...)Output #0, opus, to 'za.opus':(...)"
However, the "file" util view both files as ogg :
> file test.*
test.ogg:  Ogg data, Opus audio,
test.opus: Ogg data, Opus audio,


What's going on here ?
What is the container used when encoding a file to ".opus" ?
Which one should I use (I'm aiming for maximum compatibility, mainly with android phones) ?

Thanks for reading !

N
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

Kieran O Leary
Hi

On Thu, Nov 30, 2017 at 10:24 AM,  <[hidden email]> wrote:

> Hello all,
>
> I'm encoding my audio files to opus, with the following command:
>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus
> (Debian squeeze, ffmpeg version 3.3.5)
>
> According to wikipedia, the "opus" container should just be an ogg container (https://en.wikipedia.org/wiki/Opus_%28audio_format%29).
> However, encoding my file with an ogg extension :
>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.ogg
> produces a different file from the previous one (md5 are mismatched).
>

I know nothing about these formats really, but using md5 for this kind
of comparison is sometimes flawed. With some formats, pieces of
metadata like 'encoded date', or perhaps a unique ID can be written.
So each time you run the same ffmpeg command, you will get a different
whole file MD5 value as a few small bits will indeed be different.

I mimicked your command and produced opus and ogg outputs from the
same input. Using mediainfo's trace feature, it looks to me like both
are pretty much identical, they just have different values for 'stream
serial number' and 'page checksum'. It looks to me as though both
files are pretty much identical otherwise. Here's the output of both
trace reports:
https://gist.github.com/kieranjol/45edc4871270ce6110d256590e71e229

I used
mediainfo --Details=1 test.ogg
mediainfo --Details=1 test.opus

to get those outputs.

Best,

Kieran.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

Kieran O Leary
In reply to this post by nerbrume
P.S

On Thu, Nov 30, 2017 at 10:24 AM,  <[hidden email]> wrote:
>
> What's going on here ?

Answered in previous email.

> What is the container used when encoding a file to ".opus" ?

OGG. opus just seems to be a codec, not a container. When you use the
.opus extension for your ffmpeg output, an OGG container is used, and
the filename extension is .opus.

> Which one should I use (I'm aiming for maximum compatibility, mainly with android phones) ?

I dunno, but according to the spec:
https://tools.ietf.org/html/rfc7845#section-9 - using the OGG
container with the .opus extension seems to be the way to go.
So this command line that you used is probably for the best  :

 ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus

-K
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

Carl Eugen Hoyos-2
In reply to this post by nerbrume
2017-11-30 11:24 GMT+01:00  <[hidden email]>:

> I'm encoding my audio files to opus, with the following command:
>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus
> (Debian squeeze, ffmpeg version 3.3.5)
>
> According to wikipedia, the "opus" container should just be an ogg
> container (https://en.wikipedia.org/wiki/Opus_%28audio_format%29).
> However, encoding my file with an ogg extension :
>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.ogg
> produces a different file from the previous one (md5 are mismatched).

Use -fflags +bitexact to get identical files, you will also get different
files when writing to out1.ogg and out2.ogg.

The file suffix ".opus" is just a shorthander for "-acodec opus -f ogg".

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

Carl Eugen Hoyos-2
2017-11-30 13:14 GMT+01:00 Carl Eugen Hoyos <[hidden email]>:
> 2017-11-30 11:24 GMT+01:00  <[hidden email]>:
>
>> I'm encoding my audio files to opus, with the following command:
>>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus

>> However, encoding my file with an ogg extension :
>>> ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.ogg
>> produces a different file from the previous one (md5 are mismatched).
>
> Use -fflags +bitexact to get identical files, you will also get different
> files when writing to out1.ogg and out2.ogg.

To elaborate:
The ogg files contain a serial number if the option is not specified,
this serial number is created with a function producing pseudo-random
numbers.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

nerbrume
In reply to this post by Kieran O Leary
Le 2017-11-30 11:52, Kieran O Leary a écrit :

> I know nothing about these formats really, but using md5 for this kind
> of comparison is sometimes flawed. With some formats, pieces of
> metadata like 'encoded date', or perhaps a unique ID can be written.
> So each time you run the same ffmpeg command, you will get a different
> whole file MD5 value as a few small bits will indeed be different.

Oh, didn't thought thought of that. Makes sense.

> I mimicked your command and produced opus and ogg outputs from the
> same input. Using mediainfo's trace feature, it looks to me like both
> are pretty much identical, they just have different values for 'stream
> serial number' and 'page checksum'. It looks to me as though both
> files are pretty much identical otherwise. Here's the output of both
> trace reports:
> https://gist.github.com/kieranjol/45edc4871270ce6110d256590e71e229
>
> I used
> mediainfo --Details=1 test.ogg
> mediainfo --Details=1 test.opus
>
> to get those outputs.

Well, I did first try with the graphical front-end of mediainfo, but the
version I used somehow didn't like the ".opus", and didn't show much
Comments. I guess command-line is always more reliable :)

Thanks !

N
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

nerbrume
In reply to this post by Kieran O Leary
Le 2017-11-30 12:50, Kieran O Leary a écrit :

> I dunno, but according to the spec:
> https://tools.ietf.org/html/rfc7845#section-9 - using the OGG
> container with the .opus extension seems to be the way to go.
> So this command line that you used is probably for the best  :
>
>  ffmpeg -i test.mp3 -acodec libopus -b:a 64000 -vbr on test.opus

For reference, from my own tests, using ".ogg" as a file ext is better,
as the mediascanner (the android process cataloging media files) doesn't
pick up ".opus" files.
However, YMMV, as I found at least one audio player that saw the
".opus", but not the ".ogg"...
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

nerbrume
In reply to this post by Carl Eugen Hoyos-2
Le 2017-11-30 13:18, Carl Eugen Hoyos a écrit :

> To elaborate:
> The ogg files contain a serial number if the option is not specified,
> this serial number is created with a function producing pseudo-random
> numbers.

Ok, thanks for the more advanced explanation, I didn't knew about this
"feature", I never saw this serial number in the various tag editors I
used.

Thanks !
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Opus : difference between .opus and .ogg file extension

Carl Eugen Hoyos-2
In reply to this post by Kieran O Leary
2017-11-30 11:52 GMT+01:00 Kieran O Leary <[hidden email]>:
> With some formats, pieces of metadata like 'encoded date',

Iirc, we don't do that (not even for formats requesting it)
because it is considered a security issue.
(I may misremember though.)

> or perhaps a unique ID can be written.

This is what ogg requires and is done.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".