سؤال

I am trying to encode media files to use for HTTP Live Streaming, but don't have much luck so far. When I use the ICodec.ID.CODEC_ID_MPEG2TS or ICodec.ID.CODEC_ID_MPEG4 codes the stream encode but I get an error using Apple's Validation tool:

ERROR: (-12971) MPEG2 parser corrupt stream (program 1, track 257) ERROR: (-12971) failed to parse segment as either an MPEG-2 TS or an ES

If I save them as .mp4 instead of .ts then they play in Quicktime (but not as .ts)

If I use ICodec.ID.CODEC_ID_H264 I get the following error when encoding:

java.lang.RuntimeException: could not open stream com.xuggle.xuggler.IStream@-397916640[index:0;id:1;streamcoder:com.xuggle.xuggler.IStreamCoder@-397916528[codec=com.xuggle.xuggler.ICodec@-397916032[type=CODEC_TYPE_VIDEO;id=CODEC_ID_H264;name=libx264;];time base=1/25;frame rate=0/0;pixel type=YUV420P;width=640;height=360;];framerate:0/0;timebase:1/90000;direction:OUTBOUND;]: Operation not permitted

I have the following settings for the encoder:

        coderSettings.width = 640;
        coderSettings.height = 360;
        coderSettings.bitRate = 700000;
        coderSettings.codec = ICodec.ID.CODEC_ID_H264;
        coderSettings.globalQuality = 75;
        coderSettings.sampleRate = 22050;

I am just wondering if I do something wrong. I don't know that much of video encoding, so might just have forgotten a simple option when trying to encode to H264.

هل كانت مفيدة؟

المحلول

The problem is fixed with the new version of Xuggler 5.5. However, it seems that it used the mpeg2ts encoder even when specifying the H264 encoder (on basis of the extension). This gives problems with QT and iOS devices.

With using FFMPEG directly it might works somewhat better as there is more control.

نصائح أخرى

Is xuggler a requirement? If not, it's possible to prepare assets using ffmpeg (the base of xuggler), for example with these instructions.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top