Re-Stream a Mpeg2 Ts Pal Stream with Crtmpserver

Re-Stream a MPEG2 TS PAL Stream with crtmpserver

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

How to adjust mpeg 2 ts start time with ffmpeg?

I've answered my own question with approach described here.
Timestamp could be adjusted with -initial_offset parameter of -f segment format:

ffmpeg -i in.ts -vcodec copy -acodec copy -f segment -initial_offset 10 -segment_format mpegts out%d.ts

For each new segment I calculate necessary -initial_offset as sum of all previous segments length.



Related Topics



Leave a reply



Submit