ffmpeg live stream transcoding

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

ffmpeg live stream transcoding

radiocm
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> I want to transcode this stream on ffmpeg server that is on certain machine
> and to stream it on other server
> that is using as Wowza as streaming server.
>
> Now i have several questions:
>
> how to cache as stream that is comming from codec  rtp://239.0.12.2:5000
> transcode it with ffmpeg  and pass it to Wowza.

I'm unaware of ffmpeg having its own transcoding buffer by
default...though the rtbufsize might mean something here.
regardless, this may be of some use to you:
http://ffmpeg.org/trac/ffmpeg/wiki/StreamingGuide
And yes, I have heard of people successfully streaming to wowza using ffmpeg.
-r
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

Dan M
In reply to this post by radiocm
I can't address the caching issue, but I recently completed a project
where I had VLC encoding a stream and sending to to ffmpeg over UDP,
then ffmpeg transcoded the stream and pushed it on to Wowza.

If you do "ffplay rtp://239.0.12.2:5000 " does it play the input stream?

On 07/23/2012 05:38 AM, radiocm wrote:

> Hello every one,
> I'm interested in transcoding a multicast stream that is coming from codesc.
>
> Stream format is: mp4 video and MPEG1 audo.
>
> I want to transcode this stream on ffmpeg server that is on certain machine
> and to stream it on other server
> that is using as Wowza as streaming server.
>
> Now i have several questions:
>
> how to cache as stream that is comming from codec  rtp://239.0.12.2:5000
> transcode it with ffmpeg  and pass it to Wowza.
>
> I will highly appreciate if someone could provide some how tutorials,
> because I am totally new on this area, and I'm getting lost at the moment.
>
>
>
>
> --
> View this message in context: http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-live-stream-transcoding-tp4652003.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
In reply to this post by rogerdpack2
I will be very glad if someone would have an opportunity to offer such a tutorial. Because the tutorial from Wowza website keep me unclear. Thank you for your receptivity.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

Dan M
On 07/25/2012 06:31 AM, radiocm wrote:

> I will be very glad if someone would have an opportunity to offer such a
> tutorial. Because the tutorial from Wowza website keep me unclear. Thank you
> for your receptivity.
>
>
>
> -----
> Best regards, Vadim.
> --
> View this message in context: http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-live-stream-transcoding-tp4652003p4652047.html
> Sent from the FFmpeg-users mailing list archive at Nabble.com.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user

I can't really offer a tutorial, but I can show you how I did something
similar recently.

In my application, I have a server running vlc sucking streams from some
cameras, encoding them as MPEG2 streams and sending them to ports 5000
through 5003 on my intermediary server (I'll have to let someone else
explain how to set that up, as that was someone else's part of the
project). I have another server running Wowza, with an instance named
"live". And I've got an intermediate server that sucks in MPEG2 streams
coming in on ports 5000 to 5003, transcoding them into mp4 streams with
H.264 and AAC codecs, and pushing the transcoded streams on to Wowza.

The command line I use to pull the stream from port 5000, transcode it,
and push it is:
ffmpeg -i 'udp://localhost:5000?fifo_size=1000000&overrun_nonfatal=1'
-crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac
2 -b:a 96k -vcodec libx264 -r 25 -b:v 500k -f flv 'rtmp://<wowza server
IP>/live/cam0'

-i 'udp://localhost:5000?fifo_size=1000000&overrun_nonfatal=1' tells
ffmpeg where to pull the input stream from. The parts after the ? are
probably not needed most of the time, but I did need it after all.

-crf 30 sets the Content Rate Factor. That's an x264 argument that tries
to keep reasonably consistent video quality. A value of 30 allows
somewhat lower quality and bit rate.

-preset ultrafast as the name implies provides for the fastest possible
encoding. If some tradeoff between quality and encode speed, go for the
speed. This might be needed if you are going to be transcoding multiple
streams on one machine.

-acodec aac  sets the audio codec

-strict experimental  allows use of some experimental codecs

-ar 44100 set the audio sample rate

-ac 2 specifies two channels of audio

-b:a 96k sets the audio bit rate

-vcodec libx264 sets the video codec

-r 25 set the frame rate

-b:v 500k set the video bit rate

-f flv says to deliver the output stream in an flv wrapper

'rtmp://<wowza server IP>/live/cam0' is where the transcoded video
stream gets pushed to
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> I have one question left, how i can introduce some loging , so that is
> something is getting wrong i could inspect the logs and try to understand
> what is happening.

-loglevel debug
I guess
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
In reply to this post by Dan M
Can some one say what misstake I'm doing in the following code?

ffmpeg -i rtp://239.0.12.1:5000 -b 500 -r 50 -s 1024*512 -acodec aac -vcodec h264 udp://10.10.1.56:1000
ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 13 2012 14:14:09 with gcc 4.4.5
  configuration: --enable-libdc1394 --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libfreetype --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
the error log is the following
    Last message repeated 1 times
[h264 @ 0x1e5d4a0] number of reference frames (0+4) exceeds max (3; probably corrupt input), discarding one
[h264 @ 0x1e5d4a0] illegal short term buffer state detected
[h264 @ 0x1e5d4a0] mmco: unref short failure
[h264 @ 0x1e5d4a0] reference picture missing during reorder
[h264 @ 0x1e5d4a0] Missing reference picture
[h264 @ 0x1e5d4a0] mmco: unref short failure
frame=  307 fps= 16 q=31.0 size=    1473kB time=00:00:05.63 bitrate=2142.6kbits/s dup=181 drop=0    Last message repeated 2 times
[mpeg4 @ 0x1e5cde0] rc buffer underflow
    Last message repeated 9 times
[h264 @ 0x1e5d4a0] Reference 2 >= 2
[h264 @ 0x1e5d4a0] error while decoding MB 35 17, bytestream (4145)
[mpeg4 @ 0x1e5cde0] rc buffer underflow
frame= 1287 fps= 33 q=31.0 size=    1514kB time=00:00:05.78 bitrate=2145.1kbits/s dup=1158 drop=    Last message repeated 969 times
[h264 @ 0x1e5d4a0] Reference 3 >= 2
[h264 @ 0x1e5d4a0] error while decoding MB 13 10, bytestream (1042)
RTP: PT=21: bad cseq d1b6 expected=4066
[h264 @ 0x1e5d4a0] mmco: unref short failure
[mpeg4 @ 0x1e5cde0] rc buffer underflow
    Last message repeated 1 times
[mp2 @ 0x1e5de80] Header missing
Error while decoding stream #0.1
Error while decoding stream #0.1s
Error while decoding stream #0.1s
    Last message repeated 2 times
[h264 @ 0x1e5d4a0] reference picture missing during reorder
[h264 @ 0x1e5d4a0] Missing reference picture
[h264 @ 0x1e5d4a0] mmco: unref short failure
[h264 @ 0x1e5d4a0] reference picture missing during reorder
[h264 @ 0x1e5d4a0] Missing reference picture
frame= 1289 fps= 32 q=31.0 size=    1610kB time=00:00:06.16 bitrate=2139.0kbits/s dup=1159 drop=[h264 @ 0x1e5d4a0] mmco: unref short failure
[mpeg4 @ 0x1e5cde0] rc buffer underflow
frame= 2313 fps= 38 q=31.0 size=    1628kB time=00:00:06.29 bitrate=2119.6kbits/s dup=2182 drop=    Last message repeated 1023 times
RTP: PT=21: bad cseq 7236 expected=d6ba
[mpeg4 @ 0x1e5cde0] rc buffer underflow
frame= 3366 fps= 40 q=31.0 size=    1651kB time=00:00:06.40 bitrate=2113.6kbits/s dup=3234 drop=    Last message repeated 1054 times
RTP: PT=21: bad cseq 1c9f expected=72cc
[mpeg4 @ 0x1e5cde0] rc buffer underflow
    Last message repeated 1 times
[h264 @ 0x1e5d4a0] reference picture missing during reorder
[h264 @ 0x1e5d4a0] Missing reference picture
[h264 @ 0x1e5d4a0] Reference 2 >= 2
[h264 @ 0x1e5d4a0] error while decoding MB 9 8, bytestream (627)
[mpeg4 @ 0x1e5cde0] rc buffer underflow
frame= 4512 fps= 42 q=31.0 size=    1671kB time=00:00:06.42 bitrate=2132.4kbits/s dup=4377 drop=    Last message repeated 1141 times
[h264 @ 0x1e5d4a0] cabac decode of qscale diff failed at 13 31
[h264 @ 0x1e5d4a0] error while decoding MB 13 31, bytestream (2517)
[h264 @ 0x1e5d4a0] mmco: unref short failure
[mp2 @ 0x1e5de80] Header missing
Error while decoding stream #0.1
Error while decoding stream #0.1s
    Last message repeated 1 times
RTP: PT=21: bad cseq d17d expected=1e39
[h264 @ 0x1e5d4a0] reference picture missing during reorder
    Last message repeated 1 times
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
please can anyone help me.

i have the following command for ffmpeg:
ffmpeg -re -f h264 -pix_fmt yuv420p -i rtp://239.0.12.1:5000 -loglevel debug  -r 40 -profile baseline -acodec copy -vcodec copy -vsync 0 -copyts  -f h264 udp://10.0.254.47:1001

ffmpeg is running on the debian server , x64.

when i'm trying to get the output stream , i get nothing.
if i'm looking on the listening ports also nothing.
what is the issue of the given problem ?

the error log is the following:
    Last message repeated 1 times
[h264 @ 0x159bb80] number of reference frames (0+4) exceeds max (3; probably corrupt input), discarding one
[h264 @ 0x159bb80] error while decoding MB 42 3, bytestream (-4)
[h264 @ 0x159bb80] error while decoding MB 27 6, bytestream (-11)
[h264 @ 0x159bb80] error while decoding MB 30 9, bytestream (-3)
[h264 @ 0x159bb80] error while decoding MB 37 8, bytestream (-3)
[h264 @ 0x15982e0] Estimating duration from bitrate, this may be inaccurate

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1) -> 25.00 (50/2)
Input #0, h264, from 'rtp://239.0.12.1:5000':
  Duration: N/A, bitrate: N/A
    Stream #0.0: Video: h264 (High), yuv420p, 720x576 [PAR 12:11 DAR 15:11], 50 fps, 25 tbr, 1200k tbn, 50 tbc
Output #0, h264, to 'udp://10.0.254.47:1001':
  Metadata:
    encoder         : Lavf52.111.0
    Stream #0.0, 0, 1/90000: Video: libx264, yuv420p, 720x576 [PAR 12:11 DAR 15:11], 1/25, q=2-31, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=  926 fps= 50 q=-1.0 size=   45772kB time=00:00:18.56 bitrate=20202.6kbits/s

Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> i have the following command for ffmpeg:
> ffmpeg -re -f h264 -pix_fmt yuv420p -i rtp://239.0.12.1:5000 -loglevel debug
> -r 40 -profile baseline -acodec copy -vcodec copy -vsync 0 -copyts  -f h264
> udp://10.0.254.47:1001
> when i'm trying to get the output stream , i get nothing.
> if i'm looking on the listening ports also nothing.
> what is the issue of the given problem ?
>
> the error log is the following:
>     Last message repeated 1 times
> [h264 @ 0x159bb80] number of reference frames (0+4) exceeds max (3; probably
> corrupt input), discarding one
> [h264 @ 0x159bb80] error while decoding MB 42 3, bytestream (-4)

Does ffplay work with
rtp://239.0.12.1:5000
?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
yep, it is. FFplay can play source stream. VLC also.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> yep, it is. FFplay can play source stream. VLC also.

No error messages?

If so, does anybody know if rtmp input uses the real time buffer? (I'm
just wondering if maybe it's "missing" incoming packets so they're
being dropped...)
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
command:
ffmpeg -deinterlace -y -f mp4 -f mp2 -f rtp -i rtp://239.0.12.1:5000 -bufsize 2480k -b 512000 -r 40 -vf hqdn3d=2:1:2,format=yuv420p -pix_fmt yuv420p -vcodec libx264 -vpre baseline -vpre fast -acodec libfaac -f h264 udp://10.0.254.47:1001


Anyone know what is the reason of the following errors ?

[h264 @ 0x864bc40] reference picture missing during reorder
[h264 @ 0x864bc40] Missing reference picture
[h264 @ 0x864bc40] mmco: unref short failure
[h264 @ 0x864bc40] reference picture missing during reordere= 735.6kbits/s dup=42 drop=0
[h264 @ 0x864bc40] Missing reference picture
[h264 @ 0x864bc40] mmco: unref short failure
    Last message repeated 1 times    164kB time=1.86 bitrate= 723.0kbits/s dup=69 drop=0
[h264 @ 0x864bc40] left block unavailable for requested intra mode at 0 12
[h264 @ 0x864bc40] error while decoding MB 0 12, bytestream (2223)
[mp2 @ 0x86324a0] Header missing     188kB time=2.11 bitrate= 730.5kbits/s dup=77 drop=0
Error while decoding stream #0.0
RTP: PT=21: bad cseq c42f expected=85081kB time=5.08 bitrate= 663.0kbits/s dup=121 drop=0
[h264 @ 0x864bc40] Reference 3 >= 2
[h264 @ 0x864bc40] error while decoding MB 23 27, bytestream (1292)
[h264 @ 0x864bc40] reference picture missing during reorder
[h264 @ 0x864bc40] Missing reference picture
[h264 @ 0x864bc40] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x864bc40] number of reference frames exceeds max (probably corrupt input), discarding one
[h264 @ 0x864bc40] mmco: unref short failureime=5.14 bitrate= 663.5kbits/s dup=472 drop=0
RTP: PT=21: bad cseq 04a1 expected=c56d
[h264 @ 0x864bc40] Reference 2 >= 2
[h264 @ 0x864bc40] error while decoding MB 5 14, bytestream (1918)
[h264 @ 0x864bc40] mmco: unref short failure
[mp2 @ 0x86324a0] Header missing
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> Anyone know what is the reason of the following errors ?
>
> [h264 @ 0x864bc40] reference picture missing during reorder

My guess is starvation on the input (?)
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
This post has NOT been accepted by the mailing list yet.
Today i was trying to send stream to ffmpeg server, just doing a copy of it, unfortunately again gail.

command:
root@streamTest:~# ffmpeg -y -re -map 0:0 -map 0:1 -i rtp://239.0.12.4:5000 -vcodec copy -acodec copy -vframe 1000 -f h264 http://localhost:8090/feed1.ffm

error:
av_interleaved_write_frame(): Connection reset by peeritrate=   0.0kbits/s

Does anyone know any possibility to get it working ?
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
i stuck at the following error :

Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height


here is my configuration :

ffmpeg -re -y \
-loglevel warning  \
-loglevel verbose \
-i rtp://239.0.12.1:5000 \
-bufsize 3000k \
-an \
-filter:v yadif \
-vbsf h264_mp4toannexb \
-maxrate 3000k \
-r 32 \
-b:v 512 \
-s 240x320 \
-vcodec libx264 \
-vsync 2 \
-preset fast \
-preset baseline \
-f h264 -f rtp rtp://10.0.254.47:5000

I was also trying to play with all the parameters specified in error , taking in consideration that in x264 they should be divided by 16 , i was switching rate parameter from 16 to 50 and so on , nothing doesn't change.
Also i was trying to configure different versions of ffmpeg, but still getting such a type of errors.
Best regards, Vadim.
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

rogerdpack2
> Error while opening encoder for output stream #0:0 - maybe incorrect
> parameters such as bit_rate, rate, width or height

What's your full command line and console output?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg live stream transcoding

radiocm
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Best regards, Vadim.
12