I'm a bit confused about audio extraction with tools like ffmpeg or mkvextract. I did some research but couldn't find much info about this specific topic.
Basically what I am trying to do is extract opus audio from webm container (losslessly of course, without re-encoding). I've tried multiple methods using the tools mentioned above and performed spectrum analysis on all files afterwards.
It seems like the output files have some data lost/changed during the process, which I don't think should be the case. I'm not sure if the results are 100% accurate, though multiple programs confirm it.
How can I be sure that the extraction is successfull and the data matches exactly the original?
Here is some info and images for side-by-side comparison:
Source file: audio.webm
Size: 2.94 MB
Spek:
![Image]()
[Attachment 49874 - Click to enlarge]
Audacity:
![Image]()
[Attachment 49875 - Click to enlarge]
Extracted file using ffmpeg: audio_extracted_ffmpeg.opus
Size: 2.90 MB
Spek:
![Image]()
[Attachment 49876 - Click to enlarge]
Audacity:
![Image]()
[Attachment 49877 - Click to enlarge]
Extracted file using mkvextract: audio_extracted_mkvextract.opus
Size: 2.91 MB
Spek:
![Image]()
[Attachment 49879 - Click to enlarge]
Audacity:
![Image]()
[Attachment 49880 - Click to enlarge]
Comparison between the source webm and the ffmpeg opus in Audacity:
![Image]()
[Attachment 49881 - Click to enlarge]
![Image]()
[Attachment 49882 - Click to enlarge]
This is the output of the ffmpeg extraction:
And the mkvextract:
Basically what I am trying to do is extract opus audio from webm container (losslessly of course, without re-encoding). I've tried multiple methods using the tools mentioned above and performed spectrum analysis on all files afterwards.
It seems like the output files have some data lost/changed during the process, which I don't think should be the case. I'm not sure if the results are 100% accurate, though multiple programs confirm it.
How can I be sure that the extraction is successfull and the data matches exactly the original?
Here is some info and images for side-by-side comparison:
Source file: audio.webm
Size: 2.94 MB
Spek:
[Attachment 49874 - Click to enlarge]
Audacity:
[Attachment 49875 - Click to enlarge]
Extracted file using ffmpeg: audio_extracted_ffmpeg.opus
Size: 2.90 MB
Spek:
[Attachment 49876 - Click to enlarge]
Audacity:
[Attachment 49877 - Click to enlarge]
Extracted file using mkvextract: audio_extracted_mkvextract.opus
Size: 2.91 MB
Spek:
[Attachment 49879 - Click to enlarge]
Audacity:
[Attachment 49880 - Click to enlarge]
Comparison between the source webm and the ffmpeg opus in Audacity:
[Attachment 49881 - Click to enlarge]
[Attachment 49882 - Click to enlarge]
This is the output of the ffmpeg extraction:
Code:
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, matroska,webm, from 'files/audio.webm':
Metadata:
encoder : google/video-file
Duration: 00:03:08.30, start: -0.007000, bitrate: 131 kb/s
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Output #0, opus, to 'files/ffmpeg/audio_extracted_ffmpeg.opus':
Metadata:
encoder : Lavf58.29.100
Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
encoder : Lavf58.29.100
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size= 2975kB time=00:03:08.28 bitrate= 129.5kbits/s speed=6.57e+03x
video:0kB audio:2952kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.803061%
Code:
Extracting track 0 with the CodecID 'A_OPUS' to the file 'files/mkvextract/audio_extracted_mkvextract.opus'. Container format: Ogg (Opus in Ogg)
Progress: 100%