I am trying to use the ffmpeg framehash muxer to hash frames as they are being recorded.
I've tried
ffmpeg -nostdin -hwaccel auto -fflags +igndts \
-f alsa \
-ac 1 \
-ar 44000 \
-thread_queue_size 2048 \
-i hw:2,1,0 \
-acodec aac \
-f video4linux2 \
-thread_queue_size 2048 \
-i /dev/video0 \
-vcodec libx264 \
-preset ultrafast \
-tune zerolatency \
-s 1280x720 \
-r 30 \
-t 00:00:05 \
-f avi - \
| ffmpeg -nostdin -hwaccel auto \
-i - \
-f framehash out/out.md5 \
out/out.avi
The first ffmpeg command creates the streams (audio/video) and pipes to a second ffmpeg command in the avi format, which uses the framehash muxer then writes the avi file. The idea of using the piped command is that instead of the hashframe muxer using the rawvideo stream, it uses the encoded stream... That being said, hashframe seems to be using the rawvideo stream, and I can't get the mapping right.
I've tried -map 1:0 -map 1:1 \
before the framehash, because I saw this with a channel of mpeg4 and mp3.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
Stream #0:1 -> #0:1 (mp3 (mp3float) -> pcm_s16le (native))
Stream #0:0 -> #1:0 (h264 (native) -> mpeg4 (native))
Stream #0:1 -> #1:1 (mp3 (mp3float) -> mp3 (libmp3lame))
Output #0, framehash, to 'out/out.md5':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 1280x720, q=2-31, 331776 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc58.54.100 rawvideo
Stream #0:1: Audio: pcm_s16le, 16000 Hz, mono, s16, 256 kb/s
Metadata:
encoder : Lavc58.54.100 pcm_s16le
Anyways, when I compare the output files, (by running ffmpeg -i out/out.avi -f framehash out/out1.md5
the hashes don't match. Any idea how I can fix this problem?
Thanks!!!
Framehash output from stream