gpt4 book ai didi

ffmpeg - 当 ffprobe 找不到流的编解码器参数时如何获取 xml/json 输出

转载 作者:行者123 更新时间:2023-12-03 23:53:40 26 4
gpt4 key购买 nike

我在 mkv 文件上使用 ffprobe 以获取有关章节结构的一些信息,以便使用 ffmpeg 拆分 mkv。

ffprobe miku.mkv -print_format xml

但是 ffprobe 遇到了 scodec 错误(不影响章节信息),我无法通过设置打印格式获取信息。我知道有类似管道的方法可以绕过错误,但我仍然想获取 xml/json 文件以便可以轻松解析。

我想知道是否有办法导入错误并输出 xml/json 文件,或者是否有解决该错误的方法。 (但我更喜欢前者的解决方案,因为我不知道我可能会遇到什么错误,只要章节信息可用,我想看看它是否有效)

错误是这样的。

ffprobe version N-60899-ga8ad7e4 Copyright (c) 2007-2014 the FFmpeg developers  built on Feb 25 2014 04:04:01 with gcc 4.8.2 (GCC)  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-zlib  libavutil      52. 66.100 / 52. 66.100  libavcodec     55. 52.102 / 55. 52.102  libavformat    55. 33.100 / 55. 33.100  libavdevice    55. 10.100 / 55. 10.100  libavfilter     4.  1.103 /  4.  1.103  libswscale      2.  5.101 /  2.  5.101  libswresample   0. 18.100 /  0. 18.100  libpostproc    52.  3.100 / 52.  3.100[matroska,webm @ 0000000002945080] Could not find codec parameters for stream 3 (Subtitle: hdmv_pgs_subtitle): unspecified sizeConsider increasing the value for the 'analyzeduration' and 'probesize' optionsInput #0, matroska,webm, from '[Hatsune Miku Magical Mirai 2013][JPN][BDRIP][1080P][H264_FLAC_DTS-HDMA].mkv':  Metadata:    encoder         : libebml v1.3.0 + libmatroska v1.4.1    creation_time   : 2014-02-18 22:57:12  Duration: 01:58:00.08, start: 0.000000, bitrate: 16495 kb/s    Chapter #0.0: start 0.000000, end 30.030000    Metadata:      title           : Start    Chapter #0.1: start 30.030000, end 149.749000    Metadata:      title           : 00. Opening Music......

最佳答案

这里是 a link这显示了一个很好的解决方案:

对于 JSON:ffprobe -v quiet -print_format json -show_format -show_streams "lolwut.mp4"> "lolwut.mp4.json"

对于 XML:ffprobe -v quiet -print_format xml -show_format -show_streams "lolwut.mp4"> "lolwut.mp4.xml"

你会得到

{
"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/180000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 932,
"height": 540,
"coded_width": 944,
"coded_height": 544,
"has_b_frames": 2,
"sample_aspect_ratio": "20745:20737",
"display_aspect_ratio": "461:267",
"pix_fmt": "yuv420p",
"level": 31,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"refs": 4,
"is_avc": "1",
"nal_length_size": "4",
"r_frame_rate": "30000/1001",
"avg_frame_rate": "440190000/14687687",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 14687687,
"duration": "163.196522",
"bit_rate": "1501671",
"bits_per_raw_sample": "8",
"nb_frames": "4891",
"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
},
"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/48000",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 7832576,
"duration": "163.178667",
"bit_rate": "157754",
"nb_frames": "7649",
"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
},
"tags": {
"language": "eng",
"handler_name": "Stereo"
}
}
],
"format": {
"filename": "C:\\Users\\danielzhao\\Videos\\mp4_test_files\\science_V-1500kbps_A-160kbps_moov_atom_at_end.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": "163.197000",
"size": "33972120",
"bit_rate": "1665330",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "512",
"compatible_brands": "isomiso2avc1mp41",
"encoder": "HandBrake 0.10.1 2015030800"
}
}
}

<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
<streams>
<stream 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/180000" codec_tag_string="avc1" codec_tag="0x31637661" width="932" height="540" coded_width="944" coded_height="544" has_b_frames="2" sample_aspect_ratio="20745:20737" display_aspect_ratio="461:267" pix_fmt="yuv420p" level="31" color_range="tv" color_space="bt709" color_transfer="bt709" color_primaries="bt709" chroma_location="left" refs="4" is_avc="1" nal_length_size="4" r_frame_rate="30000/1001" avg_frame_rate="440190000/14687687" time_base="1/90000" start_pts="0" start_time="0.000000" duration_ts="14687687" duration="163.196522" bit_rate="1501671" bits_per_raw_sample="8" nb_frames="4891">
<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"/>
<tag key="language" value="und"/>
<tag key="handler_name" value="VideoHandler"/>
</stream>
<stream index="1" codec_name="aac" codec_long_name="AAC (Advanced Audio Coding)" profile="LC" codec_type="audio" codec_time_base="1/48000" codec_tag_string="mp4a" codec_tag="0x6134706d" sample_fmt="fltp" sample_rate="48000" channels="2" channel_layout="stereo" bits_per_sample="0" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/48000" start_pts="0" start_time="0.000000" duration_ts="7832576" duration="163.178667" bit_rate="157754" nb_frames="7649">
<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"/>
<tag key="language" value="eng"/>
<tag key="handler_name" value="Stereo"/>
</stream>
</streams>

<format filename="C:\Users\danielzhao\Videos\mp4_test_files\science_V-1500kbps_A-160kbps_moov_atom_at_end.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="163.197000" size="33972120" bit_rate="1665330" probe_score="100">
<tag key="major_brand" value="mp42"/>
<tag key="minor_version" value="512"/>
<tag key="compatible_brands" value="isomiso2avc1mp41"/>
<tag key="encoder" value="HandBrake 0.10.1 2015030800"/>
</format>
</ffprobe>

关于ffmpeg - 当 ffprobe 找不到流的编解码器参数时如何获取 xml/json 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22012396/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com