The script does use the decoding analysis by ffmpeg during encoding process (conversion video to h.264).
All checked frames will be written to a txt-file with the respective timestamp.
All videos of a directory will be checked. The output in the terminal will be something like that :
Enemies Closer.txt
12:[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5d3bf75bf4c0] st: 0 edit list: 2 Missing key frame while searching for timestamp: 2000
14:[h264 @ 0x5d3bf75c0480] co located POCs unavailable
34:[h264 @ 0x5d3bf75e6780] co located POCs unavailable
35:[h264 @ 0x5d3bf76123c0] co located POCs unavailable
[h264 @ 0x5d3bf7708b00] reference picture missing during reorderate= 117.5kbits/s dup=96 drop=0 speed=4.46x
58:[h264 @ 0x5d3bf7708b00] Missing reference picture, default is 65730
59:[h264 @ 0x5d3bf7728dc0] mmco: unref short failure
Ready
Ready
The respective part in the txt-file e.g.:
---
frame= 649 fps=108 q=49.0 size= 384kB time=00:00:26.79 bitrate= 117.5kbits/s dup=96 drop=0 speed=4.46x
[h264 @ 0x5d3bf7708b00] reference picture missing during reorder
[h264 @ 0x5d3bf7708b00] Missing reference picture, default is 65730
[h264 @ 0x5d3bf7728dc0] mmco: unref short failure
frame= 702 fps=108 q=52.0 size= 384kB time=00:00:28.88 bitrate= 109.0kbits/s dup=98 drop=0 speed=4.44x
---
1. The generated txt-file, every video get a separated one, same file-name.
2. Errors if present, if not only "Ready" will be written to indicate check will be complete
3. Additional "Ready" after all videos have been checked
After start of the script, the txt-file will be written, no indication in terminal unless first video-check will be complete.
The script :
In most cases I use it for recorded videos (ts-stream via SAT), but it is also possible to use it for edited videos.
The script attached as txt-file, rename it to CheckForError.sh and make it executable.
All checked frames will be written to a txt-file with the respective timestamp.
All videos of a directory will be checked. The output in the terminal will be something like that :
Enemies Closer.txt
12:[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5d3bf75bf4c0] st: 0 edit list: 2 Missing key frame while searching for timestamp: 2000
14:[h264 @ 0x5d3bf75c0480] co located POCs unavailable
34:[h264 @ 0x5d3bf75e6780] co located POCs unavailable
35:[h264 @ 0x5d3bf76123c0] co located POCs unavailable
[h264 @ 0x5d3bf7708b00] reference picture missing during reorderate= 117.5kbits/s dup=96 drop=0 speed=4.46x
58:[h264 @ 0x5d3bf7708b00] Missing reference picture, default is 65730
59:[h264 @ 0x5d3bf7728dc0] mmco: unref short failure
Ready
Ready
The respective part in the txt-file e.g.:
---
frame= 649 fps=108 q=49.0 size= 384kB time=00:00:26.79 bitrate= 117.5kbits/s dup=96 drop=0 speed=4.46x
[h264 @ 0x5d3bf7708b00] reference picture missing during reorder
[h264 @ 0x5d3bf7708b00] Missing reference picture, default is 65730
[h264 @ 0x5d3bf7728dc0] mmco: unref short failure
frame= 702 fps=108 q=52.0 size= 384kB time=00:00:28.88 bitrate= 109.0kbits/s dup=98 drop=0 speed=4.44x
---
1. The generated txt-file, every video get a separated one, same file-name.
2. Errors if present, if not only "Ready" will be written to indicate check will be complete
3. Additional "Ready" after all videos have been checked
After start of the script, the txt-file will be written, no indication in terminal unless first video-check will be complete.
The script :
Code:
#!/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
In most cases I use it for recorded videos (ts-stream via SAT), but it is also possible to use it for edited videos.
The script attached as txt-file, rename it to CheckForError.sh and make it executable.