Answers.Body: <p>One easy workaround I found while writing this question is simply discarding the broken piece of the input file before trying to concatenate the files, <strong>in a separate command</strong>, since <code>-f concat</code> and <code>-ss 00:03:00</code> don't work together when <em>"h264_mp4toannexb filter failed to receive output packet"</em> is present.</p>
  
  <p>For example, to discard the first 3 minutes of the file, then concatenate separately:</p>
  
  <pre><code>$ ffmpeg -i broken.mov -c copy -ss 00:03:00 fixed.mov
  $ mv broken.mov broken.mov.ignore
  $ ffmpeg -f concat -safe 0 -i &lt;(printf "file '$PWD/%s'\n" ./*.mov) -c copy o.mov
  </code></pre>
  
  <p>I still can't understand why concatenating is the only operation that fails with that error, but the source code linked above might give some hint.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-23T19:26:18.700Z
Answers.LastActivityDate: 2019-01-23T19:38:07.807Z
Answers.LastEditDate: 2019-01-23T19:38:07.807Z
Answers.UserDisplayName: admirabilis
Body: <p>I've always joined my MOV recordings with</p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i &lt;(printf "file '$PWD/%s'\n" ./*.mov) -c copy o.mov
  </code></pre>
  
  <p>however, due to a small glitch in one particular file, I get <strong>h264_mp4toannexb filter failed to receive output packet</strong>. I may discard the part with the glitch, which is around 01m40s into the file. Copying the problematic input file with <code>-c copy</code> works, but using the new output for joining still fails.</p>
  
  <p>Things I tried without success:</p>
  
  <ul>
  <li><code>-fflags discardcorrupt</code></li>
  <li><code>-err_detect ignore_err</code></li>
  <li><code>-ignore_unknown</code></li>
  <li><code>-copy_unknown</code></li>
  <li><code>-ss 00:03:00</code></li>
  </ul>
  
  <p>A Google search for the error above only returns the source code itself for the <code>concat</code> option: <a href="ftp://opensource.tambov.ru/ffmpeg/ffmpeg/libavformat/concatdec.c" rel="nofollow noreferrer">ftp://opensource.tambov.ru/ffmpeg/ffmpeg/libavformat/concatdec.c</a></p>
  
Tags: <ffmpeg>
Title: Joining files fail with "h264_mp4toannexb filter failed to receive output packet"
UserDisplayName: admirabilis
ThreadText: # Joining files fail with "h264_mp4toannexb filter failed to receive output packet"
  
  (Asked by: username_0 on 2019-01-23)
  
  I've always joined my MOV recordings with
  
  ```
  ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" ./*.mov) -c copy o.mov
  
  ```
  
  however, due to a small glitch in one particular file, I get **h264\_mp4toannexb filter failed to receive output packet**. I may discard the part with the glitch, which is around 01m40s into the file. Copying the problematic input file with `-c copy` works, but using the new output for joining still fails.
  
  Things I tried without success:
  
  * `-fflags discardcorrupt`
  * `-err_detect ignore_err`
  * `-ignore_unknown`
  * `-copy_unknown`
  * `-ss 00:03:00`
  
  A Google search for the error above only returns the source code itself for the `concat` option: <ftp://opensource.tambov.ru/ffmpeg/ffmpeg/libavformat/concatdec.c>
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2019-01-23. Score: 2
  
  One easy workaround I found while writing this question is simply discarding the broken piece of the input file before trying to concatenate the files, **in a separate command**, since `-f concat` and `-ss 00:03:00` don't work together when *"h264\_mp4toannexb filter failed to receive output packet"* is present.
  
  For example, to discard the first 3 minutes of the file, then concatenate separately:
  
  ```
  $ ffmpeg -i broken.mov -c copy -ss 00:03:00 fixed.mov
  $ mv broken.mov broken.mov.ignore
  $ ffmpeg -f concat -safe 0 -i <(printf "file '$PWD/%s'\n" ./*.mov) -c copy o.mov
  
  ```
  
  I still can't understand why concatenating is the only operation that fails with that error, but the source code linked above might give some hint.
  
  
  ---
  
  