adder-codec-rs 0.4.9

Encoder/transcoder/decoder for raw and compressed ADΔER (Address, Decimation, Δt Event Representation) streams. Includes a transcoder for casting either framed or event video into an ADΔER representation in a manner which preserves the temporal resolution of the source.
Documentation
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "initial_id",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-11-22T14:21:21.515056934Z",
     "start_time": "2023-11-22T14:21:21.471375214Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import random\n",
    "\n",
    "input_directory_path = '/media/andrew/ExternalM2/VIRAT/videos_original'\n",
    "output_directory_path = '/home/andrew/Videos/VIRAT_gray_0.5_3'\n",
    "\n",
    "# List all files in the directory\n",
    "file_list = os.listdir(input_directory_path)\n",
    "\n",
    "# Randomly select some unique file paths\n",
    "random_file_paths = random.sample(file_list, 150)\n",
    "\n",
    "# Create the full file paths\n",
    "full_file_paths = [os.path.join(input_directory_path, filename) for filename in random_file_paths]\n",
    "\n",
    "full_destination_paths = [os.path.join(output_directory_path, filename) for filename in random_file_paths]\n",
    "\n",
    "print(full_file_paths)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c8d3616ef5aff427",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-11-02T02:24:14.567359957Z",
     "start_time": "2023-11-02T02:11:19.226504503Z"
    }
   },
   "outputs": [],
   "source": [
    "for i in range(len(full_file_paths)):\n",
    "    input = full_file_paths[i]\n",
    "    output = full_destination_paths[i]\n",
    "    ! ffmpeg -i {input} -vf \"select=lt(n\\,480),scale=640:360,format=gray\" -c:v libx265 -crf 23 -g 30 -frames:v 480 {output}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77aebeb9793e0069",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2023-11-22T14:26:34.763576228Z",
     "start_time": "2023-11-22T14:22:24.184554754Z"
    }
   },
   "outputs": [],
   "source": [
    "# tmp_list = [\n",
    "#     \"VIRAT_S_000002.mp4\",\n",
    "#     \"VIRAT_S_000003.mp4\",\n",
    "#     \"VIRAT_S_040000_02_000111_000145.mp4\",\n",
    "#     \"VIRAT_S_040000_05_000668_000703.mp4\",\n",
    "#     \"VIRAT_S_040001_03_001531_001595.mp4\",\n",
    "#     \"VIRAT_S_040003_01_000083_000193.mp4\",\n",
    "#     \"VIRAT_S_040003_06_001441_001518.mp4\",\n",
    "#     \"VIRAT_S_040004_00_000011_000093.mp4\",\n",
    "#     \"VIRAT_S_040005_00_000003_000058.mp4\",\n",
    "#     \"VIRAT_S_040005_07_001026_001223.mp4\",\n",
    "#     \"VIRAT_S_040103_05_000729_000804.mp4\",\n",
    "#     \"VIRAT_S_040103_06_000836_000909.mp4\",\n",
    "#     \"VIRAT_S_040103_07_001011_001093.mp4\",\n",
    "#     \"VIRAT_S_040104_00_000120_000224.mp4\",\n",
    "#     \"VIRAT_S_040104_04_000854_000934.mp4\",\n",
    "#     \"VIRAT_S_040104_07_001268_001348.mp4\",\n",
    "#     \"VIRAT_S_040104_09_001475_001583.mp4\",\n",
    "#     \"VIRAT_S_050000_01_000207_000361.mp4\",\n",
    "#     \"VIRAT_S_050000_02_000404_000486.mp4\",\n",
    "#     \"VIRAT_S_050000_04_000640_000690.mp4\",\n",
    "#     \"VIRAT_S_050000_05_000696_000732.mp4\",\n",
    "#     \"VIRAT_S_050000_06_000908_000970.mp4\",\n",
    "#     \"VIRAT_S_050000_07_001014_001126.mp4\",\n",
    "#     \"VIRAT_S_050000_09_001310_001373.mp4\",\n",
    "#     \"VIRAT_S_050000_11_001530_001576.mp4\",\n",
    "#     \"VIRAT_S_050000_12_001591_001619.mp4\",\n",
    "#     \"VIRAT_S_050000_13_001722_001766.mp4\",\n",
    "#     \"VIRAT_S_050201_00_000012_000116.mp4\",\n",
    "#     \"VIRAT_S_050201_03_000573_000647.mp4\",\n",
    "#     \"VIRAT_S_050201_04_000669_000728.mp4\",\n",
    "#     \"VIRAT_S_050201_07_001348_001458.mp4\",\n",
    "#     \"VIRAT_S_050201_08_001567_001647.mp4\",\n",
    "#     \"VIRAT_S_050201_09_001821_001876.mp4\",\n",
    "#     \"VIRAT_S_050201_10_001992_002056.mp4\",\n",
    "#     \"VIRAT_S_050201_11_002090_002220.mp4\",\n",
    "#     \"VIRAT_S_050202_00_000000_000105.mp4\",\n",
    "#     \"VIRAT_S_050202_02_000447_000577.mp4\",\n",
    "#     \"VIRAT_S_050202_03_000608_000684.mp4\",\n",
    "#     \"VIRAT_S_050202_04_000690_000750.mp4\",\n",
    "#     \"VIRAT_S_050202_10_002159_002233.mp4\",\n",
    "#     \"VIRAT_S_050203_01_000147_000223.mp4\",\n",
    "#     \"VIRAT_S_050203_08_001686_001885.mp4\",\n",
    "#     \"VIRAT_S_050203_09_001960_002083.mp4\",\n",
    "#     \"VIRAT_S_050300_00_000000_000067.mp4\",\n",
    "#     \"VIRAT_S_050300_04_001057_001122.mp4\",\n",
    "#     \"VIRAT_S_050300_06_001427_001616.mp4\",\n",
    "#     \"VIRAT_S_050300_08_001705_001771.mp4\",\n",
    "#     \"VIRAT_S_050300_09_001789_001858.mp4\",\n",
    "#     \"VIRAT_S_050301_02_000544_000607.mp4\",\n",
    "#     \"VIRAT_S_050301_03_000933_001046.mp4\",\n",
    "# \n",
    "# ]\n",
    "# full_file_paths = [os.path.join(input_directory_path, filename) for filename in tmp_list]\n",
    "# \n",
    "# full_destination_paths = [os.path.join(output_directory_path, filename) for filename in tmp_list]\n",
    "# for i in range(len(full_file_paths)):\n",
    "#     input = full_file_paths[i]\n",
    "#     output = full_destination_paths[i]\n",
    "#     ! ffmpeg -i {input} -vf \"select=lt(n\\,480),scale=640:360,format=gray\" -c:v libx265 -crf 23 -g 30 -frames:v 480 {output}"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}