Error decoding audio, possibly due to timestamp

522 views
Skip to first unread message

Mads

unread,
May 11, 2012, 9:30:21 PM5/11/12
to xuggle...@googlegroups.com
I just started using Xuggler today, and I'm very pleased with it.
In my hunt for creating video and audio files on the fly, I've had to seperate the two becuase I could not get it to work. If anyone knows how to add audio input on the fly from a TargetDataLine, on a IMediaWriter, please be welcome.

What I am doing for now though, is to record video and audio seperately, and then concatenate the two afterwards. However, when I do this with long videos/audio, I get an error:

Audio: 196616202
Audio: 196642325
Audio: 196668447
Audio: 196694570
Audio: 196720692
Audio: 196746815
Exception in thread "main" java.lang.RuntimeException: error -1094995529 decoding audio
at com.xuggle.mediatool.MediaReader.decodeAudio(MediaReader.java:549)
at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:469)
at com.javadaemon.schoolxuggle.test.ConcatenateAudioAndVideo.concatenate(ConcatenateAudioAndVideo.java:164)
at com.javadaemon.schoolxuggle.test.ConcatenateAudioAndVideo.main(ConcatenateAudioAndVideo.java:87)

In Audio: x, x represents the timestamp from the IAudioSamples.
I am using the code from the tutorial at http://wiki.xuggle.com/Concatenating_Two_Files

I fear the error comes from the timestamp being too big, and eventually just overloading going into the negative bits, which in turn causes an error. Is there any way to fix this?

Dave Peterson

unread,
Jul 11, 2012, 11:12:42 AM7/11/12
to xuggle...@googlegroups.com
I see the same issue on a sporadic basis across all my streams.  I suspect that the problem is somewhat related in that Xuggler does not support FMT_FLT (float) audio input (at least according to the comments in their code).  They only seem to support FMT_S16.

This is rather unfortunate because this forces one to do an unnecessary audio re-sampling because the sample-formats do not match when you have float input (I do) and the only option is a S16 output and this integer rollover problem (seems like a bug).
if (oc.getChannels() != ic.getChannels()
                || oc.getSampleRate() != ic.getSampleRate()
                || oc.getSampleFormat() != ic.getSampleFormat()) {



Dave Peterson

unread,
Jul 18, 2012, 8:21:11 AM7/18/12
to xuggle...@googlegroups.com
i've tried a gazillion ways to get around this timestamp bug but nothing seems to work.  Let me know if you find anything that is a successful workaround.


Tiago Jacobs - iMDT

unread,
Jul 18, 2012, 11:43:44 PM7/18/12
to xuggle...@googlegroups.com, Dave Peterson
By your log, the error is when DECODING the audio, it means it's not a problem with timestamp you set on your packet, but the packet that was read from input file.

The demo stops on error, you could change it to ignore errors. To do it you can replace (in ConcatenateAudioAndVideo.java):
while (reader1.readPacket() == null);
while (reader2.readPacket() == null);
To:
while(true) {
    try {
        IError error = reader1.readPacket()
        if(error != null) {
            System.err.println("Error decoding packet " + error.getDescription());

            if(!reader1.isOpen()) break;
        }
    } catch(Exception e) {
       
System.err.println("Error decoding packet " + e.getMessage());
        if(!reader1.isOpen()) break;
    }
}


while(true) {
    try {
        IError error = reader2.readPacket()
        if(error != null) {
            System.err.println("Error decoding packet " + error.getDescription());

            if(!reader2.isOpen()) break;
        }
    } catch(Exception e) {
        System.err.println("Error decoding packet " + e.getMessage());
        if(!reader2.isOpen()) break;
    }
}







Em 18/07/2012 09:21, Dave Peterson escreveu:
i've tried a gazillion ways to get around this timestamp bug but nothing seems to work.  Let me know if you find anything that is a successful workaround.


--
You received this message because you are subscribed to the Google Groups "xuggler-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/xuggler-users/-/rr-K1doXCpIJ.
To post to this group, send email to xuggle...@googlegroups.com.
To unsubscribe from this group, send email to xuggler-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/xuggler-users?hl=en.

Reply all
Reply to author
Forward
0 new messages