Skip to content

How to get FFPROBE output to match command shell #5

Description

@WorldsEndless

I have an ffprobe line of code. I could just work the strings and do a command-line ssh to pull it off, but… strings, reusability, extensibility, maintainability, brittleness…

I am new to ffprobe (and ffmpeg in general), but the working commandline solution is this:

ffprobe -v error -select_streams v:0 -show_entries stream=width,height,display_aspect_ratio -of json=c=1 ./small_test_video.mp4

with results like this:

{
    "programs": [

    ],
    "streams": [
	{ "width": 1280, "height": 720, "display_aspect_ratio": "16:9" }
    ]
}

Here is my current attempt in Kawa. Please pardon all the #_ comments; I am trying to figure this out.

(let [file-path (-> env :FILES :media-url (str "small_test_video.mp4"))
	  test-name :ffprobe
	  #_#_ mp4 (ffmanager/register :mp4 (ffm/ffmpeg! :format "lavfi" :input-url "testsrc" :duration 10
						    :pixel-format "yuv420p" "testsrc.mp4"))
	  ffp (ffmanager/register test-name
				  (ffm/ffprobe! :input-url file-path :output-format "json"))]
      #_(shell/sh "ffprobe" "-v" "error" "-select_streams" "v:0" "-show_entries" "stream=width,height,display_aspect_ratio" "-of" "json=c=1" (-> (:tempfile file) .getAbsolutePath))      
      (-> (ffmanager/ls) test-name :process #_:out #_#_:err slurp)
      ;(is false)
      )

And then the goal is to reason over that return value to make a decision based on the aspect ratio.
I can't figure out how to get it to output the data I want.

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