[FFmpeg-user] way to reencode corrupted video

Bouke / Videotoolshed bouke at videotoolshed.com
Thu Feb 27 16:05:21 EET 2025


Mea Culpa, this was not intended for the list of course.


Bouke

videotoolshed.com
Van Oldenbarneveltstraat 33
6512 AS Nijmegen, the Netherlands
+31 6 21817248
If you want to send me large files, please use:
https://videotoolshed.wetransfer.com/

> On 27 Feb 2025, at 14:38, Bouke / Videotoolshed <bouke at videotoolshed.com> wrote:
> 
> Hi Glenn,
> Windows version had an update, it now also can save views (you can change the order / width / visibility of columns and save that.)
> 
> 
> 
> 
> Bouke
> 
> videotoolshed.com
> Van Oldenbarneveltstraat 33
> 6512 AS Nijmegen, the Netherlands
> +31 6 21817248
> If you want to send me large files, please use:
> https://videotoolshed.wetransfer.com/
> 
>> On 26 Feb 2025, at 00:10, Richard Bartczak via ffmpeg-user <ffmpeg-user at ffmpeg.org> wrote:
>> 
>> There are fatal errors in the stream.
>> 
>> I did check it with a script (Linux) :
>> 
>> ---
>> 
>> frame=    8 fps=0.0 q=40.0 size=       0kB time=00:00:01.13 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=12.8x
>> frame=   26 fps=0.0 q=49.0 size=       0kB time=00:00:01.83 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=3.07x
>> frame=   69 fps= 62 q=49.0 size=       0kB time=00:00:03.56 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=3.18x
>> frame=  120 fps= 74 q=50.0 size=       0kB time=00:00:05.61 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=3.46x
>> frame=  167 fps= 79 q=49.0 size=       0kB time=00:00:07.48 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=3.52x
>> frame=  209 fps= 79 q=49.0 size=       0kB time=00:00:09.15 bitrate=  
>> 0.0kbits/s dup=21 drop=0 speed=3.46x
>> frame=  260 fps= 83 q=48.0 size=     368kB time=00:00:11.20 bitrate=
>> 269.2kbits/s dup=21 drop=0 speed=3.56x
>> frame=  309 fps= 84 q=49.0 size=     368kB time=00:00:13.16 bitrate=
>> 229.1kbits/s dup=21 drop=0 speed=3.58x
>> frame=  354 fps= 85 q=49.0 size=     368kB time=00:00:14.95 bitrate=
>> 201.6kbits/s dup=21 drop=0 speed=3.58x
>> [h264 @ 0x574eb5937540] cabac decode of qscale diff failed at 59 6
>> [h264 @ 0x574eb5937540] error while decoding MB 59 6, bytestream 77049
>> [h264 @ 0x574eb5937540] concealing 7430 DC, 7430 AC, 7430 MV errors in P
>> frame
>> [NULL @ 0x574eb57c9700] Invalid NAL unit size (60897492 > 110161).
>> [NULL @ 0x574eb57c9700] missing picture in access unit with size 110165
>> [h264 @ 0x574eb594b680] Invalid NAL unit size (60897492 > 110161).
>> [h264 @ 0x574eb594b680] Error splitting the input into NAL units.
>> [NULL @ 0x574eb57c9700] Invalid NAL unit size (-1600997495 > 84591).
>> [NULL @ 0x574eb57c9700] missing picture in access unit with size 84595
>> [NULL @ 0x574eb57c9700] Invalid NAL unit size (1695808648 > 76726).
>> [NULL @ 0x574eb57c9700] missing picture in access unit with size 76730
>> [h264 @ 0x574eb588c480] Invalid NAL unit size (-1600997495 > 84591).
>> [h264 @ 0x574eb588c480] Error splitting the input into NAL units.
>> [h264 @ 0x574eb58a0380] Invalid NAL unit size (1695808648 > 76726).
>> [h264 @ 0x574eb58a0380] Error splitting the input into NAL units.
>> [NULL @ 0x574eb57c9700] Invalid NAL unit size (540206825 > 109538).
>> [NULL @ 0x574eb57c9700] missing picture in access unit with size 109542
>> [h264 @ 0x574eb57e40c0] Invalid NAL unit size (540206825 > 109538).
>> [h264 @ 0x574eb57e40c0] Error splitting the input into NAL units.
>> [NULL @ 0x574eb57c9700] Invalid NAL unit size (1072494654 > 74994).
>> [NULL @ 0x574eb57c9700] missing picture in access unit with size 74998
>> [h264 @ 0x574eb5844d00] Invalid NAL unit size (1072494654 > 74994).
>> [h264 @ 0x574eb5844d00] Error splitting the input into NAL units.
>> [vist#0:0/h264 @ 0x574eb57cfe00] corrupt decoded frame
>> [vist#0:0/h264 @ 0x574eb57cfe00] Error submitting packet to decoder:
>> Invalid data found when processing input
>>    Last message repeated 4 times
>> 
>> frame=  392 fps= 84 q=49.0 size=     368kB time=00:00:16.51 bitrate=
>> 182.6kbits/s dup=26 drop=0 speed=3.53x
>> frame=  436 fps= 84 q=49.0 size=     368kB time=00:00:18.28 bitrate=
>> 164.9kbits/s dup=26 drop=0 speed=3.53x
>> 
>> ---
>> 
>> It leads to the missing audio after this error.
>> 
>> This error must be removed to reencode :
>> 
>> ffmpeg -i "test.mp4" -codec copy -ss 00:00:00.000 -t 00:00:14.950
>> "test1.mp4"
>> 
>> ffmpeg -i "test.mp4" -codec copy -ss 00:00:16.510 -t 00:00:50.080
>> "test2.mp4"
>> 
>> But to "cat" the files via ffmpeg, all errors must be removed :
>> 
>> All mp4 files of the directory will be "cat"
>> 
>> ffmpeg -safe 0 -f concat -i <(printf "file '$PWD/%s'\n" *.mp4) -c copy
>> test.mp4
>> 
>> But with Avidemux you can ad all videos per drag + drop, after all, save
>> the files in copy mode to one-mp4 and reencode as you wish.
>> 
>> The script to get all errors with the respective timestamp :
>> 
>> #!/bin/bash
>> 
>> while IFS= read -r -d $'\0' video
>> do
>>    filename=$(basename -- "$video")
>>    filename="${filename%.*}"
>> 
>>    ffmpeg -y -i "$video" -vcodec libx264 -crf 51 -preset ultrafast
>> -acodec copy -f mp4 -movflags frag_keyframe+empty_moov+delay_moov pipe:1
>>> /dev/null 2>"${filename}.txt" </dev/null
>>    TxtFileName="${filename}.txt"
>>    mystring=${TxtFileName}
>>    echo $mystring
>>    grep -i -n 'error\|duplicate\|failure\|missing\|POCs\|corrupt'
>> "${TxtFileName}"
>>    echo "Ready"
>> 
>> done < <(find -iregex ".*\.\(mp4\|mkv\|m2ts\|mpg\|ts\)" -print0)
>> #dos2unix -c mac "${TxtFileName}"
>> #grep -C 5 -i -n 'error\|duplicate\|failure' "${TxtFileName}"
>> echo "Ready"
>> read pause
>> 
>> 
>> All video files of the directory will be checked, the result you will
>> find in the txt-file.
>> 
>> Regards
>> 
>> 
>> 
>> Am 25.02.25 um 03:02 schrieb BloodMan:
>>> Hello,
>>> 
>>> wetransfer mp4 test file: https://we.tl/t-BJKuiAHTKQ
>>> 
>>> The video plays using VLC with glitches and drops (with sound until
>>> the end) but reencoding generally failed (silence after the first drop).
>>> 
>>> How to survive? How to reencode with "ignore errors like play in vlc"?
>>> I tested many ffmpeg commands and tricks and nothing :/
>>> Anyone?
>>> 
>>> 
>>> ps. ffmpeg from git (N-118536-g4ff1d1f3d6) of course
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list