FPS too high when saving video in mp4 container

前端 未结 1 620
名媛妹妹
名媛妹妹 2021-01-02 20:38

When I decode frames from avi file and then decode them in x264 and save to mp4 file, the fps of the output file is always 12,800. Therefore the file is played very fast. Bu

相关标签:
1条回答
  • 2021-01-02 21:39

    The problem was with PTS and DTS of the packet. Before writing the packet to output( before av_interleaved_write_frame command) set PTS and DTS like this

    if (encodedPacket.pts != AV_NOPTS_VALUE)
        encodedPacket.pts =  av_rescale_q(encodedPacket.pts, outStream->codec->time_base, outStream->time_base);
    if (encodedPacket.dts != AV_NOPTS_VALUE)
        encodedPacket.dts = av_rescale_q(encodedPacket.dts, outStream->codec->time_base, outStream->time_base);
    
    0 讨论(0)
提交回复
热议问题