# Using Xuggler/FFmpeg encoding with Wowza

**URL:** <https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726>\
**Category:** Wowza Streaming Engine\
**Created:** [February 3, 2010, 1:26pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726 "2010-02-03T13:26:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [February 3, 2010, 1:26pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/1 "2010-02-03T13:26:54Z")

</div>

Hi folks,

[Xuggler 3.4](http://www.xuggle.com/xuggler/downloads/3.4.final.jsp) now directly supports RTMP URLs. Here’s a [tutorial](http://wiki.xuggle.com/Live_Encoding_Tutorial) on using Xuggler’s ffmpeg version to encode or record from Wowza. This also works with Adobe FMS.

You can also directly use the Xuggler IContainer API to read and write RTMP streams.

- Art

---

<div class="post-metadata">

**Author:** ![mmm\_mmm](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@mmm\_mmm](https://community.wowza.com/u/mmm_mmm)\
**Post date:** [February 18, 2010, 4:33pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/2 "2010-02-18T16:33:32Z")

</div>

Hello,

is Xuggle capable of transcoding the live video and broadcasting it to Wowza?

---

<div class="post-metadata">

**Author:** ![Zoltan\_Fulop](https://avatars.discourse-cdn.com/v4/letter/z/dbc845/32.png) [@Zoltan\_Fulop](https://community.wowza.com/u/Zoltan_Fulop)\
**Post date:** [July 6, 2013, 1:12pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/3 "2013-07-06T13:12:50Z")

</div>

Hi,

I am trying to publish a screencapture video to wowza. I have a code, but it stop at a certain point. It canot process the following line:

int bytesDecoded = videoDecoder.decodeVideo(videoPicture, packet, 0);

If you can help me in this matter please let me know.

When I tried the code (from here: [http://www.brokenmill.com/2010/08/xuggler-rtmp-howto/comment-page-1/#comment-14350](http://www.brokenmill.com/2010/08/xuggler-rtmp-howto/comment-page-1/#comment-14350)) , I get an error on line 34 (real-work part – when a decodeVideo() method is called.)

This is the line that xuggler writes out:

13:24:43.759 [Thread-2] ERROR org.ffmpeg – [mpeg4 @ 045B74A0] header damaged

java.lang.Exception: Cannot decode video picture (pacet size: 43629)

Before that I create the IBuffer from a screenshot. This is what I do:

BufferedImage screen = robot.createScreenCapture(areaToRecord);

BufferedImage image = new BufferedImage(sourceImage.getWidth(), sourceImage.getHeight(), TYPE\_3BYTE\_BGR);

image.getGraphics().drawImage(sourceImage, 0, 0, null);

ByteArrayOutputStream baos = new ByteArrayOutputStream();

ImageIO.write(image, “jpg”, baos);

baos.flush();

byte[] data = baos.toByteArray();

baos.close();

IBuffer iBuffer = IBuffer.make(null, data, 0, data.length);

IPacket packet = IPacket.make(iBuffer);

packet.setTimeStamp(timeStamp);

packet.setKeyPacket(true);

packet.setTimeBase(IRational.make(1,1000));

packet.setTimeStamp(timeStamp);

packet.setDuration(tsInterval);

packet.setPts(lastVideoPts);

packet.setDts(lastVideoPts);

packet.setPosition(lastPos);

lastPos += data.length;

videoFrameCnt++;

int pksz = packet.getSize();

packet.setComplete(true, pksz);

IVideoPicture videoPicture = IVideoPicture.make(IPixelFormat.Type.YUV420P, width, height);

int bytesDecoded = videoDecoder.decodeVideo(videoPicture, packet, 0);

if (bytesDecoded \< 0) {

throw new Exception("Cannot decode video picture (pacet size: " + pksz + “)”);

}

Can you please let me now what I am doing incorrectly? Ultimately I would like to publish this to a wowza server. I tried to take out the decoding and resampling part and just send the packet (created from the IBuffer) to the output stream. The server accepted it, but the file saved on the server was not playable.

Thanks,

Zoltan

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [March 3, 2010, 4:23am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/4 "2010-03-03T04:23:02Z")

</div>

This is very easy. Take a look at the VideoChat example in the **[install-dir]/examples** folder.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [March 3, 2010, 8:46am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/5 "2010-03-03T08:46:49Z")

</div>

Hopefully someone else will jump in. I have no idea.

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [May 25, 2010, 3:23am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/6 "2010-05-25T03:23:20Z")

</div>

I really don’t know. I kind of doubt that FFMPEG has implemented RTMP authentication.

Charlie

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 14, 2010, 12:26pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/7 "2010-04-14T12:26:31Z")

</div>

You could do it like that, or you can do it like this:

netconnection.connect(“rtmp://ip/app”,“username”,“password”);

Take a look at these posts:

[http://community.wowza.com/t/-/111](http://community.wowza.com/t/-/111)

[https://www.wowza.com/forums/showthread.php?t=7812](https://www.wowza.com/forums/showthread.php?t=7812)

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [April 15, 2010, 1:56pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/8 "2010-04-15T13:56:51Z")

</div>

I think you can use another IP. Try:

udp://0.0.0.1:1935

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [May 18, 2010, 12:13pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/9 "2010-05-18T12:13:50Z")

</div>

I’m not sure what you are doing, streaming live converting h.263 to h.264. It is possible to get comparable quality in that conversion with ffmpeg, but it would always be better start with the source.

Maybe Art will respond to this thread as well. I’m not sure about xuggle.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [February 3, 2013, 12:12am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/10 "2013-02-03T00:12:58Z")

</div>

Try SecureURLParams instead

[https://www.wowza.com/docs/how-to-secure-publishing-from-an-rtmp-encoder-that-does-not-support-authentication-modulesecureurlparams](https://www.wowza.com/docs/how-to-secure-publishing-from-an-rtmp-encoder-that-does-not-support-authentication-modulesecureurlparams)

You will put querystring after the application part, before the stream name

Richard

---

<div class="post-metadata">

**Author:** ![Annie\_Akhter](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Annie\_Akhter](https://community.wowza.com/u/Annie_Akhter)\
**Post date:** [May 18, 2010, 3:10am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/11 "2010-05-18T03:10:59Z")

</div>

Hi, I m able to stream live with xuggler and wowza

but the problem is that output stream has poor video quality

I have made few changes in presets files as well but no result

Can anyone help me in improving the quality?

I dont want quality to be improved when converting from h263 to h264 but atleast it should maintain the quality

Can anybody tell me , is it necessary to have degraded quality incase of transcoding from H263 to h264 format?

Thanks

---

<div class="post-metadata">

**Author:** ![Bernd\_Suenkel](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@Bernd\_Suenkel](https://community.wowza.com/u/Bernd_Suenkel)\
**Post date:** [April 3, 2010, 10:07pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/12 "2010-04-03T22:07:01Z")

</div>

> Can you give a hint how to publish a livestream with Xuggler, using the commandline in Linux, to Wowza?
> 
> It is possible to stream a file with Xuggler to Wowza, but i havent found a way to do a livestream with Xuggler. It should be possible, i think 😛

Yes, it is possible to set up a livestream with Xuggle’s ffmpeg build. I strongly recommend reading the [tutorial](http://wiki.xuggle.com/Live_Encoding_Tutorial) @xuggle posted carefully.

To capture and stream a dv source or webcam you could try using dvgrab and pipe its output to ffmpeg. For example:

```auto
dvgrab - | ffmpeg -i - -re [your encoding params] -f flv rtmp://localhost/live/testStream

```

Actually, I haven’t tried this myself. But it should work. Hope that helps.

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [March 3, 2010, 10:18am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/13 "2010-03-03T10:18:27Z")

</div>

Can you give a hint how to publish a livestream from, for example, a webcam to Wowza?

I think Xuggler is the only RTMP streaming encoder that works with Linux

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [March 3, 2010, 4:08pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/14 "2010-03-03T16:08:04Z")

</div>

Okay, i think i wasn`t that clear 😃

What i wanted to ask;

Can you give a hint how to publish a livestream with Xuggler, using the commandline in Linux, to Wowza?

It is possible to stream a file with Xuggler to Wowza, but i havent found a way to do a livestream with Xuggler. It should be possible, i think 😛

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [March 4, 2010, 8:46am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/15 "2010-03-04T08:46:34Z")

</div>

No problem, thanks for thinking with me 🙂

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [April 7, 2010, 1:26pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/16 "2010-04-07T13:26:02Z")

</div>

> Yes, it is possible to set up a livestream with Xuggle’s ffmpeg build. I strongly recommend reading the [tutorial](http://wiki.xuggle.com/Live_Encoding_Tutorial) @xuggle posted carefully.
> 
> To capture and stream a dv source or webcam you could try using dvgrab and pipe its output to ffmpeg. For example:
> 
> ```auto
> dvgrab - | ffmpeg -i - -re [your encoding params] -f flv rtmp://localhost/live/testStream
> 
> ```
> 
> Actually, I haven’t tried this myself. But it should work. Hope that helps.

Thanks for thinking with me, but it doesnt seem to work. I got the error:

“pipe:: Unknown format”

When I hit google with that error, i notice that i`m not the only one with that error lol 😃

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [April 14, 2010, 11:43am UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/17 "2010-04-14T11:43:56Z")

</div>

Allright, i got things going. I can stream with only the use of ffmpeg. I didn`t need dvgrab. I got a new quest;

Is it possible to give the username and password in the RTMP URL?

Something like;

rtmp://ipaddress/something/stream.stream?username=a&password=b

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [April 15, 2010, 1:38pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/18 "2010-04-15T13:38:40Z")

</div>

How about ffmpeg?

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [April 15, 2010, 1:42pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/19 "2010-04-15T13:42:58Z")

</div>

I got a new issue aswell;

I got ffmpeg working, so it can publish a stream to wowza 🙂 But how to publish multiple streams? Let me clarify myself;

I can publish a stream with rtmp://ipaddress/something/something.stream. In something.stream is one line that says: “udp://0.0.0.0:1935”.

But how to publish another stream? When i make someting2.stream with udp://0.0.0.0:1935", i`m getting the error; already in use (doh).

How to solve this issue?

---

<div class="post-metadata">

**Author:** ![M\_de\_G](https://avatars.discourse-cdn.com/v4/letter/m/5daacb/32.png) [@M\_de\_G](https://community.wowza.com/u/M_de_G)\
**Post date:** [April 15, 2010, 3:37pm UTC](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726/20 "2010-04-15T15:37:59Z")

</div>

Hm … an empty stream file does work too 😕

[Next page](https://community.wowza.com/t/using-xuggler-ffmpeg-encoding-with-wowza/726.md?page=2)
