IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Dumped opus streams have incorrect "Durations"., [TOS #6: moved from Scientific Discussion]
bat_guano
post Jan 24 2013, 23:19
Post #1





Group: Members
Posts: 19
Joined: 7-January 13
Member No.: 105656



Hi
I've tried dumping some opus streams to file, but the results are strange. ohmy.gif
Dumped files have incorrect "Durations".
This makes confusion when the files are played with VLC or SMPlayer etc.

What causes opus streams to create files with incorrect "Durations"?
And how can I fix it?

For example, a 30 second sample:-
CODE
timeout 30 ffmpeg -y -i http://radioserver1.delfa.net/64.opus -c copy SmoothJazz1.opus


MediaInfo shows incorrect Duration 4mn 17s.

QUOTE
General
Complete name : SmoothJazz1.opus
Format : OGG
File size : 258 KiB
Duration : 4mn 17s
Overall bit rate : 8 227 bps
Writing application : Lavf54.61.102

Audio
ID : 36710742 (0x2302956)
Format : Opus
Duration : 4mn 17s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Writing library : Lavf54.61.102



Similar results using MPlayer

CODE
rm -f fifo && mkfifo fifo; \
timeout 30 \
mplayer -nocache -noconsolecontrols -dumpstream -dumpfile fifo \
"http://radioserver1.delfa.net/64.opus" -demuxer lavf \
& ffmpeg -y -i fifo -c copy SmoothJazz2.opus \
&& rm -f fifo


MediaInfo shows incorrect Duration 2mn 18s.

QUOTE
General
Complete name : SmoothJazz2.opus
Format : OGG
File size : 254 KiB
Duration : 2mn 18s
Overall bit rate : 15.0 Kbps
Writing application : Lavf54.61.102

Audio
ID : 2098600889 (0x7D161BB9)
Format : Opus
Duration : 2mn 18s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Writing library : Lavf54.61.102


This post has been edited by bat_guano: Jan 24 2013, 23:32
Go to the top of the page
+Quote Post
Dynamic
post Jan 25 2013, 02:51
Post #2





Group: Members
Posts: 832
Joined: 17-September 06
Member No.: 35307



These sound like raw streams, not Ogg-encapsulated Opus files. Raw streams will be of unknown length, so most tools, unless they walk through the file in full will make some kind of guess of duration based on initial bitrate and file size, for example. Have you tried opusinfo from the official libopus?

Very nice sounding Opus stream, by the way.


--------------------
Dynamic – the artist formerly known as DickD
Go to the top of the page
+Quote Post
bat_guano
post Jan 25 2013, 10:57
Post #3





Group: Members
Posts: 19
Joined: 7-January 13
Member No.: 105656



QUOTE (Dynamic @ Jan 25 2013, 02:51) *
... Raw streams will be of unknown length, so most tools, unless they walk through the file in full will make some kind of guess of duration...

Yes, similar incorrect duration when treating stream as "raw":-
CODE
timeout 30 \
mplayer -nocache -dumpstream -dumpfile SmoothJazz3.opus \
"http://radioserver1.delfa.net/64.opus"


(Though we don't have incorrect duration when we dump "raw" mp3 streams) cool.gif

So maybe it is necessary to dump the raw opus stream to file then mux it into ogg without "guessing" the duration.
Which mux software will do this with accurate duration?

This post has been edited by bat_guano: Jan 25 2013, 11:29
Go to the top of the page
+Quote Post
2012
post Jan 25 2013, 23:47
Post #4





Group: Members
Posts: 82
Joined: 7-February 12
Member No.: 96993



1st of all, those are Ogg-encapsulated Opus files.

Generally speaking, life streams are implemented in a way that clients can connect at arbitrary offsets.

In this case, the duration you see is correct! It's just the stream does not start from 0!

You can see that instantly if you play the saved file in mplayer, or if you run opusinfo:

CODE
WARNING: sequence number gap in stream 1. Got page 257 when expecting page 2. Indicates missing data. (normal for live streams)
WARNING: discontinuity in stream (1)
WARNING: EOS not set on stream 1 (normal for live streams)
Go to the top of the page
+Quote Post
bat_guano
post Jan 26 2013, 02:45
Post #5





Group: Members
Posts: 19
Joined: 7-January 13
Member No.: 105656



QUOTE (2012 @ Jan 25 2013, 23:47) *
In this case, the duration you see is correct! It's just the stream does not start from 0!

OK, thanks for explanation. smile.gif
I can see message in MPlayer "Could not update timestamps for skipped samples"

And opusinfo shows "Playback length: 0m:32.992s" (which is near enough 30 seconds).

And this message explains why SMPlayer plays with slider not at start position:-
"WARNING: sequence number gap in stream 1. Got page 215 when expecting page 2. Indicates missing data."

But is there a method to clean up the offset/timestamps so that the files do start at 0 and behave well with SMPlayer etc? cool.gif

QUOTE
@ubuntu:~$ mplayer SmoothJazz3.opus
MPlayer SVN-r35829-4.5.2 © 2000-2013 MPlayer Team

Playing SmoothJazz3.opus.
libavformat version 54.61.103 (internal)
libavformat file format detected.
[lavf] stream 0: audio (libopus), -aid 0, Bring It!
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.90.100 (internal)
[libopus @ 0x8d2fb80]Could not update timestamps for skipped samples.
AUDIO: 48000 Hz, 2 ch, s16le, 0.0 kbit/0.00% (ratio: 0->192000)
Selected audio codec: [fflibopus] afm: ffmpeg (FFmpeg libopus)
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A: 235.7 (03:55.6) of 246.0 (04:06.0) 1.9%


QUOTE
@ubuntu:~$ opusinfo SmoothJazz3.opus
Processing file "SmoothJazz3.opus"...

New logical stream (#1, serial: 183abf41): type opus
Encoded with libopus 1.0.2
User comments section follows...
ENCODER=scripts
TITLE=Bring It!
TRACKNUMBER=6
TRACKTOTAL=10
GENRE=Smooth Jazz
DATE=2011
COMMENT=From RAW PCM to opus
ARTIST=Richard Elliot
ALBUM=In The Zone
WARNING: sequence number gap in stream 1. Got page 215 when expecting page 2. Indicates missing data. (normal for live streams)
WARNING: discontinuity in stream (1)
WARNING: EOS not set on stream 1 (normal for live streams)
Opus stream 1:
Pre-skip: 356
Playback gain: 0 dB
Channels: 2
Original sample rate: 44100Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 1000.0ms (max), 1000.0ms (avg), 1000.0ms (min)
Total data length: 257706 bytes (overhead: 1.1%)
Playback length: 0m:32.992s
Average bitrate: 62.49 kb/s, w/o overhead: 61.8 kb/s


Go to the top of the page
+Quote Post
bat_guano
post Feb 2 2013, 20:32
Post #6





Group: Members
Posts: 19
Joined: 7-January 13
Member No.: 105656



QUOTE (bat_guano @ Jan 26 2013, 03:45) *
But is there a method to clean up the offset/timestamps so that the files do start at 0 and behave well with SMPlayer etc?

Bump
Go to the top of the page
+Quote Post
NullC
post Feb 4 2013, 19:54
Post #7





Group: Developer
Posts: 200
Joined: 8-July 03
Member No.: 7653



QUOTE (2012 @ Jan 25 2013, 14:47) *
In this case, the duration you see is correct! It's just the stream does not start from 0!


I don't think thats correct— unless there is some special mplayer convention it should be reporting the real duration of the provided file. There is no requirement that the times start at zero in a stream— I could, if I wanted, make opusenc choose random start times and I wouldn't expect it to break anything.

Go to the top of the page
+Quote Post
bat_guano
post May 14 2013, 01:17
Post #8





Group: Members
Posts: 19
Joined: 7-January 13
Member No.: 105656



Hi
I've just tried this command again with a newer version of FFmpeg:-
CODE
ffmpeg -y -i http://radioserver1.delfa.net/64.opus -t 30 -c copy SmoothJazz1.ogg


ffmpeg version git-2013-05-10-b2cf655 Copyright © 2000-2013 the FFmpeg developers built on May 10 2013 22:14:21

Now ....

SMPlayer plays the file OK - and it is seekable. smile.gif

And mediainfo shows the correct duration. smile.gif

Maybe there has been a change to FFmpeg to fix this problem. cool.gif

QUOTE
@ubuntu:~$ mediainfo SmoothJazz1.ogg
General
Complete name : SmoothJazz1.ogg
Format : OGG
File size : 234 KiB
Duration : 30s 13ms
Overall bit rate : 63.9 Kbps
Writing application : Lavf55.4.101

Audio
ID : 507024822 (0x1E3895B6)
Format : Opus
Duration : 30s 13ms
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Writing library : Lavf55.4.101


This post has been edited by bat_guano: May 14 2013, 01:32
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st December 2014 - 18:23