[FFmpeg-user] how to decode raw opus file

Dave Horton daveh at beachdognet.com
Fri Sep 15 17:51:00 EEST 2017


I’m having trouble decoding a file containing only raw opus audio data.  My latest attempt was this:

 ./ffmpeg -loglevel debug -y -acodec libopus -ac 1 -i callee.raw -b:a 128k -ar 48000 -f mp3 callee.mp3

this however gives me

[libopus @ 0x5871380] Decoding error: corrupted stream
Error while decoding stream #0:0: Invalid data found when processing input

Is my command above wrong?

The data itself I _think_ is ok, because it is audio packets that I have stripped out of a pcap file, and the same program I use to strip it and create the raw audio input file works fine on all of the other codecs that I have tested.  I am only having an issue with opus for some reason.

Hoping someone can point me in the right direction…

My build details and the verbose output of the above command below..

dhorton at rtpengine:~$ ./ffmpeg -loglevel debug -y -acodec libopus -ac 1 -i callee.raw -b:a 128k -ar 48000 -f mp3 callee.mp3
ffmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libopus'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Reading option '-i' ... matched as input url with argument 'callee.raw'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '48000'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mp3'.
Reading option 'callee.mp3' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url callee.raw.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument libopus.
Applying option ac (set number of audio channels) with argument 1.
Successfully parsed a group of options.
Opening an input file: callee.raw.
[NULL @ 0x586eec0] Opening 'callee.raw' for reading
[file @ 0x586f720] Setting default whitelist 'file,crypto'
[image2 @ 0x586eec0] Format image2 detected only with low score of 5, misdetection possible!
[image2 @ 0x586eec0] Before avformat_find_stream_info() pos: 0 bytes read:27778 seeks:0 nb_streams:1
[image2 @ 0x586eec0] After avformat_find_stream_info() pos: 27778 bytes read:27778 seeks:0 frames:1
Input #0, image2, from 'callee.raw':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 5555 kb/s
    Stream #0:0, 1, 1/25: Audio: opus, 48000 Hz, stereo, s16
Successfully opened the file.
Parsing a group of options: output url callee.mp3.
Applying option b:a (video bitrate (please use -b:v)) with argument 128k.
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option f (force format) with argument mp3.
Successfully parsed a group of options.
Opening an output file: callee.mp3.
[file @ 0x5875020] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (opus (libopus) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[libopus @ 0x5871380] Decoding error: corrupted stream
Error while decoding stream #0:0: Invalid data found when processing input
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
No more output streams to write to, finishing.
Finishing stream 0:0 without any data written to it.
detected 2 logical cores
[graph_0_in_0_0 @ 0x58763e0] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x58763e0] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x58763e0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0x58763e0] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 0x58763e0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_0 @ 0x5877900] Setting 'sample_fmts' to value 's32p|fltp|s16p'
[format_out_0_0 @ 0x5877900] Setting 'sample_rates' to value '48000'
[format_out_0_0 @ 0x5877900] Setting 'channel_layouts' to value '0x4|0x3'
[format_out_0_0 @ 0x5877900] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0'
[AVFilterGraph @ 0x5874660] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x58879a0] picking s16p out of 3 ref:s16
[auto_resampler_0 @ 0x58879a0] [SWR @ 0x589ae00] Using s16p internally between filters
[auto_resampler_0 @ 0x58879a0] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:s16p r:48000Hz
Output #0, mp3, to 'callee.mp3':
  Metadata:
    TSSE            : Lavf57.71.100
    Stream #0:0, 0, 1/48000: Audio: mp3 (libmp3lame), 48000 Hz, stereo, s16p, delay 1105, 128 kb/s
    Metadata:
      encoder         : Lavc57.89.100 libmp3lame
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (callee.raw):
  Input stream #0:0 (audio): 1 packets read (27778 bytes); 0 frames decoded (0 samples); 
  Total: 1 packets (27778 bytes) demuxed
Output file #0 (callee.mp3):
  Output stream #0:0 (audio): 0 frames encoded (0 samples); 0 packets muxed (0 bytes); 
  Total: 0 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
0 frames successfully decoded, 1 decoding errors
[AVIOContext @ 0x5874560] Statistics: 1 seeks, 2 writeouts
[AVIOContext @ 0x5877ac0] Statistics: 27778 bytes read, 0 seeks
Conversion failed!


More information about the ffmpeg-user mailing list