{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":16880,"databundleVersionId":858837,"sourceType":"competition"}],"dockerImageVersionId":29844,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\n\n# Path to sample videos (inside Kaggle notebook)\nsample_videos_path = '../input/deepfake-detection-challenge/train_sample_videos'\n\n# List all videos\nvideos = os.listdir(sample_videos_path)\nprint(\"Number of sample videos:\", len(videos))\nprint(videos[:5])  # first 5 video names\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:20:19.603011Z","iopub.execute_input":"2025-11-04T12:20:19.603321Z","iopub.status.idle":"2025-11-04T12:20:19.627562Z","shell.execute_reply.started":"2025-11-04T12:20:19.603264Z","shell.execute_reply":"2025-11-04T12:20:19.6267Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from IPython.display import HTML\nfrom base64 import b64encode\n\n# Choose a video\nvideo_file = '../input/deepfake-detection-challenge/train_sample_videos/' + 'eivxffliio.mp4'\n\n# Display video\nmp4 = open(video_file,'rb').read()\ndata_url = \"data:video/mp4;base64,\" + b64encode(mp4).decode()\nHTML(f\"\"\"\n<video width=400 controls>\n    <source src=\"{data_url}\" type=\"video/mp4\">\n</video>\n\"\"\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:33:35.177441Z","iopub.execute_input":"2025-11-04T12:33:35.177768Z","iopub.status.idle":"2025-11-04T12:33:35.351804Z","shell.execute_reply.started":"2025-11-04T12:33:35.177718Z","shell.execute_reply":"2025-11-04T12:33:35.350429Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import cv2\nfrom matplotlib import pyplot as plt\n\nvideo_file = '../input/deepfake-detection-challenge/train_sample_videos/eivxffliio.mp4'\ncap = cv2.VideoCapture(video_file)\n\nret, frame = cap.read()\ncap.release()\n\n# OpenCV frames are BGR, convert to RGB\nframe = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)\nplt.imshow(frame)\nplt.axis('off')\nplt.show()\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:34:05.447672Z","iopub.execute_input":"2025-11-04T12:34:05.447958Z","iopub.status.idle":"2025-11-04T12:34:06.228615Z","shell.execute_reply.started":"2025-11-04T12:34:05.447911Z","shell.execute_reply":"2025-11-04T12:34:06.227806Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import cv2\nfrom matplotlib import pyplot as plt\n\nvideo_file = '../input/deepfake-detection-challenge/train_sample_videos/eivxffliio.mp4'\ncap = cv2.VideoCapture(video_file)\n\nframe_count = 0\nmax_frames = 10  # jitne frames dekhna hai\n\nwhile frame_count < max_frames:\n    ret, frame = cap.read()\n    if not ret:\n        break\n    \n    # Convert BGR to RGB for matplotlib\n    frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)\n    \n    # Display the frame\n    plt.imshow(frame_rgb)\n    plt.axis('off')\n    plt.show()\n    \n    frame_count += 1\n\ncap.release()\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:35:14.756544Z","iopub.execute_input":"2025-11-04T12:35:14.756919Z","iopub.status.idle":"2025-11-04T12:35:16.900822Z","shell.execute_reply.started":"2025-11-04T12:35:14.75685Z","shell.execute_reply":"2025-11-04T12:35:16.899829Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import cv2\n\n# Read a video\nvideo_file = os.path.join(sample_videos_path, videos[0])\ncap = cv2.VideoCapture(video_file)\n\nframe_count = 0\nwhile True:\n    ret, frame = cap.read()\n    if not ret:\n        break\n    frame_count += 1\ncap.release()\n\nprint(\"Total frames in first video:\", frame_count)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:36:43.237794Z","iopub.execute_input":"2025-11-04T12:36:43.238093Z","iopub.status.idle":"2025-11-04T12:36:45.067229Z","shell.execute_reply.started":"2025-11-04T12:36:43.238046Z","shell.execute_reply":"2025-11-04T12:36:45.066074Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import os\nimport json\n\n# Path to sample videos\nsample_videos_path = '../input/deepfake-detection-challenge/train_sample_videos'\n\n# Load metadata file\nmetadata_path = '../input/deepfake-detection-challenge/metadata.json'\nwith open(metadata_path) as f:\n    metadata = json.load(f)\n\n# List all sample videos\nvideos = os.listdir(sample_videos_path)\nprint(\"Number of sample videos:\", len(videos))\nprint(\"First 5 videos:\", videos[:5])\n\n# Example: Check label of first video\nvideo_name = videos[0]\nlabel = metadata.get(video_name, \"Label not found\")\nprint(f\"Video: {video_name}, Label: {label}\")\n\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-11-04T12:41:58.002854Z","iopub.execute_input":"2025-11-04T12:41:58.003156Z","iopub.status.idle":"2025-11-04T12:41:58.015636Z","shell.execute_reply.started":"2025-11-04T12:41:58.003107Z","shell.execute_reply":"2025-11-04T12:41:58.014235Z"}},"outputs":[],"execution_count":null}]}