edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB3d2e08fTahinli6 days ago3929 commits
| 1 | #!/usr/bin/env bash |
| 2 | # hevc-rc.sh: bitrate control of ec-h265's sequence encoder on a real clip. |
| 3 | # |
| 4 | # For each target bitrate: encode the clip with RateControl::Bitrate, decode the |
| 5 | # stream with ec-h265 and with ffmpeg, and check both decodes byte-for-byte against |
| 6 | # the encoder's own reconstruction. Reports the achieved bitrate and the PSNR of the |
| 7 | # reconstruction against the source. |
| 8 | # |
| 9 | # Usage: scripts/hevc-rc.sh <clip> [SECONDS] [KBPS list] |
| 10 | # clip any video ffmpeg can read; it is cut to SECONDS and scaled to 1280x720 at 30 fps |
| 11 | # SECONDS clip length (default 60) |
| 12 | # KBPS targets in kbit/s (default "1000 2500 5000") |
| 13 | # Environment: DATA (default $HOME/.cache/hevcencrc-data), KEYINT (default 30). |
| 14 | # |
| 15 | # Run it where cargo builds: scripts/remote-run.sh hevcencrc -- scripts/hevc-rc.sh <clip> |
| 16 | # Intermediate YUV files are deleted as soon as they are checked: the 60 s 720p source is |
| 17 | # 2.5 GB and each decode is the same again. |
| 18 | |
| 19 | |
| 20 | here= |
| 21 | clip= |
| 22 | secs= |
| 23 | kbpss= |
| 24 | data= |
| 25 | keyint= |
| 26 | fps=30 |
| 27 | w=1280 |
| 28 | h=720 |
| 29 | |
| 30 | |
| 31 | src="/src-x--s.yuv" |
| 32 | if [; then |
| 33 | |
| 34 | |
| 35 | fi |
| 36 | frames= |
| 37 | |
| 38 | |
| 39 | target= |
| 40 | |
| 41 | bin="/release/examples/hevc_rc" |
| 42 | |
| 43 | # PSNR of a raw I420 file against the source, the average over Y, U and V as ffmpeg reports it. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | status=0 |
| 51 | |
| 52 | |
| 53 | for; do |
| 54 | stream="/rc-.hevc" |
| 55 | rec="/rc--recon.yuv" |
| 56 | dec="/rc--ec.yuv" |
| 57 | ffdec="/rc--ff.yuv" |
| 58 | line= |
| 59 | achieved= |
| 60 | qp= |
| 61 | err= |
| 62 | |
| 63 | |
| 64 | if ; then ec_ok=match; else ec_ok=DIFFER; status=1; fi |
| 65 | |
| 66 | |
| 67 | |
| 68 | if ; then ff_ok=match; else ff_ok=DIFFER; status=1; fi |
| 69 | |
| 70 | |
| 71 | y_psnr= |
| 72 | |
| 73 | |
| 74 | done |
| 75 |