【发布时间】:2020-09-19 19:03:43
【问题描述】:
使用mkchromecast投射本地mp4文件,有些视频可以,有些不行(如:屏幕挂在蓝色的chromecast标志上,表明初始连接有效)。我可以准确重现here 描述的问题。
所以我决定降低一层,使用pychromecast,并尝试看看当它挂在蓝色徽标上时实际发生了什么。我将两个视频转换为 HLS 格式,并通过 http 服务器公开它们。与mkchromecast 一起使用的视频也适用于我的设置,但是失败的视频,嗯……两者都失败了。使用pychromecast,我得到的信息不多于:
错误,代码 100:MEDIA_UNKNOWN。
来自Cast documentation,这个错误意味着:
媒体元素遇到从平台触发的未知错误。媒体元素遇到了一个错误,该错误并不表明它是 MediaError.MEDIA_ERR_* 之一。这应该很少见。
不过,这对我来说并不罕见。我认为可能失败的视频格式不受支持,如in the documentation 所述。所以我尝试使用以下命令比较两个视频:
ffprobe -v quiet -print_format json -show_streams <video.mp4>
有效的视频:
{
"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": "1001/48000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1920,
"height": 1080,
"coded_width": 1920,
"coded_height": 1088,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 50,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "24000/1001",
"avg_frame_rate": "24000/1001",
"time_base": "1/24000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 47127080,
"duration": "1963.628333",
"bit_rate": "5527977",
"bits_per_raw_sample": "8",
"nb_frames": "47080",
"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/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": 94254528,
"duration": "1963.636000",
"bit_rate": "125776",
"max_bit_rate": "125776",
"nb_frames": "92048",
"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": "SoundHandler"
}
}
]
}
无效的视频:
{
"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": "125/5994",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 1920,
"height": 1040,
"coded_width": 1920,
"coded_height": 1040,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "24:13",
"pix_fmt": "yuv420p",
"level": 41,
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "2997/125",
"avg_frame_rate": "2997/125",
"time_base": "1/11988",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 97032000,
"duration": "8094.094094",
"bit_rate": "2499644",
"bits_per_raw_sample": "8",
"nb_frames": "194064",
"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": "2020-03-27T09:56:39.000000Z",
"language": "und",
"handler_name": "L-SMASH Video Media Handler"
}
},
{
"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": 6,
"channel_layout": "5.1",
"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": 388516320,
"duration": "8094.090000",
"bit_rate": "224000",
"max_bit_rate": "224000",
"nb_frames": "379413",
"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": "2020-03-27T09:56:39.000000Z",
"language": "eng",
"handler_name": "SoundHandler"
}
}
]
}
就我所见,编解码器是相同的,我能做的唯一区别是宽高比。
chromecast 端出现此“MEDIA_UNKNOWN”错误的原因可能是什么?我可以在这两个视频之间进行比较吗?会不会是因为纵横比导致 chromecast 失败?
【问题讨论】:
标签: ffmpeg chromecast