Closed luziferius closed 1 year ago
You are absolutely right. I have only discovered that this was possible a few days ago and planned to implement it in the next roll of vdhcoapp (which i don't want to update too often as this is an inconvenience to users).
Fixed in master.
The block starting here https://github.com/mi-g/vdhcoapp/blob/9989b1ada04d3e51135ae2b5de6a42786e97abc4/app/converter.js#L127 looks like you are misusing the ffprobe command line interface. If I understand that block, you are parsing the standard error channel output of ffprobe. Instead, you should tell ffprobe what it should output. You can then change the output format to a more javascript friendly json format. My ffprobe installation supports these show options:
of which
show_format
andshow_streams
should be the most useful in this context. As a demonstration, run this command on your system:ffprobe -loglevel error -print_format json -show_format -show_streams </path/to/video/file.mp4>
replacing the path with a test video on your system. ffprobe then outputs your requested data on the standard output and only (real) errors during the file scan on the standard error channel. The returned json data should be directly loadable into a javascript program and spares you the manual parsing. Sample output from a video file downloaded from youtube running the ffprobe command from above:Sample output(click to expand):
```js { "streams": [ { "index": 0, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "High", "codec_type": "video", "codec_time_base": "1/50", "codec_tag_string": "avc1", "codec_tag": "0x31637661", "width": 1280, "height": 720, "coded_width": 1280, "coded_height": 720, "has_b_frames": 0, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 31, "chroma_location": "left", "refs": 1, "is_avc": "true", "nal_length_size": "4", "r_frame_rate": "25/1", "avg_frame_rate": "25/1", "time_base": "1/25", "start_pts": 0, "start_time": "0.000000", "duration_ts": 6400, "duration": "256.000000", "bit_rate": "1088421", "bits_per_raw_sample": "8", "nb_frames": "6400", "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 }, "tags": { "language": "und", "handler_name": "VideoHandler" } }, { "index": 1, "codec_name": "aac", "codec_long_name": "AAC (Advanced Audio Coding)", "profile": "LC", "codec_type": "audio", "codec_time_base": "1/44100", "codec_tag_string": "mp4a", "codec_tag": "0x6134706d", "sample_fmt": "fltp", "sample_rate": "44100", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/44100", "start_pts": 0, "start_time": "0.000000", "duration_ts": 11290624, "duration": "256.023220", "bit_rate": "191999", "max_bit_rate": "202840", "nb_frames": "11026", "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0 }, "tags": { "creation_time": "2014-08-19T02:57:25.000000Z", "language": "und", "handler_name": "IsoMedia File Produced by Google, 5-11-2011" } } ], "format": { "filename": "Videos/Kool_Savas_Matrix_Official_HD_Video_2014.mp4", "nb_streams": 2, "nb_programs": 0, "format_name": "mov,mp4,m4a,3gp,3g2,mj2", "format_long_name": "QuickTime / MOV", "start_time": "0.000000", "duration": "256.021667", "size": "41054405", "bit_rate": "1282841", "probe_score": 100, "tags": { "major_brand": "mp42", "minor_version": "0", "compatible_brands": "isommp42", "creation_time": "2014-08-19T02:57:23.000000Z" } } } ```