ffmpeg - trascoding multiple streams from stdin errors out: pipe:: Invalid data found when processing input
I fixed your command

       cat a2.mkv | ffmpeg -nostdin -i - -y -map 0:0 -c:0 copy -f matroska -y 0.mkv -map 0:0 -vf "select=gt(scene\\,0.4)" -frames:v 1 -vsync vfr -vf fps=fps=1/60 -codec png -f image2pipe 0.png