[FFmpeg-user] Frame rate doubled when using video copy codec (m2ts->mp4)

Paul Atkins pdatkins at btinternet.com
Sun Jan 8 13:24:26 EET 2017


Hi,

 

I have an m2ts container with a H.246 video stream (interlaced 1080/50i
fields, 25 full fps) and a AC3 audio stream. This was originally recorded on
a Panasonic HD camcorder, and the edited in Sony Vegas, and encoded on
output using Sony AVC codec. 

I simply want to repackage this to mp4 leading video unchanged and
transcoding audio to AAC.

 

This is the command I'm using:

ffmpeg -i input.m2ts -c:v copy -c:a aac output.mp4

 

This works and produces a video which plays OK but there are some very odd
things with the frame rate, and other aspects that make it very hard to
believe the video has just been copied into the new container unchanged.

.         MediaInfo (and ffprobe) both report the output has a frame rate of
50fps (they also report the input has 25fps)

.         In an NLE (Sony Vegas) the output shows double the number of
frames (at same point in movie the frame number is double). Stepping through
frame by frame I can see these extra frames in the timeline of the output
compared to the input file.

.         Media info reports differing size between input and output video
stream and a different bit rate (and so does ffprobe)! Input: 661MiB &
14.8Mbs; Output: 705MiB & 15.8Mbps. Both report same length 6m15s. 

.         661Mib/6m15s = 14.8Mbps & 705Mib/6m15s = 15.8Mbps - so both are
"self-consistent" set of data - but why different between input and output
file?

.         The input file is 768MB and the output is 728MB, but the
(re-encoded) audio stream only differs by ~3MB (according to MediaInfo)

 

Despite this the movie plays at correct rate! I'm sure it's not re-encoding
the video as its quick (e.g. video stream is processed at roughly 15x
realtime), but it is doing something odd to change frame rate, and size
bit/rates as well.

 

Please can anyone explain what is going on - and how I can get ffmpeg to
make a truly unchanged copy of my video stream from the m2ts into the mp4
container?

 

Console output below, followed by ffprobe of input and output, and following
this MediaInfo properties of input and output

 

Thanks for any help!

 

============================================================================
=================

 

ffmpeg -i input.m2ts -c:v copy -c:a aac output.mp4

ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers

  built with gcc 5.4.0 (GCC)

  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --ena

ble-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -

-enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-am

rnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libsnappy --enab

le-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis -

-enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lib

zimg --enable-lzma --enable-decklink --enable-zlib

  libavutil      55. 34.100 / 55. 34.100

  libavcodec     57. 64.101 / 57. 64.101

  libavformat    57. 56.100 / 57. 56.100

  libavdevice    57.  1.100 / 57.  1.100

  libavfilter     6. 65.100 /  6. 65.100

  libswscale      4.  2.100 /  4.  2.100

  libswresample   2.  3.100 /  2.  3.100

  libpostproc    54.  1.100 / 54.  1.100

Input #0, mpegts, from 'input.m2ts':

  Duration: 00:06:15.30, start: 0.941611, bitrate: 16767 kb/s

  Program 1

    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top
first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 9

0k tbn, 50 tbc

    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo,
fltp, 192 kb/s

Output #0, mp4, to 'output.mp4':

  Metadata:

    encoder         : Lavf57.56.100

    Stream #0:0: Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(top
first), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 50 t

br, 90k tbn, 90k tbc

    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo,
fltp, 128 kb/s

    Metadata:

      encoder         : Lavc57.64.101 aac

Stream mapping:

  Stream #0:0 -> #0:0 (copy)

  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))

Press [q] to stop, [?] for help

frame=18764 fps=501 q=-1.0 Lsize=  728688kB time=00:06:15.27
bitrate=15906.8kbits/s speed=  10x

video:722507kB audio:5917kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.036225%

[aac @ 000000000050cf20] Qavg: 787.823

 

============================================================================
=================

 

ffprobe input.m2ts

ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers

  built with gcc 5.4.0 (GCC)

  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --ena

ble-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -

-enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-am

rnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libsnappy --enab

le-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis -

-enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lib

zimg --enable-lzma --enable-decklink --enable-zlib

  libavutil      55. 34.100 / 55. 34.100

  libavcodec     57. 64.101 / 57. 64.101

  libavformat    57. 56.100 / 57. 56.100

  libavdevice    57.  1.100 / 57.  1.100

  libavfilter     6. 65.100 /  6. 65.100

  libswscale      4.  2.100 /  4.  2.100

  libswresample   2.  3.100 /  2.  3.100

  libpostproc    54.  1.100 / 54.  1.100

Input #0, mpegts, from 'input.m2ts':

  Duration: 00:06:15.30, start: 0.941611, bitrate: 16767 kb/s

  Program 1

    Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top
first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 9

0k tbn, 50 tbc

    Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo,
fltp, 192 kb/s

 

============================================================================
=================

 

ffprobe output.mp4

ffprobe version 3.2.2 Copyright (c) 2007-2016 the FFmpeg developers

  built with gcc 5.4.0 (GCC)

  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --ena

ble-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -

-enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-am

rnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libsnappy --enab

le-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis -

-enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-lib

zimg --enable-lzma --enable-decklink --enable-zlib

  libavutil      55. 34.100 / 55. 34.100

  libavcodec     57. 64.101 / 57. 64.101

  libavformat    57. 56.100 / 57. 56.100

  libavdevice    57.  1.100 / 57.  1.100

  libavfilter     6. 65.100 /  6. 65.100

  libswscale      4.  2.100 /  4.  2.100

  libswresample   2.  3.100 /  2.  3.100

  libpostproc    54.  1.100 / 54.  1.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf57.56.100

  Duration: 00:06:15.29, start: 0.000000, bitrate: 15906 kb/s

    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 15769 kb/s, 50 fps, 50 tbr, 90k

tbn, 50 tbc (default)

    Metadata:

      handler_name    : VideoHandler

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 129 kb/s (default)

    Metadata:

      handler_name    : SoundHandler

 

============================================================================
=================

MEDIA INFO - INPUT FILE

===================

General

ID                                       : 0 (0x0)

Complete name                            : C:\Users\Video\Skiing\input.m2ts

Format                                   : BDAV

Format/Info                              : Blu-ray Video

File size                                : 750 MiB

Duration                                 : 6 min 43 s

Overall bit rate mode                    : Variable

Overall bit rate                         : 15.6 Mb/s

Maximum Overall bit rate                 : 18.0 Mb/s

 

Video

ID                                       : 4113 (0x1011)

Menu ID                                  : 1 (0x1)

Format                                   : AVC

Format/Info                              : Advanced Video Codec

Format profile                           : High at L4

Format settings, CABAC                   : Yes

Format settings, ReFrames                : 2 frames

Format settings, GOP                     : M=2, N=14

Codec ID                                 : 27

Duration                                 : 6 min 15 s

Bit rate mode                            : Variable

Bit rate                                 : 14.8 Mb/s

Maximum bit rate                         : 16.0 Mb/s

Width                                    : 1 920 pixels

Height                                   : 1 080 pixels

Display aspect ratio                     : 16:9

Frame rate                               : 25.000 FPS

Color space                              : YUV

Chroma subsampling                       : 4:2:0

Bit depth                                : 8 bits

Scan type                                : Interlaced

Scan type, store method                  : Separated fields

Scan order                               : Top Field First

Bits/(Pixel*Frame)                       : 0.285

Stream size                              : 661 MiB (88%)

 

Audio

ID                                       : 4352 (0x1100)

Menu ID                                  : 1 (0x1)

Format                                   : AC-3

Format/Info                              : Audio Coding 3

Mode extension                           : CM (complete main)

Format settings, Endianness              : Big

Codec ID                                 : 129

Duration                                 : 6 min 15 s

Bit rate mode                            : Constant

Bit rate                                 : 192 kb/s

Channel(s)                               : 2 channels

Channel positions                        : Front: L R

Sampling rate                            : 48.0 kHz

Frame rate                               : 31.250 FPS (1536 spf)

Bit depth                                : 16 bits

Compression mode                         : Lossy

Delay relative to video                  : -40 ms

Stream size                              : 8.59 MiB (1%)

 

============================================================================
=================

MEDIA INFO - OUTOUT FILE

=====================

General

Complete name                            : C:\Users\Video\Skiing\output.mp4

Format                                   : MPEG-4

Format profile                           : Base Media

Codec ID                                 : isom (isom/iso2/avc1/mp41)

File size                                : 712 MiB

Duration                                 : 6 min 15 s

Overall bit rate mode                    : Variable

Overall bit rate                         : 15.9 Mb/s

Writing application                      : Lavf57.56.100

 

Video

ID                                       : 1

Format                                   : AVC

Format/Info                              : Advanced Video Codec

Format profile                           : High at L4

Format settings, CABAC                   : Yes

Format settings, ReFrames                : 2 frames

Format settings, GOP                     : M=2, N=14

Codec ID                                 : avc1

Codec ID/Info                            : Advanced Video Coding

Duration                                 : 6 min 15 s

Bit rate mode                            : Variable

Bit rate                                 : 15.8 Mb/s

Maximum bit rate                         : 16.0 Mb/s

Width                                    : 1 920 pixels

Height                                   : 1 080 pixels

Display aspect ratio                     : 16:9

Frame rate mode                          : Constant

Frame rate                               : 50.000 FPS

Original frame rate                      : 25.000 FPS

Color space                              : YUV

Chroma subsampling                       : 4:2:0

Bit depth                                : 8 bits

Scan type                                : Interlaced

Scan type, store method                  : Separated fields

Scan order                               : Top Field First

Bits/(Pixel*Frame)                       : 0.152

Stream size                              : 705 MiB (99%)

 

Audio

ID                                       : 2

Format                                   : AAC

Format/Info                              : Advanced Audio Codec

Format profile                           : LC

Codec ID                                 : 40

Duration                                 : 6 min 15 s

Duration_LastFrame                       : -11 ms

Bit rate mode                            : Constant

Bit rate                                 : 129 kb/s

Channel(s)                               : 2 channels

Channel positions                        : Front: L R

Sampling rate                            : 48.0 kHz

Frame rate                               : 46.875 FPS (1024 spf)

Compression mode                         : Lossy

Stream size                              : 5.78 MiB (1%)

Default                                  : Yes

Alternate group                          : 1

 

 



More information about the ffmpeg-user mailing list