Skip to content

Discussion: How to use ffprobe to retrieve duration? #884

Description

@jay-ramani

Not really an issue, but a question. Raising here, since there's no discussion tab.

How do I use this library to retrieve only the duration (while suppressing every other output) of a video stream (at index zero) to standard output with ffprobe? While we could achieve this with the Python subprocess module as below

subprocess.run(
	(
		"path_to_ffprobe",
		"-v",
		"quiet",
		"-select_streams",
		"v:0",
		"-show_entries",
		"format=duration",
		"-print_format",
		"default=noprint_wrappers=1:nokey=1",
		"-i",
		input_file
	)
)

, this would require to know the path to ffprobe. I'm trying to achieve the above using a ffmpeg library without relying on an external path in my code.

Any tips and pointers would be appreciated.

Thanks and cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions