开发者

Re-Stream a MPEG2 TS PAL Stream with crtmpserver

开发者 https://www.devze.com 2023-04-10 07:08 出处:网络
I want to build up some kind of stream wrapper: I own an old Dreambox PAL Sat Reciever with Networking. This stream I want to transcode to a lower resultion an restream it.

I want to build up some kind of stream wrapper:

I own an old Dreambox PAL Sat Reciever with Networking. This stream I want to transcode to a lower resultion an restream it.

My Goal is, to have a simple website, where this stream is embedded via rtmp.

I thougt crtmpserver should be the right software. For now I have a site running and can play local fil开发者_运维知识库es through jwplayer/crtmpserver.

I am looking for a solution for this:

httpUrl -> ffmpeg -> crtmpserver

Is that possible? May I redirect the output of ffmpeg to a filed pipe, and crtmpserver could grab that? Or go with UDP?

Any hints appreciated!!! Thanks!!


That's easy:

  1. Start the server (in console mode for debugging) You should see something like this:

    |tcp| 0.0.0.0| 9999| inboundTcpTs| flvplayback|

Basically, that is a tcp acceptor for mpegts streams

  1. Use ffmpeg to create the stream:

    ffmpeg -i < source > < source_related_parameters > < audio_codec_parameters > < video_codec_parameters > -f mpegts "tcp://127.0.0.1:9999"

Example:

ffmpeg -i /tmp/aaa.flv -acodec copy -vcodec copy -vbsf h264_mp4toannexb -f mpegts "tcp://127.0.0.1:9999"
  1. Go back to the server and watch the console. You should see something like this:

    Stream INTS(6) with name ts_13_257_256 registered to application flvplayback from protocol ITS(13)

ts_13_257_256 is the stream name. Now you can use jwplayer or similar player and point it to that stream

If you want to use UDP, you need to stop the server and change the config file so instead of having

protocol="inboundTcpTs"

you should have

protocol="inboundUdpTs"

Yo ucan even copy the entire section and change the port number to have both. Also, you have to change the ffmpeg so instead of having tcp://127.0.0.1:9999 you can have udp://127.0.0.1:9999

Now, if you also want a stream name and not that ts_13_257_256 (which is by the way ts_protocolId_AudioPID_VideoPID) you can use LiveFLV in a similar manner:

ffmpeg -i /tmp/aaa.flv -acodec copy -vcodec copy -vbsf h264_mp4toannexb -f flv -metadata streamName=myStreamName "tcp://127.0.0.1:6666"

And the server should show:

Stream INLFLV(1) with name `myStreamName` registered to application `flvplayback` from protocol ILFL(3)

There you go, now you have a "computed" stream name which is myStreamName

One last observation. Please ask this kind of questions on the crtmpserver's mailing list. You will be better heard. You can find resources here: http://www.rtmpd.com/resources/ Look for the google group under

Cheers, Andrei

0

精彩评论

暂无评论...
验证码 换一张
取 消