Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#6163 closed defect (invalid)

concat demuxer produces invalid output with frame-held mp4

Reported by: John Hawkinson Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: john.hawkinson@gmail.com, john.hawkinson.fwd@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: concat demuxer produces invalid output with frame-held mp4

If I "frame hold" the first frame of an mp4 by extracting it to a png and then looping it with -loop 1 -pix_fmt +yuv420p, and then combine with the original mp4, I get an mp4 that does not play in VLC. The held frame plays for the duration of the hold, and then VLC hangs.

Furthermore, doing so with a 3.933 second frame hold and a 1 second video gives nonsensical output per ffprobe: an 11.63 second mp4.

Note that short1.mp4 is attached to another ticket so I will not duplicate it here: https://trac.ffmpeg.org/attachment/ticket/6162/short1.mp4

How to reproduce:

# First, extract the still:
pb3:test jhawk$  ffmpeg -i short1.mp4 -frames:v 1 -f image2 f1.png
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'short1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.66.102
  Duration: 00:00:01.10, start: 0.000000, bitrate: 8698 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 8572 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, image2, to 'f1.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.66.102
    Stream #0:0(eng): Video: png, rgb24, 1280x720, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.80.101 png
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=0.289x    
video:708kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

# Next, loop it for 3.933 seconds:
pb3:test jhawk$ ffmpeg -y -loop 1 -i f1.png -t 3.933 -pix_fmt +yuv420p h1.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, png_pipe, from 'f1.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
The filters 'Parsed_null_0' and 'format' do not have a common format and automatic conversion is disabled.
Error opening filters!

# Apparently that doesn't work? So use -c copy and get the Lavf encoder
$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt +yuv420p -c copy h1.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, png_pipe, from 'f1.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'h1.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'h1.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0: Video: png (m[0][0][0] / 0x006D), rgb24(pc), 1280x720, q=2-31, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   99 fps=0.0 q=-1.0 Lsize=   70106kB time=00:00:03.92 bitrate=146504.3kbits/s speed=22.4x    
video:70105kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.001645%

# Now merge them:
$ echo -e 'ffconcat version 1.0\n\nfile h1.mp4\nfile short1.mp4\n' > concat2
$ ffmpeg -f concat -i concat2 -c copy concat2.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, concat, from 'concat2':
  Duration: N/A, start: 0.000000, bitrate: 145025 kb/s
    Stream #0:0(und): Video: png (mp4v / 0x7634706D), rgb24(pc), 1280x720, 145025 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
    Metadata:
      handler_name    : VideoHandler
Output #0, mp4, to 'concat2.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0(und): Video: png (m[0][0][0] / 0x006D), rgb24(pc), 1280x720, q=2-31, 145025 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa5a2003000] Auto-inserting h264_mp4toannexb bitstream filter
[concat @ 0x7fa5a1800000] New audio stream 0:1 at pos:216156 and DTS:3.96s
frame=  132 fps=0.0 q=-1.0 Lsize=   71259kB time=00:00:11.54 bitrate=50545.2kbits/s speed=51.8x    
video:71257kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003258%

Reversing the order of concatenation gives a parallel failure. VLC shows the video and stops, does not show the still after it:

$ echo -e 'ffconcat version 1.0\n\nfile short1.mp4\nfile h1.mp4\n' > concat3
$ ffmpeg -f concat -i concat3 -c copy concat3.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f8721018000] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concat3':
  Duration: N/A, start: 0.000000, bitrate: 8699 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 8572 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
    Metadata:
      handler_name    : SoundHandler
Output #0, mp4, to 'concat3.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0(eng): Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(tv, bt709), 1280x720, q=2-31, 8572 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 127 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[concat @ 0x7f872100da00] DTS 14106 < 29029 out of order
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29029, current: 14106; changing to 29030. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29030, current: 14618; changing to 29031. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29031, current: 15130; changing to 29032. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29032, current: 15642; changing to 29033. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29033, current: 16154; changing to 29034. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29034, current: 16666; changing to 29035. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29035, current: 17178; changing to 29036. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29036, current: 17690; changing to 29037. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29037, current: 18202; changing to 29038. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29038, current: 18714; changing to 29039. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29039, current: 19226; changing to 29040. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29040, current: 19738; changing to 29041. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29041, current: 20250; changing to 29042. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29042, current: 20762; changing to 29043. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29043, current: 21274; changing to 29044. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29044, current: 21786; changing to 29045. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29045, current: 22298; changing to 29046. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29046, current: 22810; changing to 29047. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29047, current: 23322; changing to 29048. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29048, current: 23834; changing to 29049. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29049, current: 24346; changing to 29050. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29050, current: 24858; changing to 29051. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29051, current: 25370; changing to 29052. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29052, current: 25882; changing to 29053. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29053, current: 26394; changing to 29054. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29054, current: 26906; changing to 29055. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29055, current: 27418; changing to 29056. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29056, current: 27930; changing to 29057. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29057, current: 28442; changing to 29058. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7f8721852e00] Non-monotonous DTS in output stream 0:0; previous: 29058, current: 28954; changing to 29059. This may result in incorrect timestamps in the output file.
frame=  132 fps=0.0 q=-1.0 Lsize=   71276kB time=00:00:02.14 bitrate=272495.7kbits/s speed=8.04x    
video:71257kB audio:16kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.004975%

Note that this also fails the same way without -c copy.

Someone suggested to me that perhaps the problem was frame rates and other incompatibilities between the held frame (h1.mp4) and the video (short1.mp4):

# ffprobe of h1:
  Duration: 00:00:03.96, start: 0.000000, bitrate: 145027 kb/s
    Stream #0:0(und): Video: png (mp4v / 0x7634706D), rgb24(pc), 1280x720, 145025 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)

# ffprobe of short1
  Duration: 00:00:01.10, start: 0.000000, bitrate: 8698 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 8572 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)

But holding the frame differently doesn't seem to help:

$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt +yuv420p -r 29.97  -c:v libx264 h2.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, png_pipe, from 'f1.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'h2.mp4' already exists. Overwrite ? [y/N] y
The filters 'Parsed_null_0' and 'format' do not have a common format and automatic conversion is disabled.
Error opening filters!
$ ls -l h2.mp4
-rw-r--r--  1 jhawk  staff  0 Feb 19 00:41 h2.mp4
$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt +yuv420p -r 29.97  -c copy  h2.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, png_pipe, from 'f1.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'h2.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'h2.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0: Video: png (m[0][0][0] / 0x006D), rgb24(pc), 1280x720, q=2-31, 25 fps, 25 tbr, 11988 tbn, 29.97 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   99 fps=0.0 q=-1.0 Lsize=   70107kB time=00:00:03.92 bitrate=146505.5kbits/s speed=26.8x    
video:70105kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002693%
pb3:test jhawk$ ffprobe h2.mp4
ffprobe version git-2017-02-19-3206ea4 Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'h2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.66.102
  Duration: 00:00:03.96, start: 0.000000, bitrate: 144992 kb/s
    Stream #0:0(und): Video: png (mp4v / 0x7634706D), rgb24(pc), 1280x720, 145023 kb/s, 25 fps, 25 tbr, 11988 tbn, 11988 tbc (default)
    Metadata:
      handler_name    : VideoHandler
$

Note this is still 25fps. I think I had different results with ffmpeg 3.1.5 yesterday (this is now the git HEAD), where the frame rate did change, but the concatenation was still broken. Not 100% sure, but this is probably enough to go on for now.

Change History (11)

comment:1 by John Hawkinson, 8 years ago

Version: unspecifiedgit-master

comment:2 by John Hawkinson, 8 years ago

Cc: john.hawkinson@gmail.com added

comment:3 by John Hawkinson, 8 years ago

Cc: john.hawkinson.fwd@gmail.com added

comment:4 by Cigaes, 8 years ago

The + in front of the pixel formats does not do what you think it does. Remove it in your first command and try again.

With -c copy, if you read your command outputs carefully, you will realize you are trying to concatenate PNG with H264, it can not work.

in reply to:  4 ; comment:5 by John Hawkinson, 8 years ago

Replying to Cigaes:

With -c copy, if you read your command outputs carefully, you will realize you are trying to concatenate PNG with H264, it can not work.

Yeah, I was skeptical, which is why I initially started without it. But it seemed to get further along before failure -- delusional, I guess :)

The + in front of the pixel formats does not do what you think it does. Remove it in your first command and try again.

This does not seem to have helped, see below. It's my recollection (perhaps flawed) that it had been necessary in the past.

Here we go:

pb3:test jhawk$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt yuv420p -r 29.97   h4.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, png_pipe, from 'f1.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x7f966d000c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f966d000c00] profile High, level 3.1
[libx264 @ 0x7f966d000c00] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 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=6 lookahead_threads=1 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=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'h4.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc57.80.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=   85 fps= 84 q=29.0 size=      57kB time=00:00:01.06 bitrate= 435.5kbits/s dup=14 drop=0 speed=1.06x   frame=  117 fps= 65 q=-1.0 Lsize=      64kB time=00:00:03.80 bitrate= 137.6kbits/s dup=19 drop=0 speed=2.12x    
video:62kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.542316%
[libx264 @ 0x7f966d000c00] frame I:1     Avg QP:15.63  size: 53680
[libx264 @ 0x7f966d000c00] frame P:29    Avg QP:15.71  size:   156
[libx264 @ 0x7f966d000c00] frame B:87    Avg QP:32.33  size:    49
[libx264 @ 0x7f966d000c00] consecutive B-frames:  0.9%  0.0%  0.0% 99.1%
[libx264 @ 0x7f966d000c00] mb I  I16..4:  7.5% 65.5% 27.0%
[libx264 @ 0x7f966d000c00] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  1.1%  0.1%  0.0%  0.0%  0.0%    skip:98.8%
[libx264 @ 0x7f966d000c00] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.4%  0.0%  0.0%  direct: 0.0%  skip:99.6%  L0:15.3% L1:84.7% BI: 0.0%
[libx264 @ 0x7f966d000c00] 8x8 transform intra:65.5% inter:98.8%
[libx264 @ 0x7f966d000c00] coded y,uvDC,uvAC intra: 70.9% 47.1% 30.8% inter: 0.0% 0.1% 0.0%
[libx264 @ 0x7f966d000c00] i16 v,h,dc,p: 21% 36%  6% 37%
[libx264 @ 0x7f966d000c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 25% 16%  4%  4%  5%  4%  5%  6%
[libx264 @ 0x7f966d000c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 20%  7%  5%  5%  6%  4%  6%  3%
[libx264 @ 0x7f966d000c00] i8c dc,h,v,p: 61% 15% 20%  4%
[libx264 @ 0x7f966d000c00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f966d000c00] ref P L0: 97.3%  0.0%  2.2%  0.5%
[libx264 @ 0x7f966d000c00] ref B L0: 55.6% 44.4%
[libx264 @ 0x7f966d000c00] ref B L1: 90.5%  9.5%
[libx264 @ 0x7f966d000c00] kb/s:128.06

It certainly produces a much more sane filesize:

pb3:test jhawk$ ls -l h*
-rw-r--r--  1 jhawk  staff  71788556 Feb 19 00:12 h1.mp4
-rw-r--r--  1 jhawk  staff  71789308 Feb 19 00:42 h2.mp4
-rw-r--r--  1 jhawk  staff  71789308 Feb 19 09:11 h3.mp4
-rw-r--r--  1 jhawk  staff     65417 Feb 19 09:12 h4.mp4

But then when I concatenate the 4 second frame hold with the 1 second mp4:

pb3:test jhawk$ echo -e 'ffconcat version 1.0\n\nfile h4.mp4\nfile short1.mp4\n' > concat4
pb3:test jhawk$ ffmpeg -f concat -i concat4 -c copy concat4.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb101801600] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concat4':
  Duration: N/A, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 129 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc
    Metadata:
      handler_name    : VideoHandler
Output #0, mp4, to 'concat4.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0(und): Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=2-31, 129 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 11988 tbc
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb10280d000] Auto-inserting h264_mp4toannexb bitstream filter
[concat @ 0x7fb101800a00] New audio stream 0:1 at pos:216156 and DTS:3.904s
frame=  150 fps=0.0 q=-1.0 Lsize=    1216kB time=00:00:12.19 bitrate= 817.4kbits/s speed= 199x    
video:1214kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.208274%

I get a 12.19 second result, allegedly, which seems wrong.
And playing it with VLC, I get the held still and then VLC hangs playback for a while, and then appears to re-play the still but never plays the motion video (or its audio).

I know that I have gotten similar things to work in the past (April 2016), although using my notes on what worked from that time has not been successful in getting it work now. I don't know if my notes were wrong or other things have changed.

In this application it's really a strong requirement to have -c copy work because the actual videos are many minutes to small hours long, the goal is to be able to turn them around fast. But even without -c copy, the concatenation still fails:

pb3:test jhawk$ ffmpeg -f concat -i concat4  concat4t.mp4
ffmpeg version git-2017-02-19-3206ea4 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fccf0811800] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'concat4':
  Duration: N/A, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 129 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc
    Metadata:
      handler_name    : VideoHandler
[libx264 @ 0x7fccf2010200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7fccf2010200] profile High, level 3.1
[libx264 @ 0x7fccf2010200] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 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=6 lookahead_threads=1 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=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'concat4t.mp4':
  Metadata:
    encoder         : Lavf57.66.102
    Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=-1--1, 29.97 fps, 11988 tbn, 29.97 tbc
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.80.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fccf0811800] Auto-inserting h264_mp4toannexb bitstream filter33x    
[h264 @ 0x7fccf203ba00] top block unavailable for requested intra mode -1
[h264 @ 0x7fccf203ba00] error while decoding MB 0 0, bytestream 119433
[h264 @ 0x7fccf203ba00] concealing 3600 DC, 3600 AC, 3600 MV errors in I frame
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 10
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 18
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 30
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
[concat @ 0x7fccf0808c00] New audio stream 0:1 at pos:216156 and DTS:3.904s
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 16
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
[h264 @ 0x7fccf203ba00] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf203ba00] decode_slice_header error
[h264 @ 0x7fccf203ba00] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 24
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 26
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
[h264 @ 0x7fccf203ba00] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf203ba00] decode_slice_header error
[h264 @ 0x7fccf203ba00] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 26
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x7fccf203ba00] top block unavailable for requested intra mode -1
[h264 @ 0x7fccf203ba00] error while decoding MB 0 0, bytestream 126059
[h264 @ 0x7fccf203ba00] concealing 3600 DC, 3600 AC, 3600 MV errors in I frame
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 26
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 14
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 22
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 10
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf203ba00] illegal modification_of_pic_nums_idc 8
[h264 @ 0x7fccf203ba00] decode_slice_header error
[h264 @ 0x7fccf203ba00] no frame!
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 22
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 12
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 10
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 22
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x7fccf203ba00] illegal modification_of_pic_nums_idc 10
[h264 @ 0x7fccf203ba00] decode_slice_header error
[h264 @ 0x7fccf203ba00] no frame!
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 12
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
    Last message repeated 1 times
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 20
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
[h264 @ 0x7fccf2019800] illegal modification_of_pic_nums_idc 10
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2019800] decode_slice_header error
[h264 @ 0x7fccf2019800] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf2025600] illegal modification_of_pic_nums_idc 6
[h264 @ 0x7fccf2025600] decode_slice_header error
[h264 @ 0x7fccf2025600] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf203ba00] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x7fccf203ba00] error while decoding MB 0 0, bytestream 116021
[h264 @ 0x7fccf203ba00] concealing 3600 DC, 3600 AC, 3600 MV errors in I frame
[h264 @ 0x7fccf1808000] illegal modification_of_pic_nums_idc 26
[h264 @ 0x7fccf1808000] decode_slice_header error
[h264 @ 0x7fccf1808000] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
[h264 @ 0x7fccf181e400] illegal modification_of_pic_nums_idc 16
[h264 @ 0x7fccf181e400] decode_slice_header error
[h264 @ 0x7fccf181e400] no frame!
Error while decoding stream #0:0: Invalid data found when processing input
frame=  333 fps=165 q=29.0 size=     129kB time=00:00:09.34 bitrate= 113.4kbits/s dup=214 drop=0 speed=4.62x  Error while decoding stream #0:0: Invalid data found when processing input
frame=  371 fps=143 q=29.0 size=     131kB time=00:00:10.61 bitrate= 101.4kbits/s dup=251 drop=0 speed=4.09x  frame=  405 fps=131 q=-1.0 Lsize=     141kB time=00:00:13.41 bitrate=  86.3kbits/s dup=285 drop=0 speed=4.33x    
video:136kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.091612%
[libx264 @ 0x7fccf2010200] frame I:2     Avg QP:14.28  size: 56781
[libx264 @ 0x7fccf2010200] frame P:102   Avg QP:17.83  size:    81
[libx264 @ 0x7fccf2010200] frame B:301   Avg QP:32.31  size:    55
[libx264 @ 0x7fccf2010200] consecutive B-frames:  0.7%  0.5%  0.0% 98.8%
[libx264 @ 0x7fccf2010200] mb I  I16..4:  6.6% 67.1% 26.4%
[libx264 @ 0x7fccf2010200] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.4%  0.0%  0.0%  0.0%  0.0%    skip:99.6%
[libx264 @ 0x7fccf2010200] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.5%  0.0%  0.0%  direct: 0.0%  skip:99.5%  L0:37.3% L1:62.7% BI: 0.0%
[libx264 @ 0x7fccf2010200] 8x8 transform intra:67.2% inter:94.1%
[libx264 @ 0x7fccf2010200] coded y,uvDC,uvAC intra: 69.5% 46.9% 30.1% inter: 0.0% 0.1% 0.0%
[libx264 @ 0x7fccf2010200] i16 v,h,dc,p: 21% 31% 11% 36%
[libx264 @ 0x7fccf2010200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 26% 13%  4%  4%  5%  4%  5%  6%
[libx264 @ 0x7fccf2010200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 20%  7%  5%  5%  6%  4%  6%  3%
[libx264 @ 0x7fccf2010200] i8c dc,h,v,p: 61% 15% 20%  4%
[libx264 @ 0x7fccf2010200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fccf2010200] ref P L0: 76.7%  0.1%  8.4% 14.7%
[libx264 @ 0x7fccf2010200] ref B L0: 51.6% 48.1%  0.3%
[libx264 @ 0x7fccf2010200] ref B L1: 98.4%  1.6%
[libx264 @ 0x7fccf2010200] kb/s:81.92

Again, it seems to produce a 13.4 second mp4 (or 13.5 if we go by ffprobe), and this time VLC plays the still for 13 seconds, but does not show the video. Here's the ffprobe of the above:

pb3:test jhawk$ ffprobe concat4t.mp4
ffprobe version git-2017-02-19-3206ea4 Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'concat4t.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.66.102
  Duration: 00:00:13.51, start: 0.000000, bitrate: 85 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 82 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler

Swapping the order of concatenation also does not resolve it -- then I get 1 second of video and VLC stops, with no frame hold.

Thanks!

comment:6 by Carl Eugen Hoyos, 8 years ago

Keywords: concat removed
Resolution: invalid
Status: newclosed

I didn't remember but this is documented in https://ffmpeg.org/ffmpeg-all.html#Advanced-Video-options

If there is another issue, please open a new ticket.

in reply to:  5 ; comment:7 by Cigaes, 8 years ago

The + in front of the pixel formats does not do what you think it does. Remove it in your first command and try again.

This does not seem to have helped, see below. It's my recollection (perhaps flawed) that it had been necessary in the past.


Obviously it helped, since a command that did fail now works.

pb3:test jhawk$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt yuv420p -r 29.97   h4.mp4


Just for the record, -r 29.97 is almost certainly wrong.

But then when I concatenate the 4 second frame hold with the 1 second mp4:

[concat @ 0x7fb101800a00] New audio stream 0:1 at pos:216156 and DTS:3.904s


Quoting the documentation: “All files must have the same streams (same codecs, same time base, etc.).”

Obviously your second file has audio and your first file does not.

Since we never saw the properties of the second file, we can not help further.

I do not believe your problem exhibits a bug in FFmpeg. Since this is what this tracker is about, I strongly suggest that you seek help somewhere more adapted.

in reply to:  6 comment:8 by John Hawkinson, 8 years ago

Replying to cehoyos:

I didn't remember but this is documented in https://ffmpeg.org/ffmpeg-all.html#Advanced-Video-options

If there is another issue, please open a new ticket.

Err, you mean the fact that -pix_fmt +yuv420p produces

The filters 'Parsed_null_0' and 'format' do not have a common format and automatic conversion is disabled.
Error opening filters!

because that page says

. If pix_fmt is prefixed by a +, ffmpeg will exit with an error if the requested pixel format can not be selected, and automatic conversions inside filtergraphs are disabled. If pix_fmt is a single +, ffmpeg selects the same pixel format as the input (or graph output) and automatic conversions are disabled.

?

That wasn't really the point of the defect. I'll open a new ticket since you requested it, but it's going to just be information that's already in this one.

Note that the error message you get from the above ("do not have common format") is not particularly clear that it is related to pixel format selection, and also the "Parsed_null_0" isn't very clear on meaning.

comment:9 by Cigaes, 8 years ago

The behaviour that you describe in this comment about the + is perfectly normal, do not waste your time opening another ticket for it.

in reply to:  7 ; comment:10 by John Hawkinson, 8 years ago

Replying to Cigaes:

Hi. Thanks for your response. I don't want to waste your time. You write:

I do not believe your problem exhibits a bug in FFmpeg. Since this is what this tracker is about, I strongly suggest that you seek help somewhere more adapted.

What's an appropriate forum?

pb3:test jhawk$ ffmpeg -loop 1 -i f1.png -t 3.933 -pix_fmt yuv420p -r 29.97   h4.mp4


Just for the record, -r 29.97 is almost certainly wrong.

Could you clarify why?

Quoting the documentation: “All files must have the same streams (same codecs, same time base, etc.).”
Since we never saw the properties of the second file, we can not help further.

I'm sorry, I thought I had included the ffprobe for short1.mp4 but that was in a different ticket. I did include a link to the file. But I've copied the ffprobe below.

Obviously your second file has audio and your first file does not.

Yes. I was not under the impression that was a problem (again, based on what had worked for me in the past), but I can certainly try to add compatible silence audio to the first file and see if that changes the result, and open a further ticket if it is not successful.

pb3:test jhawk$ ffprobe short1.mp4
ffprobe version git-2017-02-19-3206ea4 Copyright (c) 2007-2017 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-3206ea4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 47.100 / 55. 47.100
  libavcodec     57. 80.101 / 57. 80.101
  libavformat    57. 66.102 / 57. 66.102
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 73.100 /  6. 73.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'short1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.66.102
  Duration: 00:00:01.10, start: 0.000000, bitrate: 8698 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 8572 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
pb3:test jhawk$ 

in reply to:  10 comment:11 by Carl Eugen Hoyos, 8 years ago

Replying to JohnHawkinson:

Replying to Cigaes:

I do not believe your problem exhibits a bug in FFmpeg. Since this is what this tracker is about, I strongly suggest that you seek help somewhere more adapted.

What's an appropriate forum?

The user mailing list, this bug tracker is only for bugs.

Note: See TracTickets for help on using tickets.