-1

Please tell me the ffmpeg cammand line code to get information of mp4 file in json format. i want details of video(in mp4) to json format. The details include images, layers , background, audio information etc just as shown in code below.(The output is show below i need input command line code).Thanks in advance

{  
   "images":[
{
  "name":"img_0.jpg",
  "w":540,
  "h":960,
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
},
{
  "name":"img_1.jpg",
  "w":540,
  "h":960,
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
},
{
  "name":"img_2.jpg",
  "w":540,
  "h":960,
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
},
{
  "name":"img_3.jpg",
  "w":540,
  "h":960,
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
},
{
  "name":"img_4.jpg",
  "w":540,
  "h":960,
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
}
],
"static_inputs":[
{
  "name":"background_video.mp4",
  "prefix":[
    "-i"
  ],
  "postfix":[

  ]
}
],
 "video":{
"h":960,
"w":1080,
"duration":30
},
"e":[],
"m":[
"-{pythoncomplex}"
],
"r":["[5]split=2[color][alpha]; [color]crop=iw/2:ih:0:0[color]; [alpha]crop=iw/2:ih:iw/2:0[alpha]; 
[color][alpha]{pythonmerge}[ovrly]; [0]scale=540:960,setsar=1[0_scalled]; 
[1]scale=540:960,setsar=1[1_scalled]; [2]scale=540:960,setsar=1[2_scalled]; 
[3]scale=540:960,setsar=1[3_scalled]; [4]scale=540:960,setsar=1[4_scalled]; [0_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*5:s=540x960, 
{pythonf}=t=out:st=6:d=1[v0]; [1_scalled]{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001, 
{pythonz}-0.0015))':d=25*5:s=540x960,{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=6:d=1[v1]; 
[2_scalled]{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*7:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=8:d=1[v2]; [3_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*7:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=8:d=1[v3]; [4_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*6:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=7:d=1[v4]; [v0][v1][v2][v3] 
[v4]concat=n=5:v=1:a=0,format=yuv420p[concatenated_video]; [concatenated_video][ovrly] 
{pythono}=0:0[base_video]; [base_video][6] 
{pythono}=enable='between(t,0,15)':x=30:y=30[watermarked_part1]; [watermarked_part1][6] 
{pythono}=enable='between(t,15,30)':x=(main_w-{pythono}_w-30):y=(main_h-{pythono}_h-30)"],
"i":["[5]split=2[color][alpha]; [color]crop=iw/2:ih:0:0[color]; [alpha]crop=iw/2:ih:iw/2:0[alpha]; 
[color][alpha]{pythonmerge}[ovrly]; [0]scale=540:960,setsar=1[0_scalled]; 
[1]scale=540:960,setsar=1[1_scalled]; [2]scale=540:960,setsar=1[2_scalled]; 
[3]scale=540:960,setsar=1[3_scalled]; [4]scale=540:960,setsar=1[4_scalled]; [0_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*5:s=540x960, 
{pythonf}=t=out:st=6:d=1[v0]; [1_scalled]{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001, 
{pythonz}-0.0015))':d=25*5:s=540x960,{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=6:d=1[v1]; 
[2_scalled]{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*7:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=8:d=1[v2]; [3_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*7:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=8:d=1[v3]; [4_scalled] 
{pythonz}pan=z='if(lte({pythonz},1.0),1.1,max(1.001,{pythonz}-0.0015))':d=25*6:s=540x960, 
{pythonf}=t=in:st=0:d=1,{pythonf}=t=out:st=7:d=1[v4]; [v0][v1][v2][v3] 
[v4]concat=n=5:v=1:a=0,format=yuv420p[concatenated_video]; [concatenated_video][ovrly] 
{pythono}=0:0[base_video]; [base_video][6] 
{pythono}=enable='between(t,0,15)':x=30:y=30[watermarked_part1]; [watermarked_part1][6] 
{pythono}=enable='between(t,15,30)':x=(main_w-{pythono}_w-30):y=(main_h-{pythono}_h-30) 
[final_video]"],
"n":[],
"g":[],
"c":[],
"o":[
"-map",
"[final_video]",
"-map",
"7:a"
],
"d":[
"-t",
"30"
],
"s":[],
 "layers": [
{
  "ao": 0,
  "bm": 1,
  "ddd": 0,
  "ind": 1,
  "ip": 0,
  "ks": {
    "a": {
      "a": 0,
      "ix": 1,
      "k": [
        270,
        480,
        0
      ]
    },
    "o": {
      "a": 0,
      "ix": 11,
      "k": 18.039
    },
    "p": {
      "a": 0,
      "ix": 2,
      "k": [
        270,
        480,
        0
      ]
    },
    "r": {
      "a": 0,
      "ix": 10,
      "k": 0
    },
    "s": {
      "a": 0,
      "ix": 6,
      "k": [
        100,
        100,
        100
      ]
    }
  },
  "nm": "all",
  "op": 327,
  "refId": "image_0",
  "sr": 1,
  "st": 0,
  "ty": 2
},
{
  "ao": 0,
  "bm": 3,
  "ddd": 0,
  "ind": 2,
  "ip": 76,
  "ks": {
    "a": {
      "a": 0,
      "ix": 1,
      "k": [
        270,
        480,
        0
      ]
    },
    "o": {
      "a": 0,
      "ix": 11,
      "k": 40
    },
    "p": {
      "a": 0,
      "ix": 2,
      "k": [
        270,
        480,
        0
      ]
    },
    "r": {
      "a": 0,
      "ix": 10,
      "k": 0
    },
    "s": {
      "a": 0,
      "ix": 6,
      "k": [
        100,
        100,
        100
      ]
    }
  },
  "nm": "lvjing  all 3",
  "op": 327,
  "refId": "image_1",
  "sr": 1,
  "st": -8,
  "ty": 2
},
{
  "ao": 0,
  "bm": 13,
  "ddd": 0,
  "ind": 3,
  "ip": 76,
  "ks": {
    "a": {
      "a": 0,
      "ix": 1,
      "k": [
        270,
        480,
        0
      ]
    },
    "o": {
      "a": 0,
      "ix": 11,
      "k": 50.196
    },
    "p": {
      "a": 0,
      "ix": 2,
      "k": [
        270,
        480,
        0
      ]
    },
    "r": {
      "a": 0,
      "ix": 10,
      "k": 0
    },
    "s": {
      "a": 0,
      "ix": 6,
      "k": [
        100,
        100,
        100
      ]
    }
  },
  "nm": "baohedu all 3",
  "op": 327,
  "refId": "image_2",
  "sr": 1,
  "st": -8,
  "ty": 2
}
]
}

2 Answers2

1

You can print the video information in a json file using below command

    ffprobe -v quiet -print_format json -show_format -show_streams "input.mp4" >output.json

you can see the sample output from this link let me know if you have anything to know more

0

Use ffprobe with -print_format json and > to redirect output to a file:

ffprobe -v quiet -print_format json -show_format -show_streams "video.mp4" > ffprobe_output.json

Note that > is a a Linux program, not a function of ffprobe.

drake7
  • 952
  • 7
  • 20