[Libav-user] mjr to opus audio conversion - corrupted results

Talgorn François-Xavier fxtalgorn at yahoo.fr
Thu Jul 9 17:05:37 CEST 2015


Hi Mateusz,

If you want to understand the background of FFMPEG, and maybe the answer you got, you could throw an eye on this: http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html
FFMPEG / LIBAV teams used to be two communities at war. I don't know what the situation is about now.
Anyway, FFMPEG is built upon libav, this is why libav is installed when you install FFMPEG.

I'm new to FFMPEG dev. The last 3 months I got some help from kind people reading this list. All my questions concerned libav* libs.
So I would say: feel confident to post on this list (at the time I write this, no lightning balls on my smoky head, but I might be doomed from the list very soon :-).

For your tech issues, the general feeling I have is that you problems are not quite enough isolated.
What I learned using FFMPEG is to go on by very small steps and check consistency.
Manually changing headers and expect correct behavior is a true leap of faith ;-)

For the rest, I'm afraid I'm not skilled enough to give you relevant advice on Ogg encoding.

Good luck, I'm sure you'll manage to make it run smoothly. Some nice guys around here will come up with help for sure.

fx.








Le 9 juil. 2015 à 15:51, Mateusz Koslacz <mateusz.koslacz at 4vod.tv> a écrit :

> Thanks Francois. 
> Well, Paul wrote that "From that conversation it is evident you are using Libav and not FFmpeg. And so we can not help you." and "From that conversation it is evident you are using Libav and not FFmpeg. And so we can not help you.". 
> The thing that makes me confused is that I have not installed any Libav resources, but I have installed ffmpeg and janus using this script (which is included in this conversation from which is somehow evident that I am not using FFmpeg but Libav) on a fresh install of ubuntu 14.04.2 :
> 
> #!/bin/bash
> aptitude update
> aptitude -y full-upgrade
> aptitude -y install libmicrohttpd-dev libjansson-dev libnice-dev \
>     libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
>     libopus-dev libogg-dev libini-config-dev libcollection-dev \
>     pkg-config gengetopt libtool automake checkinstall git yasm
>  
> cd
> git clone git://source.ffmpeg.org/ffmpeg
> cd ~/ffmpeg
> ./configure --enable-libopus
> make
> checkinstall -y --pkgversion="1.0.0"
>  
> cd
> git clone https://github.com/meetecho/janus-gateway.git
> cd ~/janus-gateway
> git checkout pprec-opus-libav
> sh autogen.sh
> ./configure --prefix=/opt/janus --enable-post-processing --disable-websockets --disable-data-channels --disable-rabbitmq --disable-docs
> make
> checkinstall -y --pkgversion="1.0.0"
> make configs
> 
> Moreover, sites:
> 
> http://trac.ffmpeg.org/wiki/Using%20libav*
> https://www.ffmpeg.org/libavcodec.html
> https://www.ffmpeg.org/libavformat.html
> 
> claims that FFmpeg developers are authors of FFmpeg included libavcodec and libavformat libraries, and this libraries are part of the FFmpeg.
> Name of this list stands as "libav-user - For questions about using the FFmpeg libraries and API :  This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter."
> 
> To clarify - am I mailing the right list? I thought that I was using FFmpeg API. If not, I could mail Libav mail lists also.
> 
> 
> Concerning your suggestions - I added avcodec_register_all() to the code before, but as it had not changed anything I haven't pushed that changes. Sorry for not informing you about it.
> 
> As you can see in the install script, I compile FFmpeg with libopus enabled, and FFmpeg general documentation (https://www.ffmpeg.org/general.html) declares that ogg support is provided out of the box.
> 
> I'll take a look atav_packet_rescale_ts() function, but before going to that point, I would like to generate working .opus file using FFmpeg libraries.
> 
> I'm wondering if ffmpeg .opus headers are created correctly in this case. After not very elegant operation, which was manually replacing in vim ffmpeg generated header by this generated by libogg, I got pretty different results.
> 
> opusinfo output for file generated using ffmpeg libraries:
> 
> New logical stream (#1, serial: 550f772e): type unknown
> Logical stream 1 ended
> 
> ffprobe output for file generated using ffmpeg libraries:
> 
> [ogg @ 0x3449c40] Codec not found
> audio_nolibogg.opus: End of file
> 
> opusinfo output for file generated using libogg:
> 
> New logical stream (#1, serial: 6b8b4567): type opus
> WARNING: Implausibly low preskip in Opus stream (1)
> Encoded with Janus post-processing
> WARNING: Sample count behind granule (35228160>35301120) in stream 1
> WARNING: Sample count behind granule (35281920>35374080) in stream 1
> [...]
> [~3.5k of warnings]
> [...]
> WARNING: Sample count behind granule (231806400>231929280) in stream 1
> WARNING: Sample count behind granule (231860160>231983040) in stream 1
> WARNING: EOS not set on stream 1 (normal for live streams)
> Opus stream 1:
> 	Pre-skip: 0
> 	Playback gain: 0 dB
> 	Channels: 2
> 	Original sample rate: 48000Hz
> 	Packet duration:   20.0ms (max),   20.0ms (avg),   20.0ms (min)
> 	Page duration:   1180.0ms (max), 1127.0ms (avg), 1000.0ms (min)
> 	Total data length: 18074102 bytes (overhead: 1.98%)
> 	Playback length: 80m:32.979s
> 	Average bitrate: 29.92 kb/s, w/o overhead: 29.33 kb/s
> 
> ffprobe output for file generated using libogg:
> 
> Input #0, ogg, from 'rec-2215547545-audio-libogg.opus':
>   Duration: 01:20:32.98, start: 0.000000, bitrate: 29 kb/s
>     Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
> 
> 
> opusinfo output for file generated using ffmpeg libraries, but with header manually force-replaced with libogg header:
> 
> WARNING: Hole in data (50 bytes) found at approximate offset 9000 bytes. Corrupted Ogg.
> WARNING: Hole in data (31 bytes) found at approximate offset 9000 bytes. Corrupted Ogg.
> [...]
> [~100 lines of warnings]
> [...]
> WARNING: Hole in data (608 bytes) found at approximate offset 22500 bytes. Corrupted Ogg.
> WARNING: Invalid header page, no packet found
> WARNING: Invalid header page in stream 1, contains multiple packets
> New logical stream (#1, serial: dabc9752): type invalid
> WARNING: stream start flag not set on stream 1
> Logical stream 1 ended
> 
> ffprobe output for file generated using ffmpeg libraries, but with header manually force-replaced with libogg header:
> 
> rec-2215547545-audio-nolibogg.opus: Invalid data found when processing input
>  
> 
> Despite replacing headers file is still not playable. (what is not really surprising) 
> 
> 
> Best regards,
> 
> Mateusz 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 2015-07-08 21:46 GMT+02:00 Talgorn François-Xavier <fxtalgorn-at-yahoo.fr at ffmpeg.org>:
> I agree with you Mateusz, FFMPEG makes use of libav. If I remember well, it is built on libav + proper extensions.
> It is true that FFMPEG does everything that libav does, and more, but that would be sectarian to say that this mailing list can not help you.
> Technically, we can.
> 
> 
> 
> 
> Le 8 juil. 2015 à 21:17, Mateusz Koslacz <mateusz.koslacz at 4vod.tv> a écrit :
> 
>> Well, so why list I'm mailing is called "Libav-user -- This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter.", if you can't help me if I use Libav?
>> 
>> 2015-07-08 19:26 GMT+02:00 Paul B Mahol <onemda at gmail.com>:
>> 
>> Dana 8. 7. 2015. 15:05 osoba "Mateusz Koslacz" <mateusz.koslacz at 4vod.tv> napisala je:
>> 
>> 
>> >
>> > Hi,
>> >
>> > In our project we use janus-gateway (http://janus.conf.meetecho.com/) as a webRTC gateway and also as a stream recorder. We are on the tests stage of our project, and after very long development time we have ecountered a bug that is a blocker for whole project. After real tests of recording streams using janus we realized that audio and video are out of sync in recordings, despite of fact, that live they are perfectly in sync.
>> >
>> > Janus records two *.mjr files for each recording - one for video, and one for audio. Janus also provides own converter to convert this files to *.webm for video and *.opus for audio. After that, we use ffmpeg to merge this files. By recording stopwatch view on the stream we concluded, that video has correct length and speed, so most probably this is something wrong with audio recording or converting.
>> >
>> > Firstly, janus was using libogg for converting *.mjr audio to *.opus. Regarding described issues author decided to switch to libav audio processing. You can check how it's done in this file https://github.com/meetecho/janus-gateway/blob/pprec-opus-libav/postprocessing/pp-opus.c starting from 90 line.
>> >
>> > Returned data is a lil bit smaller than data obtained using libogg:
>> >
>> >> -rw-r--r-- 1 mateusz mateusz  17987445 lip  8 11:58 rec-2215547545-audio-nolibogg.opus
>> >> -rw-r--r-- 1 mateusz mateusz 221841174 lip  8 11:56 rec-2215547545-video.webm
>> >> -rw-r--r-- 1 mateusz mateusz  18074102 lip  8 11:52 rec-2215547545-audio-libogg.opus
>> >
>> >
>> > Unfortunately, returned data is somehow corrupted - ffprobe results for libav processing output:
>> >
>> >> [ogg @ 0x4336540] Codec not found
>> >> rec-2215547545-audio-nolibogg.opus: End of file
>> >
>> >
>> > and for compare, for libogg version:
>> >
>> >> Input #0, ogg, from 'rec-2215547545-audio-libogg.opus':
>> >>   Duration: 01:20:32.98, start: 0.000000, bitrate: 29 kb/s
>> >>     Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
>> >
>> >
>> > Moreover, no player can play this file - VLC just does nothing, and Rythmbox says "Can't play file: {null}".
>> >
>> >
>> > Is this because of improper use of libav api, or maybe it is some libav bug? How could we possibly overcome this problems?
>> >
>> > For more details you can read our whole conversation with janus author here:
>> > https://groups.google.com/forum/#!topic/meetecho-janus/lMCtBm7VbMY
>> >
>> >
>> 
>> From that conversation it is evident you are using Libav and not FFmpeg. And so we can not help you.
>> 
>> > Regards,
>> >
>> > Mateusz Koślacz
>> >
>> > _______________________________________________
>> > Libav-user mailing list
>> > Libav-user at ffmpeg.org
>> > http://ffmpeg.org/mailman/listinfo/libav-user
>> >
>> 
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>> 
>> 
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
> 
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20150709/b9af6279/attachment.html>


More information about the Libav-user mailing list