【问题标题】:how to add duration to mjpeg or how to make mjpeg faster如何为 mjpeg 添加持续时间或如何使 mjpeg 更快
【发布时间】:2014-10-10 07:20:18
【问题描述】:

我有自己制作的 ip-cam mjpeg,总共有 240 帧

编码源是 ffmpeg.exe -framerate 25 -i c:\%06d.jpg\ -s 1920x1080 -qscale 1 -vcodec mjpeg -r 25 C:\result.mjpg -y

现在我想播放我制作的 mjpeg 播放器的 result.mjpg

my problem
1. i can't get mjpeg's play time or duration time

2. playing is slower then other movie player so i want to sync it and play more faster

下面是ffprobe结果

Input #0, mjpeg, from 'result.mjpg':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg), 1920x1080, 25 tbr, 1200k tbn, 25 tbc

下面是添加的结果-show_frame

[FRAME]
media_type=video
key_frame=1
pkt_pts=720000
pkt_pts_time=0.600000
pkt_dts=720000
pkt_dts_time=0.600000
best_effort_timestamp=720000
best_effort_timestamp_time=0.600000
pkt_duration=48000
pkt_duration_time=0.040000
pkt_pos=4731406
pkt_size=313289
width=1920
height=1080
pix_fmt=yuvj444p
sample_aspect_ratio=333:320
pict_type=I
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]

ffprobe show me there are Duration: N/A, bitrate: N/A

如何设置时长和比特率 我必须设置任何编码选项吗?

当我像下面这样解码 mjpeg 时

我不能只得到 0 的持续时间

AVFormatContext*  pFC;
int               ret;

pFC = avformat_alloc_context();

ret  = avformat_open_input(&pFC, filename, NULL, NULL);
if (ret < 0) {
    // fail .
}

ret  = avformat_find_stream_info(pFC, NULL);
if (ret < 0) {
    // fail
}
printf("duration %ld", pFC->duration);   <----- only 0

【问题讨论】:

    标签: ffmpeg encode duration mjpeg ffprobe


    【解决方案1】:

    我将选项从 SWS_BICUBIC 更改为 SWS_FAST_BILINEAR 它似乎更快,我的问题 2 完成了

    static int sws_flags = SWS_BICUBIC;
    struct SwsContext *img_convert_ctx;
    img_convert_ctx = sws_getContext(   pVCtx->width, 
                                        pVCtx->height,
                                        pVCtx->pix_fmt,
                                        pVCtx->width, 
                                        pVCtx->height,
                                        PixelFormat::PIX_FMT_BGR24,
                                        sws_flags, NULL, NULL, NULL)
    
    
    static int sws_flags = SWS_FAST_BILINEAR;
    struct SwsContext *img_convert_ctx;
    img_convert_ctx = sws_getContext(   pVCtx->width, 
                                        pVCtx->height,
                                        pVCtx->pix_fmt,
                                        pVCtx->width, 
                                        pVCtx->height,
                                        PixelFormat::PIX_FMT_BGR24,
                                        sws_flags, NULL, NULL, NULL);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-27
      • 1970-01-01
      • 1970-01-01
      • 2016-11-06
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多