syncstart


Namesyncstart JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/rpuntaie/syncstart
SummaryCalculate the cut needed at start to sync two media files.
upload_time2024-04-03 06:36:47
maintainerNone
docs_urlNone
authorRoland Puntaier
requires_python>=3.6
licenseMIT
keywords media file synchronization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =======================================
syncstart(1) Version 1.1.0 \| syncstart
=======================================

SYNOPSIS
========

Command line help::

    usage: syncstart [-h] [--version] [-v] [-b BEGIN] [-t TAKE] [-n] [-d] [-l LOWPASS] [-c] [-s] [-q] in1 in2
    
    CLI interface to sync two media files using their audio or video streams.
      ffmpeg needs to be available.
      
    
    positional arguments:
      in1                   First media file to sync with second.
      in2                   Second media file to sync with first.
    
    options:
      -h, --help            show this help message and exit
      --version             show program's version number and exit
      -v, --video           Compare video streams. (audio is default)
      -b BEGIN, --begin BEGIN
                            Begin comparison X seconds into the inputs. (default: 0)
      -t TAKE, --take TAKE  Take X seconds of the inputs to look at. (default: 20)
      -n, --normalize       Normalizes audio/video values from each stream.
      -d, --denoise         Reduces audio/video noise in each stream.
      -l LOWPASS, --lowpass LOWPASS
                            Audio option: Discards frequencies above the specified Hz, e.g., 300. 0 == off (default)
      -c, --crop            Video option: Crop to 4:3. Helpful when aspect ratios differ.
      -s, --show            Suppress "show diagrams", in case you are confident.
      -q, --quiet           Suppresses standard output except for the CSV result. Output will be:
                            file_to_advance,seconds_to_advance


DESCRIPTION
===========


The steps taken by ``syncstart``:

- get the maximum audio sample frequency or video frame rate among the inputs using ffprobe
- process and extract sample audio/video clips using ffmpeg with some default and optional filters
- read the two clips into a 1D array and apply optional z-score normalization
- compute offset via correlation using scipy ifft/fft
- print ffmpeg/ffprobe output or optionally quiet that
- show diagrams to allow MANUAL correction using ZOOM or optionally suppress that
- print result

Requirements:

- ffmpeg and ffprobe installed
- Python3 with tk (tk is separate on Ubuntu: python3-tk)

References:

- https://ffmpeg.org/ffmpeg-all.html
- https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar
- https://dsp.stackexchange.com/questions/18846/map-time-difference-between-two-similar-videos

Within Python:

from syncstart import file_offset




INSTALLATION
============

To install for user only, do::

   pip install --user syncstart

EXAMPLES
--------

::

  # compute audio offset with default settings:
  syncstart from_s10.m4a from_gopro.m4p

  # compute audio offset using first 10 seconds with denoising, normalization and a 300 Hz lowpass filter:
  syncstart video1.mp4 video2.mkv -t 10 -dnl 300

  # compute video offset using first 20 seconds, don't show plots, only output final result:
  syncstart video1.mp4 video2.mkv -vsq

  # compute video offset using seconds 15 to 25 with denoising, cropping and normalization:
  syncstart video1.mp4 video2.mkv -b 15 -t 10 -vdcn

License
-------

MIT


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/rpuntaie/syncstart",
    "name": "syncstart",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "media file synchronization",
    "author": "Roland Puntaier",
    "author_email": "roland.puntaier@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "=======================================\nsyncstart(1) Version 1.1.0 \\| syncstart\n=======================================\n\nSYNOPSIS\n========\n\nCommand line help::\n\n    usage: syncstart [-h] [--version] [-v] [-b BEGIN] [-t TAKE] [-n] [-d] [-l LOWPASS] [-c] [-s] [-q] in1 in2\n    \n    CLI interface to sync two media files using their audio or video streams.\n      ffmpeg needs to be available.\n      \n    \n    positional arguments:\n      in1                   First media file to sync with second.\n      in2                   Second media file to sync with first.\n    \n    options:\n      -h, --help            show this help message and exit\n      --version             show program's version number and exit\n      -v, --video           Compare video streams. (audio is default)\n      -b BEGIN, --begin BEGIN\n                            Begin comparison X seconds into the inputs. (default: 0)\n      -t TAKE, --take TAKE  Take X seconds of the inputs to look at. (default: 20)\n      -n, --normalize       Normalizes audio/video values from each stream.\n      -d, --denoise         Reduces audio/video noise in each stream.\n      -l LOWPASS, --lowpass LOWPASS\n                            Audio option: Discards frequencies above the specified Hz, e.g., 300. 0 == off (default)\n      -c, --crop            Video option: Crop to 4:3. Helpful when aspect ratios differ.\n      -s, --show            Suppress \"show diagrams\", in case you are confident.\n      -q, --quiet           Suppresses standard output except for the CSV result. Output will be:\n                            file_to_advance,seconds_to_advance\n\n\nDESCRIPTION\n===========\n\n\nThe steps taken by ``syncstart``:\n\n- get the maximum audio sample frequency or video frame rate among the inputs using ffprobe\n- process and extract sample audio/video clips using ffmpeg with some default and optional filters\n- read the two clips into a 1D array and apply optional z-score normalization\n- compute offset via correlation using scipy ifft/fft\n- print ffmpeg/ffprobe output or optionally quiet that\n- show diagrams to allow MANUAL correction using ZOOM or optionally suppress that\n- print result\n\nRequirements:\n\n- ffmpeg and ffprobe installed\n- Python3 with tk (tk is separate on Ubuntu: python3-tk)\n\nReferences:\n\n- https://ffmpeg.org/ffmpeg-all.html\n- https://dsp.stackexchange.com/questions/736/how-do-i-implement-cross-correlation-to-prove-two-audio-files-are-similar\n- https://dsp.stackexchange.com/questions/18846/map-time-difference-between-two-similar-videos\n\nWithin Python:\n\nfrom syncstart import file_offset\n\n\n\n\nINSTALLATION\n============\n\nTo install for user only, do::\n\n   pip install --user syncstart\n\nEXAMPLES\n--------\n\n::\n\n  # compute audio offset with default settings:\n  syncstart from_s10.m4a from_gopro.m4p\n\n  # compute audio offset using first 10 seconds with denoising, normalization and a 300 Hz lowpass filter:\n  syncstart video1.mp4 video2.mkv -t 10 -dnl 300\n\n  # compute video offset using first 20 seconds, don't show plots, only output final result:\n  syncstart video1.mp4 video2.mkv -vsq\n\n  # compute video offset using seconds 15 to 25 with denoising, cropping and normalization:\n  syncstart video1.mp4 video2.mkv -b 15 -t 10 -vdcn\n\nLicense\n-------\n\nMIT\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Calculate the cut needed at start to sync two media files.",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/rpuntaie/syncstart"
    },
    "split_keywords": [
        "media",
        "file",
        "synchronization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "42c6ab5eb6f1761d02413e1061a03575c5bf295c8621169168a954e1e3440b87",
                "md5": "974986b0c3a9990450ed4f749feb4fca",
                "sha256": "9898e27eef20dc23b7edc78a8a1f6e673a54a88a304fc1eec9c9bd12a07eb05e"
            },
            "downloads": -1,
            "filename": "syncstart-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "974986b0c3a9990450ed4f749feb4fca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9851,
            "upload_time": "2024-04-03T06:36:47",
            "upload_time_iso_8601": "2024-04-03T06:36:47.359748Z",
            "url": "https://files.pythonhosted.org/packages/42/c6/ab5eb6f1761d02413e1061a03575c5bf295c8621169168a954e1e3440b87/syncstart-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 06:36:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rpuntaie",
    "github_project": "syncstart",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "syncstart"
}
        
Elapsed time: 0.23812s