ffmpeg:转换前后的视频长度不一样 [英] ffmpeg: videos before and after conversion aren't the same length

查看:1111
本文介绍了ffmpeg:转换前后的视频长度不一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组.mov视频,需要转换为.mp4格式。我正在使用ffmpeg并运行以下命令:

I have a set of .mov videos which require conversion to .mp4 format. I'm using ffmpeg and running this command:

ffmpeg -i Banking.mov -vsync -async -sameq -ac 1 -ab 64k -ar 44100 Banking.mp4

时间长度的输入和输出视频之间略有不同(00:03:35.407和00:03:35.582)。而这里就是抓住 - 我将时间提示设置在一个文件中,这个文件被程序用来指向特定的场景。 0.1秒的差异导致它指向错误的场景,因此使提示设置无效。是否有可能以不同的格式保存完全相同的时间?

There is a slight difference between input and output video in time length (00:03:35.407 and 00:03:35.582). And here's the catch - I'm storing time cue set at precise times in a file which is used by a program to point at specific scenes. The 0.1 second difference causes it to point at wrong scenes, therefore making the cue set useless. Is there any possibility to preserve exactly the same time in different format?

   FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice BellardMac OSX universal build for ffmpegX
  configuration:  --enable-memalign-hack --enable-mp3lame --enable-gpl --disable-vhook --disable-ffplay --disable-ffserver --enable-a52 --enable-xvid --enable-faac --enable-faad --enable-amr_nb --enable-amr_wb --enable-pthreads --enable-x264 
  libavutil version: 49.0.0
  libavcodec version: 51.9.0
  libavformat version: 50.4.0
  built on Apr 15 2006 04:58:19, gcc: 4.0.1 (Apple Computer, Inc. build 5250)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5597b8]negative ctts, ignoring
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Banking.mov':
  Duration: 00:03:35.6, start: 0.000000, bitrate: 1400 kb/s
  Stream #0.0(eng): Audio: pcm_s16be, 24000 Hz, stereo, 768 kb/s
  Stream #0.1(eng), 29.97 fps(r): Video: h264, yuv420p, 720x480
Output #0, mp4, to 'Banking.mp4':
  Stream #0.0, 29.97 fps(c): Video: mpeg4, yuv420p, 720x480, q=2-31, 200 kb/s
  Stream #0.1: Audio: aac, 44100 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0.1 -> #0.0
  Stream #0.0 -> #0.1
Press [q] to stop encoding
frame= 6461 q=0.0 Lsize=   53181kB time=215.3 bitrate=2023.3kbits/s    
video:51437kB audio:1618kB global headers:0kB muxing overhead 0.237816%


推荐答案

从您的FFmpeg输出判断,输入文件为3:35.6分钟:

Judging from your FFmpeg output, it's seeing the input file as 3:35.6 minutes long:


输入#0 ,mov,mp4,m4a,3gp ,3g2,mj2,来自'Banking.mov':持续时间:00:03:35.6

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Banking.mov': Duration: 00:03:35.6

时间差异似乎是FFmpeg如何看到您的文件,而不是与其代码转换直接相关的任何内容。你如何衡量持续时间得到00:03:35.407?

So the difference in timing appears to be how FFmpeg sees your file, not anything directly relating to its transcoding of it. How are you measuring the duration to get 00:03:35.407?

那就是说,一些意见:


  • 由于您的整体目标只是转换容器格式,所以为什么不能简单地复制视频和音频数据:

  • Since your overall goal is just conversion of the container format, why not simply copy the video and audio data exactly:

ffmpeg -i Banking.mov -codec copy Banking.mp4

根据文档 -vsync -async 每个都有一个参数,所以没有任何可能的isn什么都不帮忙(虽然你的FFmpeg的版本有点老了,但也许这是版本的正确使用;我没有看到任何输出错误。)

According to the documentation, -vsync and -async each take a parameter, so not having any probably isn't helping anything. (Though your version of FFmpeg is somewhat older, so perhaps that is proper usage for that version; I don't see any errors in the output.)

在这个意义上,你有没有理由使用六年制的FFmpeg?您一定会得到更好的支持,并且可能更好的结果与更新的版本。

On that note, is there a reason you're using a six year-old build of FFmpeg? You'll definitely get better support, and likely better results with a more recent version.

这篇关于ffmpeg:转换前后的视频长度不一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆