0

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"?

socket
  • 1,153
  • 3
  • 13
  • 22
  • http://stackoverflow.com/questions/20259929/picture-size-0x10-is-invalid-video-codec-is-not-opened-what-should-be-the-reas.. can u please help me on this question? – BhavikKama Nov 28 '13 at 09:40

1 Answers1

-1

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

Secort
  • 43
  • 5
  • Well, I did it finally~ I wrote it in my blog [link]http://blog.csdn.net/littlethunder/article/details/9164929 – socket Jul 08 '13 at 14:45