diff --git a/README.md b/README.md index ff2b36a..99f1040 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,47 @@ I don't know if the ffmpeg code is immature, or if I just don't understand ffmpeg, but this codec demands some special treatment, which this shell script provides. + +# Special Treatment + +Here are the quirks I've identified +(February 2023): + +* The codec will not write into a `.mkv` container, + but it will write into a `.mp4` or `.nut` container. +* The codec does not play well with subrip subtitles, + making it look like you don't have enough capture buffers. + You will never have enough capture buffers: + you have to stop trying to copy over subtitles. + +The solution this script uses is to +transcode video and audio +into an intermediate `.nut` file. +Then it combines the `.nut` file, +and any subtitles from the original file, +into a new `.mkv` file. +Since the "copy" video codec is used in the second step, +everything works properly. + +# Thanks + +Thank you to Will Usher, +who figured out how to get the codec working at all. +Without Will's +[helpful blog post](https://www.willusher.io/general/2020/11/15/hw-accel-encoding-rpi4) +I would still be fighting with ffmpeg trying to make it use hardware acceleration. +Will also wrote the +[FBED](https://github.com/Twinklebear/fbed) batch transcoder, +very similar to this. +You might try it out if you don't like this script. + +I created this simpler shell script mainly +to avoid Python package dependencies: +FBED needed an ffmpeg library that I had to patch +before it would run. +I wound up having to fiddle with ffmpeg so much +dealing with the codec quirks, +that working in Bourne shell +made things much simpler +as I chased down the subtitle problems. + diff --git a/h264 b/h264 index 5e129e3..74a1cb4 100755 --- a/h264 +++ b/h264 @@ -120,11 +120,9 @@ for fn in "$@"; do -i "$intermediate" \ -i "$fn" \ -map 0:v \ - -c:v copy \ -map 0:a \ - -c:a copy \ -map 1:s? \ - -c:s copy \ + -c copy \ -y \ "$out"