<div dir="ltr"><div>Hi,</div><div><br></div><div>In our project we use janus-gateway (<a href="http://janus.conf.meetecho.com/" target="_blank">http://janus.conf.meetecho.com/</a>) 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.</div><div><br></div><div>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.</div><div><br></div><div>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 <a href="https://github.com/meetecho/janus-gateway/blob/pprec-opus-libav/postprocessing/pp-opus.c" target="_blank">https://github.com/meetecho/janus-gateway/blob/pprec-opus-libav/postprocessing/pp-opus.c</a> starting from 90 line.</div><div><br></div><div>Returned data is a lil bit smaller than data obtained using libogg:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">-rw-r--r-- 1 mateusz mateusz  17987445 lip  8 11:58 rec-2215547545-audio-nolibogg.opus<br>-rw-r--r-- 1 mateusz mateusz 221841174 lip  8 11:56 rec-2215547545-video.webm<br>-rw-r--r-- 1 mateusz mateusz  18074102 lip  8 11:52 rec-2215547545-audio-libogg.opus</blockquote><div><br></div><div>Unfortunately, returned data is somehow corrupted - ffprobe results for libav processing output:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">[ogg @ 0x4336540] Codec not found<br>rec-2215547545-audio-nolibogg.opus: End of file</blockquote><div><br></div><div>and for compare, for libogg version:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Input #0, ogg, from 'rec-2215547545-audio-libogg.opus':<br>  Duration: 01:20:32.98, start: 0.000000, bitrate: 29 kb/s<br>    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp</blockquote><div><br></div><div>Moreover, no player can play this file - VLC just does nothing, and Rythmbox says "Can't play file: {null}".</div><div><br></div><div><br></div><div>Is this because of improper use of libav api, or maybe it is some libav bug? How could we possibly overcome this problems?</div><div><br></div><div>For more details you can read our whole conversation with janus author here:</div><div><a href="https://groups.google.com/forum/#!topic/meetecho-janus/lMCtBm7VbMY" target="_blank">https://groups.google.com/forum/#!topic/meetecho-janus/lMCtBm7VbMY</a></div><div><br></div><div><br></div><div>Regards,</div><div><br></div><div>Mateusz Koślacz</div></div>