zoukankan      html  css  js  c++  java
  • ffmpeg常用操作

    1. yuv图转为png图

    ffmpeg -s 1920x1080 -i decode_249.yuv decode_249.png
    

    2. 查看yuv格式图

    ffplay -pixel_format yuv420p -video_size 1920x1080 decode_249.yuv
    

    3. 拉取rtsp流并保存为MP4文件

    ffmpeg -rtsp_transport tcp -i rtsp://81.68.73.201/test -y test.mp4
    
    -rtsp_transport tcp表示使用tcp协议拉流,不会丢包
    -y 表示overwrite输出文件
    

    代码打开rtsp流的操作如下:

      const char *src_filename = "rtsp://81.68.73.201/test"     
    
      AVDictionary *avdic = NULL;
      char trans_key[] = "rtsp_transport";
      char trans_value[] = "tcp";
      av_dict_set(&avdic, trans_key, trans_value, 0);
      char delay_key[] = "max_delay";
      char delay_value[] = "5000000";
      av_dict_set(&avdic, delay_key, delay_value, 0);
    
      /* open input file, and allocate format context */
      if (avformat_open_input(&fmt_ctx, src_filename, NULL, &avdic) < 0) {
          fprintf(stderr, "Could not open source file %s
    ", src_filename);
          exit(1);
      }
    

    将MP4全部解码为png图片

    ffmpeg -i test.mp4 camera_%d.png  # %d为连续增长的1、2、3
    
  • 相关阅读:
    解决IE6浏览器下position:fixed固定定位问题
    CSS中overflow:hidden在ie6、ie7无效不能隐藏解决办法
    liunx 中删除export设置的环境变量
    文件操作
    集合操作
    三级菜单
    字典操作
    字符串操作
    购物车程序
    列表操作
  • 原文地址:https://www.cnblogs.com/cristiano-duan/p/14215614.html
Copyright © 2011-2022 走看看