Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Proposal] Generate mapping file of slices and original audio files #23

Open
Nukepayload2 opened this issue May 4, 2024 · 3 comments
Open

Comments

@Nukepayload2
Copy link

Summary

As a video editor, I want to slice videos based on the audio part. I need to remove silence parts from my live playbacks. If this tool can produce a file that maps sliced audios to time spans of the original audio, I can use the mapping file to slice my videos to remove silence parts automatically with video processing tools (like ffmpeg). I can also use speech to text tools to filter audio slices, then filter spans of my videos based on the mapping file.

File format

The following file maps time spans of 2 original audios to 5 audio slices. The output path of the mapping file needs to be specified from GUI before slicing.

{
  "outputFolder": "C:\\Users\\UserName\\Videos\\PlaybackSlices",
  "tasks": [
    {
      "originalFile": "C:\\Users\\UserName\\Videos\\Playback202405030234.wav",
      "slices": [
        {
          "start": 0,
          "end": 1780,
          "file": "Playback202405030234_0.wav"
        },
        {
          "start": 1780,
          "end": 2460,
          "file": "Playback202405030234_1.wav"
        }
      ]
    },
    {
      "originalFile": "C:\\Users\\UserName\\Videos\\Playback202405040330.wav",
      "slices": [
        {
          "start": 0,
          "end": 2790,
          "file": "Playback202405040330_0.wav"
        },
        {
          "start": 3150,
          "end": 9460,
          "file": "Playback202405040330_1.wav"
        },
        {
          "start": 12800,
          "end": 14690,
          "file": "Playback202405040330_2.wav"
        }
      ]
    }
  ]
}

Note

I'm not sure whether I can implement this feature by myself. Because I'm new to Python. If I managed to implement this feature, I'll open a pull request.

@Nukepayload2 Nukepayload2 changed the title Include mapping file as output [Proposal] Generate mapping file of slices and original audio files May 4, 2024
@Nukepayload2
Copy link
Author

I've updated the UI and finished the JSON exporting part on my fork. But the time unit of spans are not in milliseconds. The time unit is actually seconds multipled by the sample rate. Once the unit conversion is done, I'll create a pull request.

@flutydeer
Copy link
Owner

If you want to obtain time stamps, see #18 (comment)

@Nukepayload2
Copy link
Author

@flutydeer Thanks for letting me know OpenVPI's dataset-tools. However, that tool uses audio frames instead of milliseconds as time unit, which is unfriendly for ffmpeg.
I've finished the time unit conversion part on my fork. The output JSON uses milliseconds.
If you're interested in the time stamps feature, I can create a pull request.

@flutydeer flutydeer pinned this issue Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants