title: How to use ffmpeg to change the h264 properties, yuv, fps, tbr, tbn, and tbc of an mp4 file?
body: <p>Using ffmpeg, I would like to convert a video file such that its video stream changes like so:</p>
  <ul>
  <li>Current video stream: <code>Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2560x1080 [SAR 4:3 DAR 256:81], 60 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)</code></li>
  <li>Target video stream: <code>Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 2560x1080, 272 kb/s, 20 fps, 20 tbr, 10240 tbn, 40 tbc (default)</code></li>
  </ul>
  <p>(values that differ: h264 properties, yuv, fps, tbr, tbn, and tbc)</p>
  <p>... and its audio stream changes like so:</p>
  <ul>
  <li>Current audio stream: <code>Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)</code></li>
  <li>Target audio stream: <code>Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)</code></li>
  </ul>
  <p>(values that differ: aac properties)</p>
  <p>How can I do this?</p>
  <hr />
  <h3>Detailed version</h3>
  <p>I would like to be able to concatenate, without re-encoding, <code>main.mp4</code>, followed by <code>outro.mp4</code>, using the following commands:</p>
  <pre class="lang-sh prettyprint-override"><code>echo &quot;file 'main.mp4'&quot; &gt; concat.txt
  echo &quot;file 'outro.mp4'&quot; &gt;&gt; concat.txt
  ffmpeg \
    -f concat \
    -safe 0 \
    -i concat.txt \
    -c copy \
    concat.mp4
  </code></pre>
  <p>What results is a file which plays till the end of <code>main.mp4</code>, and then the video freezes, and I hear the audio of <code>outro.mp4</code>. The same video frame then stays on, with no sound, for an extra ~30 minutes (end time shown in VLC).</p>
  <p>My assumption is that these files are incompatible with each other in some way that prevents them from being concatenated using <code>-codec copy</code> (without re-encoding).</p>
  <p>Here is the <code>ffprobe</code> output for <code>main.mp4</code>:</p>
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'main.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.45.100
    Duration: 01:13:00.65, start: 0.000000, bitrate: 348 kb/s
      Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 2560x1080, 272 kb/s, 20 fps, 20 tbr, 10240 tbn, 40 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 69 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  </code></pre>
  <p>Here is the <code>ffprobe</code> output for <code>outro.mp4</code>:</p>
  <pre><code>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'outro.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf58.45.100
    Duration: 00:00:04.12, start: 0.000000, bitrate: 254 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 2560x1080 [SAR 4:3 DAR 256:81], 60 kb/s, 15 fps, 15 tbr, 15360 tbn, 30 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
      Metadata:
        handler_name    : Stereo
  </code></pre>
  <p>How can I convert <code>outro.mp4</code>, such that I may concatenate the files without re-encoding?</p>
  <p>Note that I am OK with re-encoding the <code>outro.mp4</code> on its own,
  I simply want to avoid re-encoding during the concatenation step,
  and avoid re-encoding <code>main.mp4</code>.</p>
  <hr />
  <h3>ffmpeg build</h3>
  <pre><code>$ ffmpeg -version
  ffmpeg version 4.3-2~18.04.york0 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version='2~18.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
  </code></pre>