当前位置: 首页 > news >正文

day11_homework_need2submit

Homework

编写—个将ts或mp4中视频文件解码到yuv的程序
yuv数据可以使用如下命令播放:
ffplay -i output yuv-pix_fmt yuv420p-s 1024x436
要求:

  1. ffmpeg解析到avpacket并打印出pts和dts字段
  2. 完成解码到avframe并打印任意字段
  3. 完成yuv数据保存
// teminal orders on bash
cd examples     
gcc -o demuxing_decoding demuxing_decoding.c $(pkg-config --cflags --libs libavformat libavcodec libavutil libswscale)export PKG_CONFIG_PATH=/home/ubuntu2204/workspace/ffmpeg/build/lib/pkgconfig:$PKG_CONFIG_PATH     
//solve not find head file./demuxing_decoding ubuntu22.04.mp4 a.yuv a.avi /* read frames from the file */// while (av_read_frame(fmt_ctx, pkt) >= 0) {//     // check if the packet belongs to a stream we are interested in, otherwise//     // skip it//     if (pkt->stream_index == video_stream_idx)//         ret = decode_packet(video_dec_ctx, pkt);//     else if (pkt->stream_index == audio_stream_idx)//         ret = decode_packet(audio_dec_ctx, pkt);//     av_packet_unref(pkt);//     if (ret < 0)//         break;// }while (av_read_frame(fmt_ctx, pkt) >= 0) {// 打印PTS和DTS信息if (pkt->stream_index == video_stream_idx || pkt->stream_index == audio_stream_idx) {AVRational *time_base = &fmt_ctx->streams[pkt->stream_index]->time_base;printf("PTS: %s, DTS: %s, duration: %d, stream index: %d\n",av_ts2timestr(pkt->pts, time_base),av_ts2timestr(pkt->dts, time_base),pkt->duration,pkt->stream_index);}

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

http://www.lryc.cn/news/392492.html

相关文章:

  • 昇思MindSpore学习总结九——FCN语义分割
  • js数据库多级分类按树形结构打印
  • centos下编译安装redis最新稳定版
  • 如何让自动化测试更加灵活简洁?
  • linux 下载依赖慢和访问github代码慢
  • 奥比中光astra_pro相机使用记录
  • 【MindSpore学习打卡】应用实践-计算机视觉-深入解析 Vision Transformer(ViT):从原理到实践
  • Debezium系列之:支持在一个数据库connector采集中过滤某些表的删除事件
  • SQL Server端口配置指南:最佳实践与技巧
  • FastGPT 报错:undefined 该令牌无权使用模型:gpt-3.5-turbo (request id: xxx)
  • springboot系列八: springboot静态资源访问,Rest风格请求处理, 接收参数相关注解
  • # 职场生活之道:善于团结
  • go sync包(五) WaitGroup
  • 基于深度学习的相机内参标定
  • 适合金融行业的国产传输软件应该是怎样的?
  • 昇思25天学习打卡营第9天|MindSpore使用静态图加速(基于context的开启方式)
  • class类和style内联样式的绑定
  • 3033.力扣每日一题7/5 Java
  • GPT-5:下一代AI如何彻底改变我们的未来
  • 重载一元运算符
  • 10元 DIY 一个柔性灯丝氛围灯
  • 表单自定义组件 - 可选择卡片SelectCard
  • Ubuntu / Debian安装FTP服务
  • 若依 Vue 前端分离 3.8.8 版中生成的前端代码中关于下拉框只有下拉箭头的问题
  • C++把一个类封装成动态链接库
  • 每天一个项目管理概念之项目章程
  • c++11新特性-4-返回类型后置
  • Linux-C语言实现一个进度条小项目
  • vue使用glide.js实现轮播图(可直接复制使用)
  • TK养号工具开发会用上的源代码科普!