| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | set -euo pipefail |
| 7 | cd "$(dirname "$0")" |
| 8 | V=(-f lavfi -i testsrc2=size=160x120:rate=25:duration=0.6) |
| 9 | A=(-f lavfi -i sine=frequency=440:sample_rate=48000:duration=0.6) |
| 10 | X=(-c:v libx264 -preset ultrafast -g 12 -bf 2) |
| 11 | ffmpeg -v error -y "${V[@]}" "${A[@]}" "${X[@]}" -c:a aac -f mpegts tiny_h264_aac.ts |
| 12 | ffmpeg -v error -y "${V[@]}" "${A[@]}" "${X[@]}" -c:a ac3 -f mpegts -mpegts_m2ts_mode 1 tiny_h264_ac3.m2ts |
| 13 | ffmpeg -v error -y "${V[@]}" "${A[@]}" "${X[@]}" -c:a eac3 -f mpegts tiny_h264_eac3.ts |
| 14 | ffmpeg -v error -y -f lavfi -i testsrc2=size=160x120:rate=25:duration=0.3 -f lavfi -i sine=frequency=440:sample_rate=48000:duration=0.3 "${X[@]}" -c:a pcm_bluray -f mpegts -mpegts_m2ts_mode 1 tiny_h264_lpcm.m2ts |
| 15 | ffmpeg -v error -y "${V[@]}" "${A[@]}" -c:v libx265 -preset ultrafast -g 12 -x265-params log-level=none -c:a aac -f mpegts tiny_hevc_aac.ts |
| 16 | python3 -I - <<'PY' |
| 17 | import subprocess |
| 18 | def fnv(b): |
| 19 | h = 0xcbf29ce484222325 |
| 20 | for x in b: |
| 21 | h = ((h ^ x) * 0x100000001b3) & 0xFFFFFFFFFFFFFFFF |
| 22 | return h |
| 23 | rows = [] |
| 24 | for f in ["tiny_h264_aac.ts", "tiny_h264_ac3.m2ts", "tiny_h264_eac3.ts", "tiny_h264_lpcm.m2ts", "tiny_hevc_aac.ts"]: |
| 25 | for idx, codec in enumerate(["video", "audio"]): |
| 26 | if codec == "audio" and "lpcm" in f: |
| 27 | data = subprocess.run(["ffmpeg","-v","error","-i",f,"-map","0:1","-f","s16be","-"],capture_output=True,check=True).stdout |
| 28 | else: |
| 29 | data = subprocess.run(["ffmpeg","-v","error","-i",f,"-map",f"0:{idx}","-c","copy","-f","data","-"],capture_output=True,check=True).stdout |
| 30 | pk = subprocess.run(["ffprobe","-v","error","-select_streams",str(idx),"-show_entries","packet=pts","-of","csv=p=0",f],capture_output=True,check=True).stdout.split() |
| 31 | rows.append(f"{f} {idx} {len(pk)} {len(data)} {fnv(data):016x}") |
| 32 | open("expected.txt","w").write("\n".join(rows) + "\n") |
| 33 | PY |