Giter Club home page Giter Club logo

kawa's Issues

How to get FFPROBE output to match command shell

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.