[Libav-user] mjr to opus audio conversion - corrupted results
Mateusz Koslacz
mateusz.koslacz at 4vod.tv
Fri Jul 10 10:58:09 CEST 2015
Francois, I know the background, thanks. I wasn't expecting correct
behaviour manually changing headers ;)
Paul, maybe it was like that somewhere, but anyway, now I use compiled
version of FFmpeg from git, and this is the setup on which this problems
occur.
Robin, thanks, I know. Like I've said, I use compiled version of FFmpeg, in
my setup there is no avconv command working, ffmpeg command works. I
suppose that I'm on the right list.
Paul once again, let me clarify. Firstly, some background. Janus records
audio and video streams separately, in two .mjr files. Only known me way to
convert this files to more useful format is to use built-in janus
postprocessing tool called janus-pp-rec. It turns video files into .webm
ones and audio files into .opus ones. The problem is that sometimes
converted files have different lengths, and combining them using ffmpeg
results in out-of sync audio and video. Tests involving recording a
stopwatch has shown that videos have correct length, so I assume that it's
something wrong with audio. That's why we have tried to change previous way
of converting .mjr audio to .opus audio from libogg (https://xiph.org/ogg/)
to FFmpeg libraries, what you can check in this file:
https://github.com/meetecho/janus-gateway/blob/pprec-opus-libav/postprocessing/pp-opus.c
starting from 90 line. Probably it would be good to add
avcodec_register_all() function call to the code before testing - I did it,
but it's not yet pushed to git. Unfortunately files generated using FFmpeg
libraries are corrupted - they can't be played, ffprobe and opusinfo claim
that there is something wrong with them - exact output is attached to
previous mail. So my question is - do you have an idea why FFmpeg generated
files are corrupted and what I can possibly do to fix it.
Answering to your question "Does same problem arise with ffmpeg program?" -
I suppose that you ask me what happens when I try to convert .mjr file
using ffmpeg command. I couldn't manage to get it working, ffmpeg just says
"Invalid data found when processing input" when you pass it .mjr file.
Exact steps to reproduce the issue (assuming that you have ffmpeg
installed) - quick way:
1. Install janus from ffmpeg conversion branch, ie:
> cd /dir/where/you/keep/stuff/
> 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" #or pure make install if you prefer
> make configs
2. convert sample janus data:
> cd /opt/janus/share/janus/recordings # it may be in some other dir in your
> system, it's default in mine
> JANUS_PPREC_NOLIBOGG=1
> /dir/where/you/keep/stuff/janus-gateway/janus-pp-rec ./rec-sample-audio.mjr
> ./rec-sample-audio-ffmpeg.opus # using ffmpeg - generated file won't work
> /dir/where/you/keep/stuff/janus-gateway/janus-pp-rec
> ./rec-sample-audio.mjr ./rec-sample-audio-libogg.opus # using libogg -
> generated file will work, but most probably will introduce missync into
> merged media
3. check out that ffmpeg generated audio doesn't work.
Exact steps to reproduce the issue (assuming that you have ffmpeg
installed) generating your own files and seeing that they are out of sync:
1. - like before.
2. run janus and his demos server, ie:
> cd /dir/where/you/keep/stuff/janus-gateway
> screen -dmS "janus-gateway" ./janus
> cd /dir/where/you/keep/stuff//janus-gateway/html
> screen -dmS "janus-web" python -m SimpleHTTPServer 8000
3. record some stuff (you wouldn't get out-of sync media recording locally,
use another host):
> open in your browser http://{janus-host-ip}:8000/recordplaytest.html
> record some media (if you want to see that media lengths differs make it
> >40 min)
> make yourself a tea, whatever
> stop recording
4. convert recorded audio and video
> cd /opt/janus/share/janus/recordings # it may be in some other dir in your
> system, it's default in mine
> JANUS_PPREC_NOLIBOGG=1
> /dir/where/you/keep/stuff/janus-gateway/janus-pp-rec ./{new-audio-filename}
> ./rec-audio-ffmpeg.opus # using ffmpeg - generated file won't work
> /dir/where/you/keep/stuff/janus-gateway/janus-pp-rec
> ./{new-audio-filename./rec-sample-audio-libogg.opus # using libogg -
> generated file will work, but most probably will introduce missync into
> merged media
> /dir/where/you/keep/stuff/janus-gateway/janus-pp-rec
> ./{new-video-filename./rec-sample-video.webm
5. do some ffmpeg manipulation:
> webRTC changes video resolution to fit the stream size in presumed bitrate
> - that makes some players confused - ie VLC crashes - prevent it by
> re-encoding video:
> ffmpeg -i rec-sample-video.webm -c:v libx264 converted.mp4
> merge audio and video:
> ffmpeg -i converted.mp4 -i rec-sample-audio-libogg.opus -c:v copy -c:a aac
> -strict experimental -y shifted2.mp4 # I used libogg audio here to show the
> problem - ffmpeg audio doesn't work at all
6. check that merged data is out-of-sync, see that ffmpeg audio doesn't
work, see that audio and video lengths differ, etc.
Well, that's it.
2015-07-09 17:21 GMT+02:00 Robin Stevens <rdstevens at gmail.com>:
> On Thu, Jul 9, 2015 at 4:05 PM, Talgorn François-Xavier
> <fxtalgorn-at-yahoo.fr at ffmpeg.org> wrote:
>
> ...some very useful stuff...
>
>
>
> The naming situation is confusing.
>
> As I understand it, it goes like this (fingers crossed this table
> formatting doesn't get mangled):
>
> PROJECT COMMANDLINE LIBS RESIDES MAILINGLIST
> FFmpeg ffmpeg(.exe) libav* ffmpeg.org
> ffmpeg-devel, libav-user
> Libav avconv(.exe) libav* libav.org
> libav-devel, libav-api
>
> So you can see there is a lot of overlap between names.
>
> The PROJECT known as FFmpeg came first, the Libav project was forked a
> while ago.
>
> Some Linux distros use FFmpeg, some use Libav.
>
> A quick and dirty test: try to run ffmpeg -i at the command line. If
> it works, you're probably on the right mailing list.
>
> Try to run avconv at the command line. If *that* works, you probably
> need to find a different mailling list.
>
>
>
> Cheers,
> Rob
> _______________________________________________
> 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/20150710/8eeb09a9/attachment.html>
More information about the Libav-user
mailing list