使用ffmpeg,尝试将容器从Mpeg TS更改为MP4,fps成为Mpeg TS的两倍 [英] With ffmpeg, trying to change a container from Mpeg TS to MP4, fps became twice of Mpeg TS

查看:392
本文介绍了使用ffmpeg,尝试将容器从Mpeg TS更改为MP4,fps成为Mpeg TS的两倍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从捕获板上得到了一个Mpeg TS文件,用于制作DEMO视频剪辑.

I got a Mpeg TS file from a capture board to make a DEMO video clip.

这是来自ffmpeg的文件的信息;

Here is information of the file from ffmpeg;

Stream #0:0[0x51]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x61]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s

但是,我无法在FCP X中对其进行编辑,因此我尝试使用以下命令使用ffmpeg仅将其容器TS更改为MP4.

However, I cannot edit it in FCP X, so I tried to change just its container TS to MP4 with ffmpeg using the below command.

ffmpeg -i input.ts -vcodec copy -acodec copy output.mp4

完成后,output.mp4的fps变为59.94 fps,信息如下:

After doing it, fps of output.mp4 became 59.94 fps and information is like below;

Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 1750 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1(und): Audio: mp2 (mp4a / 0x6134706D), 48000 Hz, stereo, s16p, 224 kb/s

Fps不一样.

是否有一种方法可以通过仅复制选项更改容器来保持与TS相同的fps?

Is there a way to keep same fps as TS with just copy option to change a container?

我想知道重新编码是否是解决方案.

I am wondering whether just re-encoding is solution or not.

/////

完整日志;

$ ffmpeg -i input.ts -vcodec copy -acodec copy output.mp4
ffmpeg version 1.1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  6 2013 10:45:57 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
  configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid
  libavutil      52. 13.100 / 52. 13.100
  libavcodec     54. 86.100 / 54. 86.100
  libavformat    54. 59.106 / 54. 59.106
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 32.100 /  3. 32.100
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[mpegts @ 0x7f8a2b033000] max_analyze_duration 5000000 reached at 5003333
Input #0, mpegts, from 'input.ts':
  Duration: 00:05:01.27, start: 0.224400, bitrate: 2727 kb/s
  Program 1 
    Stream #0:0[0x51]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
    Stream #0:1[0x61]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf54.59.106
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 90k tbn, 90k tbc
    Stream #0:1: Audio: mp2 (i[0][0][0] / 0x0069), 48000 Hz, stereo, 224 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x7f8a2b058200] pts has no value
frame=13472 fps=0.0 q=-1.0 size=   54536kB time=00:03:44.80 bitrate=1987.3kbits/frame=18056 fps=0.0 q=-1.0 Lsize=   73024kB time=00:05:01.28 bitrate=1985.5kbits/s    
video:64370kB audio:8212kB subtitle:0 global headers:0kB muxing overhead 0.608498%

推荐答案

您将不得不使用 ffmbc 将视频重新包装为MP4. ffmpeg不会按预期多路复用隔行扫描的H264流-它将每个字段放入不同的访问单元中.请参阅此问题和我在Video Production上的答案.

You will have to use ffmbc to rewrap the video in a MP4. ffmpeg doesn't mux interlaced H264 streams as expected - it places each field into a dfferent access unit. See this question and my answer at Video Production.

这篇关于使用ffmpeg,尝试将容器从Mpeg TS更改为MP4,fps成为Mpeg TS的两倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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