videoffmpegh.264imovie

ffmpeg concat iMovie Import - Inconsistent Failure


I'm attempting to create two movies using a set of timed screenshots with ffmpeg, using -f concat to specify png screenshots and durations that they should be shown for. I'm pulling mostly from the ffmpeg slideshow tutorial and concat documentation. Quicktime is able to open both of my ffmpeg-generated movies without problem, but despite using identical commands and scripts to create them, iMovie has no problem opening one and never opens the other, no matter how many times I recreate the source screenshots/durations and recreate the video.

I have two screens that are captured from my input and converted to pngs, and I'm trying to generate two movies to import into iMovie and show side by side at the same time. To generate the movies, I'm using the following command:

ffmpeg -f concat -i win1input.txt -vsync vfr -pix_fmt yuv420p win1.mov
ffmpeg -f concat -i win2input.txt -vsync vfr -pix_fmt yuv420p win2.mov

Where win1input.txt and win2input.txt are essentially identical (generated from the same script with different filenames and times):

file 'win1-01.png'
duration 3.07
file 'win1-02.png'
duration 2.55
...

Both movies are generated and can be opened by quicktime without any complaints. However, when I try to import them into iMovie, the first movie always imports just fine, and the second gives the error "No importable files" and has a 0 duration in the media preview window.

Can anyone suggest ways to look at the movies and try to find what could be throwing iMovie? Without a more detailed error I'm stuck. And I'm totally confused as to what could be the difference between the two, since they are generated from the same process, codec, etc. Any help or suggestions for further info about the movies would be appreciated!

UPDATE with ffmpeg -i output:

$ ffmpeg -i badMovie.mov

ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libass --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-openssl --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'badMovie.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf56.40.101
  Duration: 00:02:09.84, start: 0.000000, bitrate: 36 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x800, 35 kb/s, 0.28 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
      handler_name    : DataHandler
      encoder         : Lavc56.60.100 libx264


$ ffmpeg -i goodMovie.mov
ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --   enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libass --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-opencl --enable-openssl --disable-lzma --enable-nonfree --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'goodMovie.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf56.40.101
  Duration: 00:02:11.84, start: 0.000000, bitrate: 13 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x800, 13 kb/s, 0.64 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
  handler_name    : DataHandler
  encoder         : Lavc56.60.100 libx264

Solution

  • Thanks to @mulvya in the comments, it looks like the bad movie was falling under some required framerate. Resampling the output movie with ffmpeg -i bad_movie.mov -r 5 bad_movie_fixed.mov seemed to fix this.

    (nb I couldn't figure out how to include -r in the initial creation step; the only way I could figure out how to make this work was as a separate re-sample after creating the movie in the first place).