ITADN

Discussion: How to use ffprobe to retrieve duration?

#884Openjay-ramani 创建于 2025-12-06
J
jay-ramanicommented
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 ```Python 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.
0 条评论