I have created a new mp4 file by using concat on my mp4s with this:

ffmpeg -protocol_whitelist file,tcp,http,pipe -f concat -i - -c copy ${videoName%/}.mp4

I then, want to reduce the file size of the newly created file with:

ffmpeg -i "$file" -s 1280x720 -c:a copy "$videoName"

But I am presented with

hutber@hutber:/mnt/googledrive/Winchmore Hill/1920/Week_14_6-2_W/Clips$ sd
Gtk-Message: 12:18:37.761: GtkDialog mapped without a transient parent. This is discouraged.
/mnt/googledrive/Winchmore Hill/1920/Week_14_6-2_W/Clips/vlc-record-2020-01-25-20h28m06s-S3510003.MP4-.mp4
/mnt/googledrive/Winchmore Hill/1920/Week_14_6-2_W/Clips/01.26.2020/vlc-record-2020-01-25-20h28m06s-S3510003.MP4-_01.26.2020_12.18_SD.mp4
ffmpeg version N-49161-g50e194e6e1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 55.100 /  7. 55.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6844880] st: 1 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x6844880] st: 1 edit list 1 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/googledrive/Winchmore Hill/1920/Week_14_6-2_W/Clips/vlc-record-2020-01-25-20h28m06s-S3510003.MP4-.mp4':
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1
    creation_time   : 2020-01-25T20:28:19.000000Z
    playback_requirements: QuickTime 6.0 or greater
    playback_requirements-eng: QuickTime 6.0 or greater
    encoder         : vlc 3.0.8 stream output
    encoder-eng     : vlc 3.0.8 stream output
  Duration: 00:00:12.60, start: 0.000000, bitrate: 61318 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)
      creation_time   : 2020-01-25T20:28:19.000000Z
      handler_name    : SoundHandler
    Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 61056 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
      creation_time   : 2020-01-25T20:28:19.000000Z
      handler_name    : VideoHandler
/mnt/googledrive/Winchmore Hill/1920/Week_14_6-2_W/Clips/01.26.2020/vlc-record-2020-01-25-20h28m06s-S3510003.MP4-_01.26.2020_12.18_SD.mp4: No such file or directory

Just in case this is helpful at all here is my sh script (i've a JS dev :p)

file=$(zenity --file-selection)
currentDateTime=$(date +'%m.%d.%Y_%H.%M')
currentDate=$(date +'%m.%d.%Y')
safeVideoName="${file/ /_}"

echo $file
echo $videoName
mkdir -p $fullpath
ffmpeg -i "$file" -s 1280x720 -c:a copy "$videoName"

In your script, the parameter substitution for mkdir was not quoted:

mkdir -p $fullpath

should be

mkdir -p "$fullpath"

The "Missing key frame" message shouldn't be a problem.

As you can see from ffmpeg's last line:

...: No such file or directory

This was the problem – because bash splits unquoted parameter substitutions, the mkdir command in your script tried to make two directories, not the one which you intended. The result being that you were telling ffmpeg to output a file in a directory which didn't exist.

As there was a single space – there should now be two directories:

  1. /mnt/googledrive/Winchmore
  2. and in whichever directory the script was executed from – a new directory named Hill

You may wish to remove those.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.