- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想解复用然后复用 .avi 文件而不更改任何内容。
我的程序是这样的(为简洁而编辑):
AVFormatContext *input_format_context = NULL;
avformat_open_input(
&input_format_context,
input_url,
NULL, // fmt
NULL // options
);
avformat_find_stream_info(input_format_context, NULL);
AVFormatContext *output_format_context = NULL;
avformat_alloc_output_context2(
&output_format_context,
NULL, // oformat
NULL, // format_name
output_url
);
avio_open2(
&output_format_context->pb,
output_url,
AVIO_FLAG_WRITE,
NULL, // int_cb,
NULL // options
);
for (int i = 0; i < input_format_context->nb_streams; i++) {
avformat_new_stream(output_format_context, NULL);
AVStream *input_stream = input_format_context->streams[i];
AVStream *output_stream = output_format_context->streams[i];
AVCodecParameters *params = avcodec_parameters_alloc();
avcodec_parameters_copy(params, input_stream->codecpar);
output_stream->codecpar = params;
}
avformat_write_header(output_format_context, NULL))
AVPacket *input_packet = NULL;
input_packet = av_packet_alloc();
while (!av_read_frame(
input_format_context,
input_packet
)) {
av_write_frame(output_format_context, input_packet);
av_packet_unref(input_packet);
}
av_write_trailer(output_format_context);
问题:
input_packet->pts
)时,它是
-9223372036854775808
.并且还会打印以下警告:
[avi @ 0x562868c6c000] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
那么我该如何“修复我的代码以正确设置时间戳”?
最佳答案
我刚刚找到了解决方案。
我添加了这个:
output_stream->time_base = input_stream->time_base;
然后,据我所知,它允许视频播放器即时计算 PTS。
input_packet->pts = calculated_ts;
我想我也应该能够做到:
output_format_context->oformat->flags |= AVFMT_NOTIMESTAMPS;
但是,我不能这样做:
error: assignment of member ‘flags’ in read-only object
因此,看起来 ffmpeg 即使对于 .avi 也需要 PTS,或者存在错误,或者我仍然做错了什么。
关于c - .avi 文件的无操作重新混合,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72103357/
要将视频 MP4 转换为视频 MP4 anamorphose,我使用: ffmpeg -i input.mp4 -crf 15 -g 1 -intra output.mp4 我在 output.mp4
我有一个 .avi 视频。我需要将其中的一部分剪切为另一个 .avi 文件。当我这样做时,我会丢失剪切文件的质量: ffmpeg -i input.avi -ss 00:34:00 -t 00:10:
我有一个带有 SDK for Visual C++ 的视频采集卡。在 SDK 的回调中,我可以以 30 fps 的速度使用彩色帧 (640 x 480)。目前,我在一个单独的线程中将整个图像序列作为单
我在带有 Codec DV Video (dvds) 的文件夹(在 Windows 7 上)中有一堆 avi 文件。这些是直接从我的索尼 DCR-PC120E Pal 相机和索尼附带的软件复制而来的。
我必须为我正在做的项目录制视频。其中两个是 USB 摄像头,另一个是 IP 顶置摄像头。所有三个都连接到笔记本电脑。录制视频后,我需要能够在编辑器中打开它们(不是特别用于编辑,而是用于建模其中需要时间
有没有办法使用 mmread 或其他函数逐帧读取 .avi 视频文件,类似于使用 videoReader 和 readFrame 函数? 我使用了 mmread 但读取每一帧需要很长时间,因为它读取了
我想解复用然后复用 .avi 文件而不更改任何内容。 我的程序是这样的(为简洁而编辑): AVFormatContext *input_format_context = NULL; a
有一个 IP 网络摄像头,我前段时间写了一个 .NET 类。它基本上是一个 Timer 实现,它每五秒从相机 ping 一个快照 CGI 脚本。相机本身非常简陋。它没有任何类型的 API 供我使用,我
我自己正在学习matlab,我用matlab做了一个动画情节;现在我想把它保存为一个视频文件。你能告诉我如何在matlab中把我的动画转换成一个视频文件吗?下面是我的代码 x=[1:2]; for i
我正在尝试制作一个程序,从网络摄像头捕捉视频并从麦克风捕捉声音,但我卡在了我试图用静止图像制作电影的部分 我听说你需要使用 directshow,但它对我不起作用 有人知道捕获视频和声音并将其编码为文
我想在 PHP 页面上播放视频 (AVI/MPG)。我怎样才能做到这一点?我还想为每个视频生成缩略图。谁能推荐一些工具? 最佳答案 对于缩略图,您需要类似 ffmpeg安装在您的服务器上。 要播放视频
我正在使用 ffmpeg 剪切视频文件: ffmpeg - -ss 00:00:00 -t 00:00:30 不包括 *.avi 格式的不同文件格式是可以的。对于 avi 电影,ffmpeg 显示视
我正在尝试拆分持续时间为 1 小时到 8 分钟的视频 (.avi) 文件。 我正在使用以下命令 ffmpeg -i videos_22_05_18/cnbc.avi -ss 00:00:00 -to
我创建了一个 AVI file通过使用 Cairo 渲染帧。 AVI生成代码为part of an OCaml library .但是,ffmpeg 和 vlc 都只产生第一帧。如果我剪掉 avi 标
我有一台 Fujifilm FinePix Real 3D W3,它创建了 Fujifilm 所谓的 3D-AVI 文件。有一些程序可以将这些 3D-AVI 文件拆分为单独的左右电影,但它们涉及在 W
我正在尝试使用以下命令将 avi 转换为 mp4: ffmpeg -i avi_videos.avi -c copy new.mp4 我收到了一个错误(见下文),我不太明白。我需要添加哪些其他参数才能
背景故事: 我有一个 VB.net 程序(它使用一个更老的 COM 对象访问 DVR)以每 15 秒的长度创建顺序编号的 AVI 文件。每 15 秒创建一个新的 AVI,其中包含最近 15 秒的视频。
你好。 我有一个很大的视频文件。 ffmpeg , tcprobe和其他工具说,它是 AVI 容器中的 h264 流。 现在我想从视频中剪下小块。 问题:视频接缝的索引损坏/损坏。我通过 mplaye
我有一个 .avi 文件,它位于我服务器的一个文件夹中。此文件夹的名称带有重音符号。 问题是,当我将该文件放在标签中时,它会显示一个 txt 文件(我认为是 avi 文件编码),这显然是一个错误。它只
我有一个带有 3 个字幕流的 AVI 文件(mpeg4 视频)。我需要将第二个流提取到 SRT/txt 以便对翻译进行一些更正。我目前在一台 Ubuntu 机器上。 我尝试使用 avconv,但出现错
我是一名优秀的程序员,十分优秀!