使用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是否由于长宽比而失败?
[它可能不喜欢5.1通道布局。试试:
ffmpeg -i not_working.mp4 -c copy -c:a aac -ac 2 -movflags +faststart fixed.mp4