[FFmpeg-trac] #4692(undetermined:new): opus + webm - inconsistent meta?

FFmpeg trac at avcodec.org
Wed Jul 1 23:45:01 CEST 2015


#4692: opus + webm - inconsistent meta?
-------------------------------------+-------------------------------------
             Reporter:  ronag        |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 {{{
 ffmpeg -i src.wav -ar 48000 -af
 atrim=start_sample=24000*0:end_sample=240000*1 -c:a opus 0.webm
 }}}

 I'm a bit confused by ffmpeg while encoding opus into webm. I have a wav
 file with exactly 240000 samples @ 48kHz. The resulting file gives me the
 following information:

 Duration: 5.01,
 Start 0.007
 discard 648/900 samples
 240312 samples decoded.

 If I have several of these files how would I play them seamlessly without
 gaps?

 i.e. in a browser I've tried:

 {{{
 sourceBuffer.timestampOffset = 5 * n - 0.007;
 sourceBuffer.appendWindowStart = 5 * n;
 sourceBuffer.appendWindowEnd = 5 * (n+1);
 sourceBuffer.appendBuffer(new Uint8Array(buffer[n]));
 }}}

 However, there are audible gaps.

 How many samples am I actually supposed to discard? 0.007 * 48000, 648, or
 240312 - 240000?

 {{{
 ffprobe -i 0.webm
 ffprobe version 2.6.3 Copyright (c) 2007-2015 the FFmpeg developers
   built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM
 3.6.0svn)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.3 --enable-shared
 --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
 libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
 --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp
 --enable-libass --enable-ffplay --enable-libfdk-aac --enable-openssl
 --enable-libopus --enable-libwebp --enable-nonfree --enable-vda
   libavutil      54. 20.100 / 54. 20.100
   libavcodec     56. 26.100 / 56. 26.100
   libavformat    56. 25.101 / 56. 25.101
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 11.102 /  5. 11.102
   libavresample   2.  1.  0 /  2.  1.  0
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
   libpostproc    53.  3.100 / 53.  3.100
 Input #0, matroska,webm, from '0.webm':
   Metadata:
     encoder         : Lavf56.25.101
   Duration: 00:00:05.01, start: 0.007000, bitrate: 94 kb/s
     Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp (default)
 h59ec2765:sintel ronagy$ ffmpeg -loglevel debug -i 1.webm asd.wav
 ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
   built with Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM
 3.6.0svn)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/2.6.3 --enable-shared
 --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables
 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
 libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid
 --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp
 --enable-libass --enable-ffplay --enable-libfdk-aac --enable-openssl
 --enable-libopus --enable-libwebp --enable-nonfree --enable-vda
   libavutil      54. 20.100 / 54. 20.100
   libavcodec     56. 26.100 / 56. 26.100
   libavformat    56. 25.101 / 56. 25.101
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 11.102 /  5. 11.102
   libavresample   2.  1.  0 /  2.  1.  0
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
   libpostproc    53.  3.100 / 53.  3.100
 Splitting the commandline.
 Reading option '-loglevel' ... matched as option 'loglevel' (set logging
 level) with argument 'debug'.
 Reading option '-i' ... matched as input file with argument '1.webm'.
 Reading option 'asd.wav' ... matched as output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option loglevel (set logging level) with argument debug.
 Successfully parsed a group of options.
 Parsing a group of options: input file 1.webm.
 Successfully parsed a group of options.
 Opening an input file: 1.webm.
 [matroska,webm @ 0x7fbfa300da00] Format matroska,webm probed with
 size=2048 and score=100
 st:0 removing common factor 1000000 from timebase
 [matroska,webm @ 0x7fbfa300da00] Before avformat_find_stream_info() pos:
 473 bytes read:32768 seeks:0
 [matroska,webm @ 0x7fbfa300da00] All info found
 [matroska,webm @ 0x7fbfa300da00] After avformat_find_stream_info() pos:
 942 bytes read:32768 seeks:0 frames:1
 Input #0, matroska,webm, from '1.webm':
   Metadata:
     encoder         : Lavf56.25.101
   Duration: 00:00:05.01, start: 0.007000, bitrate: 94 kb/s
     Stream #0:0, 1, 1/1000: Audio: opus, 48000 Hz, stereo, fltp (default)
 Successfully opened the file.
 Parsing a group of options: output file asd.wav.
 Successfully parsed a group of options.
 Opening an output file: asd.wav.
 File 'asd.wav' already exists. Overwrite ? [y/N] y
 Successfully opened the file.
 detected 8 logical cores
 [graph 0 input from stream 0:0 @ 0x7fbfa42003a0] Setting 'time_base' to
 value '1/48000'
 [graph 0 input from stream 0:0 @ 0x7fbfa42003a0] Setting 'sample_rate' to
 value '48000'
 [graph 0 input from stream 0:0 @ 0x7fbfa42003a0] Setting 'sample_fmt' to
 value 'fltp'
 [graph 0 input from stream 0:0 @ 0x7fbfa42003a0] Setting 'channel_layout'
 to value '0x3'
 [graph 0 input from stream 0:0 @ 0x7fbfa42003a0] tb:1/48000 samplefmt:fltp
 samplerate:48000 chlayout:0x3
 [audio format for output stream 0:0 @ 0x7fbfa42008a0] Setting
 'sample_fmts' to value 's16'
 [audio format for output stream 0:0 @ 0x7fbfa42008a0] auto-inserting
 filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and
 the filter 'audio format for output stream 0:0'
 [AVFilterGraph @ 0x7fbfa4000160] query_formats: 4 queried, 6 merged, 3
 already done, 0 delayed
 [auto-inserted resampler 0 @ 0x7fbfa4201060] ch:2 chl:stereo fmt:fltp
 r:48000Hz -> ch:2 chl:stereo fmt:s16 r:48000Hz
 Output #0, wav, to 'asd.wav':
   Metadata:
     ISFT            : Lavf56.25.101
     Stream #0:0, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001),
 48000 Hz, stereo, s16, 1536 kb/s (default)
     Metadata:
       encoder         : Lavc56.26.100 pcm_s16le
 Stream mapping:
   Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
 Press [q] to stop, [?] for help
 [opus @ 0x7fbfa3011400] skip 0 samples due to side data
 [opus @ 0x7fbfa3011400] discard 648/960 samples
 [output stream 0:0 @ 0x7fbfa4200620] EOF on sink link output stream
 0:0:default.
 No more output streams to write to, finishing.
 size=     939kB time=00:00:05.00 bitrate=1536.0kbits/s
 video:0kB audio:939kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.008114%
 Input file #0 (1.webm):
   Input stream #0:0 (audio): 251 packets read (57217 bytes); 251 frames
 decoded (240312 samples);
   Total: 251 packets (57217 bytes) demuxed
 Output file #0 (asd.wav):
   Output stream #0:0 (audio): 251 frames encoded (240312 samples); 251
 packets muxed (961248 bytes);
   Total: 251 packets (961248 bytes) muxed
 251 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7fbfa2f00000] Statistics: 4 seeks, 254 writeouts
 [AVIOContext @ 0x7fbfa2c357c0] Statistics: 59467 bytes read, 0 seeks
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4692>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list