[FFmpeg-user] loosing something when converting from MP4 to TS

Guido Holz guido.holz at googlemail.com
Tue May 20 19:11:39 CEST 2014


Hi,

I try to convert a mp4-file to ts because I would like to concat them after
together. For that I use the TS-Container

I do

    ffmpeg.exe -y  -i test.mp4  -an -vf yadif=1 -r 25  -refs 4 -qmin 4
-codec h264 tmp.mp4
    ffmpeg.exe -y -i tmp.mp4 -vcodec libx264 -preset fast -profile main
-tune film -vf scale=iw/4:ih/4 tmp_mobile.mp4
    ffmpeg -y -i tmp.mp4 -c copy -bsf:v h264_mp4toannexb test.ts
    ffmpeg -y -i tmp_mobile.mp4 -c copy -bsf:v h264_mp4toannexb
test_mobile.ts

but after, the ts-files are shorter than the test.mp4
mobile means a smaler version of the origin-footage

for testing:
https://www.wetransfer.com/downloads/e4935863c2f1e4aa640904ba19c7b30820140520170147/f6f7a92b8de11cc5bc4a1b591a6dc79920140520170147/6b31bb

output of the different origin-file and the 4 steps are:

test.mp4
--------------------------------------------------------------------------------------------
ffmpeg version N-60215-g2a9c507 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Jan 27 2014 22:06:01 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.100 / 55. 49.100
  libavformat    55. 28.100 / 55. 28.100
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2014-05-20 16:55:50
  Duration: 00:00:03.04, start: 0.040000, bitrate: 11952 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv),
1920x1080 [SAR 1:1 DAR 16:9], 11930 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
(default)
    Metadata:
      creation_time   : 2014-05-20 16:55:50
      handler_name    : ?Mainconcept Video Media Handler
At least one output file must be specified

STEP1-------------------------------------------------------------------------------------------------------------------------------
ffmpeg version N-60215-g2a9c507 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Jan 27 2014 22:06:01 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.100 / 55. 49.100
  libavformat    55. 28.100 / 55. 28.100
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2014-05-20 16:55:50
  Duration: 00:00:03.04, start: 0.040000, bitrate: 11952 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv),
1920x1080 [SAR 1:1 DAR 16:9], 11930 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
(default)
    Metadata:
      creation_time   : 2014-05-20 16:55:50
      handler_name    : ?Mainconcept Video Media Handler
[libx264 @ 000000000498e020] using SAR=1/1
[libx264 @ 000000000498e020] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 000000000498e020] profile High, level 4.0
[libx264 @ 000000000498e020] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4
AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html -
options: cabac=1 ref=4 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18
lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=4 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'tmp.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    encoder         : Lavf55.28.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=4--1, 12800 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2014-05-20 16:55:50
      handler_name    : ?Mainconcept Video Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame=   79 fps= 27 q=-1.0 Lsize=    2588kB time=00:00:03.08
bitrate=6882.7kbits/s dup=0 drop=73
video:2586kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.067106%
[libx264 @ 000000000498e020] frame I:1     Avg QP:23.10  size: 64370
[libx264 @ 000000000498e020] frame P:29    Avg QP:23.37  size: 50844
[libx264 @ 000000000498e020] frame B:49    Avg QP:26.46  size: 22622
[libx264 @ 000000000498e020] consecutive B-frames:  1.3% 22.8% 75.9%  0.0%
[libx264 @ 000000000498e020] mb I  I16..4: 18.0% 67.1% 14.9%
[libx264 @ 000000000498e020] mb P  I16..4:  2.6%  8.1%  2.8%  P16..4: 48.1%
13.4%  5.7%  0.0%  0.0%    skip:19.1%
[libx264 @ 000000000498e020] mb B  I16..4:  0.3%  0.6%  0.3%  B16..8:
40.7%  5.3%  1.4%  direct: 5.2%  skip:46.0%  L0:45.7% L1:49.2% BI: 5.1%
[libx264 @ 000000000498e020] 8x8 transform intra:60.1% inter:64.7%
[libx264 @ 000000000498e020] coded y,uvDC,uvAC intra: 68.3% 28.7% 1.7%
inter: 23.0% 9.5% 0.0%
[libx264 @ 000000000498e020] i16 v,h,dc,p:  6% 50% 12% 31%
[libx264 @ 000000000498e020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 36% 17%
3%  5%  3% 13%  2% 10%
[libx264 @ 000000000498e020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8% 42% 13%
3%  6%  2% 16%  2%  8%
[libx264 @ 000000000498e020] i8c dc,h,v,p: 67% 22% 10%  2%
[libx264 @ 000000000498e020] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000000498e020] ref P L0: 59.1% 11.8% 18.2%  6.3%  4.6%
[libx264 @ 000000000498e020] ref B L0: 69.3% 27.4%  3.3%
[libx264 @ 000000000498e020] ref B L1: 85.8% 14.2%
[libx264 @ 000000000498e020] kb/s:6702.12

STEP2----------------------------------------------------------------------------------------------------------------------------
ffmpeg version N-60215-g2a9c507 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Jan 27 2014 22:06:01 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.100 / 55. 49.100
  libavformat    55. 28.100 / 55. 28.100
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tmp.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
  Duration: 00:00:03.16, start: 0.000000, bitrate: 6708 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 6703 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
    Metadata:
      handler_name    : VideoHandler
Please use -profile:a or -profile:v, -profile is ambiguous
[libx264 @ 0000000004b800a0] using SAR=1/1
[libx264 @ 0000000004b800a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0000000004b800a0] profile Main, level 2.1
[libx264 @ 0000000004b800a0] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4
AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html -
options: cabac=1 ref=2 deblock=1:-1:-1 analyse=0x1:0x111 me=hex subme=6
psy=1 psy_rd=1.00:0.15 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-3 threads=18
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'tmp_mobile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021),
yuv420p, 480x270 [SAR 1:1 DAR 16:9], q=-1--1, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame=   79 fps=0.0 q=-1.0 Lsize=     122kB time=00:00:03.08 bitrate=
325.2kbits/s
video:121kB audio:0kB subtitle:0 global headers:0kB muxing overhead
1.413539%
[libx264 @ 0000000004b800a0] frame I:1     Avg QP:24.05  size: 11407
[libx264 @ 0000000004b800a0] frame P:26    Avg QP:23.86  size:  3448
[libx264 @ 0000000004b800a0] frame B:52    Avg QP:28.32  size:   417
[libx264 @ 0000000004b800a0] consecutive B-frames:  2.5%  2.5% 79.7% 15.2%
[libx264 @ 0000000004b800a0] mb I  I16..4: 17.1%  0.0% 82.9%
[libx264 @ 0000000004b800a0] mb P  I16..4:  0.5%  0.0%  1.2%  P16..4: 44.2%
22.1% 11.5%  0.0%  0.0%    skip:20.4%
[libx264 @ 0000000004b800a0] mb B  I16..4:  0.5%  0.0%  0.0%  B16..8:
21.4%  3.6%  0.1%  direct: 4.9%  skip:69.6%  L0:35.2% L1:50.9% BI:13.9%
[libx264 @ 0000000004b800a0] coded y,uvDC,uvAC intra: 82.3% 56.7% 24.3%
inter: 14.2% 7.7% 0.5%
[libx264 @ 0000000004b800a0] i16 v,h,dc,p:  1% 54%  3% 42%
[libx264 @ 0000000004b800a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 39% 13%
4%  7%  3% 16%  2%  9%
[libx264 @ 0000000004b800a0] i8c dc,h,v,p: 59% 32%  7%  3%
[libx264 @ 0000000004b800a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000004b800a0] ref P L0: 68.0% 32.0%
[libx264 @ 0000000004b800a0] ref B L0: 66.8% 33.2%
[libx264 @ 0000000004b800a0] ref B L1: 85.9% 14.1%
[libx264 @ 0000000004b800a0] kb/s:310.68

STEP3----------------------------------------------------------------------------------------------------------------------------
ffmpeg version N-60215-g2a9c507 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Jan 27 2014 22:06:01 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.100 / 55. 49.100
  libavformat    55. 28.100 / 55. 28.100
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tmp.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
  Duration: 00:00:03.16, start: 0.000000, bitrate: 6708 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], 6703 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
    Metadata:
      handler_name    : VideoHandler
Output #0, mpegts, to 'test.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080
[SAR 1:1 DAR 16:9], q=2-31, 6703 kb/s, 25 fps, 90k tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   79 fps=0.0 q=-1.0 Lsize=    2798kB time=00:00:03.08
bitrate=7440.9kbits/s
video:2586kB audio:0kB subtitle:0 global headers:0kB muxing overhead
8.184052%

STEP4----------------------------------------------------------------------------------------------------------------------------
ffmpeg version N-60215-g2a9c507 Copyright (c) 2000-2014 the FFmpeg
developers
  built on Jan 27 2014 22:06:01 with gcc 4.8.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 63.100 / 52. 63.100
  libavcodec     55. 49.100 / 55. 49.100
  libavformat    55. 28.100 / 55. 28.100
  libavdevice    55.  7.100 / 55.  7.100
  libavfilter     4.  1.101 /  4.  1.101
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tmp_mobile.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
  Duration: 00:00:03.16, start: 0.000000, bitrate: 316 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
480x270 [SAR 1:1 DAR 16:9], 312 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc
(default)
    Metadata:
      handler_name    : VideoHandler
Output #0, mpegts, to 'test_mobile.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.28.100
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 480x270
[SAR 1:1 DAR 16:9], q=2-31, 312 kb/s, 25 fps, 90k tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   79 fps=0.0 q=-1.0 Lsize=     141kB time=00:00:03.08 bitrate=
374.0kbits/s
video:121kB audio:0kB subtitle:0 global headers:0kB muxing overhead
16.688815%


More information about the ffmpeg-user mailing list