Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTSP to RTMP Transcoding failure #162

zpg0624 opened this Issue Mar 26, 2019 · 0 comments


None yet
1 participant
Copy link

zpg0624 commented Mar 26, 2019

public RTMPWriter(int height, int width, double frameRate, String appName) {
container = IContainer.make();
IContainerFormat containerFormat = IContainerFormat.make();
containerFormat.setOutputFormat("flv", url + appName, null);
// set the buffer length xuggle will suggest to ffmpeg for reading inputs
int retVal = + appName, IContainer.Type.WRITE,
if (retVal < 0) {
logger.error("Could not open output container for live stream");
} else {"hava opened server " + url + appName + " for write!");
IStream stream = container.addNewStream(0);
coder = stream.getStreamCoder();
ICodec codec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_H264);
if (codec == null) {
logger.warn("cannot find h264 encoding codec!");
Collection icodec_collections = ICodec.getInstalledCodecs();
Iterator iterator = icodec_collections.iterator();
while (iterator.hasNext()) {
ICodec icodec =;"Your system supports codec:" + icodec.getName());
} else {
if (width == 0 || height == 0) {
logger.error("cannot get the real size of the stream needed to read");
coder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, true);
IRational rationalFrameRate = IRational.make(frameRate);
rationalFrameRate.getNumerator()));;"[ENCODER] address: " + url + appName +
"\n video size is " + width + "x" + height
+ " and framerate is " + frameRate);
if (container.writeHeader() < 0)
throw new RuntimeException("cannot write header");

The error is as follows
15:48:10.958 [Thread-0] WARN com.xuggle.xuggler - Error: no codec set for coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:831)
15:48:10.958 [Thread-0] INFO RTMPWriter - [ENCODER] address: rtmp://localhost:1935/live/
video size is 1000x1000 and framerate is 300.0
15:48:24.920 [Thread-0] WARN com.xuggle.xuggler - Got error: Attempting to encode video with non video coder (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1430)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.