FFMPEG RTSP IP Stream (H.264) convert to RTSP stream (MPEG-2) - ffmpeg

I currently have an IP camera streaming video (RTSP) with H.264 encoding.
I want to use FFmpeg to convert this H.264 encoded stream to another RTSP stream but MPEG-2 encoded. How exactly do I do this? Which commands should I use?

Sure you can do this. You may use ffmpeg to convert your RTSP-stream to MPEG-2 stream. Take a look at this answer it solves your problem https://stackoverflow.com/a/41836896/2000107

Related

Is there a way to store packet header information from an incoming h.264 stream?

The issue: I need to convert an h.264 stream streamed over RTP into MJPEG, but for very convoluted reasons I am required to use the libjpeg-turbo library, not the mjpeg encoder that comes with ffmpeg. So the only thing FFMPEG needs to do is convert the h.264 RTP stream to rawvideo in RGBA and output to a socket where I then manually do the transcoding.
However, libjpeg-turbo only expects complete frames, meaning I need to collect rawvideo packet fragments and somehow synchronize them. Putting incoming raw video fragments into a buffer as they come results in heavily broken images.
Is there some way of saving the header information of the initial h.264 RTP packets? The command I'm currently using is very straightforward:
-i rtsp://: -vcodec rawvideo -f rawvideo udp://:

How to avoid ffmpeg encode Annex-B h264 stream ouput when hardware encoding?

I use wireshark to analysis the h264 ouput of ffmpeg encoding by "h264_qsv",its very strange which contains a lot of PPS,seems like its Annex-B. And Annex-B cannot decode when playing on some machine.
Is there a way to avoid encoding make the h264 stream like Annex-B?
pH264Codec = avcodec_find_encoder_by_name("h264_qsv");
enter image description here
No, hardware encoders always produce annex b, you will need to post process it to convert to another format.

How to get H.264 data from an RTP stream using ffmpeg

I know we can combine videos using ffmpeg, but can I use ffmpeg to extract the H.264 content from a decrypted RTP stream? If so, how?

I cannot use AV_CODEC_ID_MPEG2TS in ffmpeg

I wanna use ffmpeg to convert yuv raw video file into ts stream video file.So I do this in my code:
avcodec_find_encoder(AV_CODEC_ID_MPEG2TS);
But when I run it ,it occurs that:
[NULL # 0x8832020] No codec provided to avcodec_open2()
I change the "AV_CODEC_ID_MPEG2TS" into "AV_CODEC_ID_MPEG2VIDEO", it works well ,and generate a mpg file running well too.So I wanna ask why I cannot use "AV_CODEC_ID_MPEG2TS"?
I'm also looking for streaming a file with ffmpeg so I'm not sure about that but it is what I understand....
Mpeg TS (Transport Stream) is not a codec, it is an encapsulation method, so you have to encode the stream with some code (I'm not sure if you can chose any codec) and then you can encapsulate it with mpeg ts before transmit over the network.
If you don't need to transmit the stream over the network maybe you don't need mpeg ts.
I hope this will helpful....!
Look here: ffmpeg doxygen

Does ffmpeg support encoding of raw video sequence to raw Theora Packets/Elementary bits tream

I have a query regarding using ffmpeg to encode a raw video(yuv sequence) to Raw Theora packets,
i.e. some kind of 'elementary bit-stream' without the Ogg container.
I am able to use ffmpeg to encode a raw video to Ogg theora bit stream, but i need to obtain a Theora bit stream with Raw Theora packets with no Ogg container header/
1) How can i achieve this?
2)If not using ffmpeg, then is there any other way/solution/tool to obtain what i need to get?
Thank you.
-AD.
I tried this out and think it will do what you're looking for; I can tell it's not in an Ogg container but haven't found a good way to play it back.
ffmpeg -i inputfile -vcodec libtheora -f rawvideo outputfile

Resources