FFmpeg(C/libav) VPX to mpeg2video stream cannot be reproduce in VLC

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am currently trying to transcode a VPX(VP8/VP9) video to a mpeg2video and stream it over UDP with mpegts.

I have initialized all of the contexts and the streams and as long as I stream it to ffplay it works, if I send the stream to VLC or another player, the receiver only display the first frame and do nothing else. If I do the same thing through the command line it works flawlessly - ffmpeg -re -i video.webm -an -f mpegts udp://127.0.0.1:8080

My output context:

this->output_codec_ctx_->codec_type    = AVMEDIA_TYPE_VIDEO; // Set media type
this->output_codec_ctx_->pix_fmt       = AV_PIX_FMT_YUV420P; // Set stream pixel format
this->output_codec_ctx_->time_base.den = ceil(av_q2d(input_stream->r_frame_rate));     // Add the real video framerate. Eg.: 29.9
this->output_codec_ctx_->time_base.num = 1;                  // Numerator of the framerate. Eg.: num/29.9
this->output_codec_ctx_->width         = input_stream->codecpar->width;  // Video width
this->output_codec_ctx_->height        = input_stream->codecpar->height; // Video height
this->output_codec_ctx_->bit_rate      = 400000; // Video quality
this->output_codec_ctx_->gop_size      = 12;
this->output_codec_ctx_->max_b_frames  = 2;
this->output_codec_ctx_->framerate     = this->input_codec_ctx_->framerate;
this->output_codec_ctx_->sample_aspect_ratio     = this->input_codec_ctx_->sample_aspect_ratio;

My av_dump:

Output #0, mpegts, to 'udp://127.0.0.1:20010':
  Metadata:
    encoder         : Lavf57.72.101
    Stream #0:0: Video: mpeg2video (Main), 1 reference frame, yuv420p, 480x640 (0x0), q=2-31, 400 kb/s, SAR 1:1 DAR 3:4, 24 fps, 24 tbr, 90k tbn

FFMPEG av_dump:

Output #0, mpegts, to 'udp://127.0.0.1:20010':
  Metadata:
    title           : Tears of Steel
    encoder         : Lavf57.72.101
    Stream #0:0: Video: mpeg2video (Main), yuv420p, 480x640 [SAR 1:1 DAR 3:4], q=2-31, 200 kb/s, 24 fps, 90k tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.96.101 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1

Any ideia on what I may be doing wrong?

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.