封装层的time_base
ffmpeg code
- TS
mpegts.c中:
avpriv_set_pts_info(st, 33, 1, 90000);
mpegtsenc.c中
avpriv_set_pts_info(st, 33, 1, 90000);
- mp4
mov.c中
avpriv_set_pts_info(st, 64, 1, sc->time_scale);
其出处:
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
...
sc->time_scale = avio_rb32(pb);
if (sc->time_scale <= 0) {
av_log(c->fc, AV_LOG_ERROR, "Invalid mdhd time scale %d, defaulting to 1\n", sc->time_scale);
sc->time_scale = 1;
}
...
}
movenc.c中
avpriv_set_pts_info(st, 64, 1, track->timescale);
- flv
flvdec.c中
avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */
flvenc.c中
avpriv_set_pts_info(s->streams[i], 32, 1, 1000); /* 32 bit pts in ms */
- mkv
matroskadec.c中
avpriv_set_pts_info(st, 64, matroska->time_scale * track->time_scale,
1000 * 1000 * 1000); /* 64 bit pts in ns */
matroskaenc.c
for (i = 0; i < s->nb_streams; i++) {
// ms precision is the de-facto standard timescale for mkv files
avpriv_set_pts_info(s->streams[i], 64, 1, 1000);
}
可见 mux时,ffmpeg的输出 mkv的time_base为{1, 1000}
协议或例子
- TS
TS格式的pts和dts单位是90000。
- flv
flv的时间戳单位为ms。
-
mp4
References:
https://blog.csdn.net/zhuweigangzwg/article/details/64919706
https://www.jianshu.com/p/bf323cee3b8e
https://blog.csdn.net/achang21/article/details/77890961
http://www.samirchen.com/ffmpeg-tutorial-7/
https://blog.csdn.net/TopsLuo/article/details/77981732
https://blog.csdn.net/peckjerry/article/details/48344389