我使用服务器在Android手机上流式传输记录器视频,并稍后在Android应用中播放。但是我注意到我无法播放所有视频,我使用ffmpeg查看录制的视频是否存在任何差异以及问题可能出在哪里。 那是加载和播放视频的示例:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'w1.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2019-01-07T15:38:52.000000Z
com.android.version: 8.1.0
Duration: 00:00:04.94, start: 0.000000, bitrate: 5003 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 720x480, 4951 kb/s, SAR 1:1 DAR 3:2, 27.71 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2019-01-07T15:38:52.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 48 kb/s (default)
Metadata:
creation_time : 2019-01-07T15:38:52.000000Z
handler_name : SoundHandle
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Baseline",
"codec_type": "video",
"codec_time_base": "444929/24660000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 720,
"height": 480,
"coded_width": 720,
"coded_height": 480,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "3:2",
"pix_fmt": "yuv420p",
"level": 30,
"color_range": "tv",
"color_space": "smpte170m",
"color_transfer": "smpte170m",
"color_primaries": "bt470bg",
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "30/1",
"avg_frame_rate": "12330000/444929",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 444929,
"duration": "4.943656",
"bit_rate": "4951506",
"bits_per_raw_sample": "8",
"nb_frames": "137",
"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": {
"rotate": "90",
"creation_time": "2019-01-07T15:38:52.000000Z",
"language": "eng",
"handler_name": "VideoHandle"
},
"side_data_list": [
{
"side_data_type": "Display Matrix",
"displaymatrix": "\n00000000: 0 65536 0\n00000001: -65536 0 0\n00000002: 0 0 1073741824\n",
"rotation": -90
}
]
}
]
}
接下来是无法正常播放视频的示例:
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001ea0adcd700] sample aspect ratio already set to 1:1, ignoring 'pasp' atom (65536:65536)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'notworking.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-12-30T14:20:23.000000Z
com.android.version: 7.0
Duration: 00:00:10.16, start: 0.000000, bitrate: 5240 kb/s
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/smpte170m), 720x480, 5223 kb/s, SAR 1:1 DAR 3:2, 29.30 fps, 59.94 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2018-12-30T14:20:23.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 12 kb/s (default)
Metadata:
creation_time : 2018-12-30T14:20:23.000000Z
handler_name : SoundHandle
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Baseline",
"codec_type": "video",
"codec_time_base": "20751/1216000",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 720,
"height": 480,
"coded_width": 720,
"coded_height": 480,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "3:2",
"pix_fmt": "yuv420p",
"level": 30,
"color_range": "tv",
"color_space": "smpte170m",
"color_transfer": "smpte170m",
"color_primaries": "bt470bg",
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "60000/1001",
"avg_frame_rate": "608000/20751",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 914271,
"duration": "10.158567",
"bit_rate": "5223363",
"bits_per_raw_sample": "8",
"nb_frames": "304",
"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": {
"rotate": "90",
"creation_time": "2018-12-30T14:20:23.000000Z",
"language": "eng",
"handler_name": "VideoHandle"
},
"side_data_list": [
{
"side_data_type": "Display Matrix",
"displaymatrix": "\n00000000: 0 65536 0\n00000001: -65536 0 0\n00000002: 0 0 1073741824\n",
"rotation": -90
}
]
}
]
}
我看不到视频特征的任何差异。两者都是基线H.264。 当我通过直接链接访问它们时,两个视频都在Chrome中播放,问题出在Android版本6、7、8上。 发生了一件奇怪的事情,因为当我下载该文件时,它不直接加载视频,而是将android应用程序放到原始文件夹中,然后直接播放,一切正常。 我检查了问题是否出在带宽上,所以我上传了更大的视频,约12Mbs,mp4以及H.264 Main,然后将其流式传输到应用程序中,并且看起来很吸引人。因此,我怀疑问题可能出在我的android应用中记录更大的文件。 要流式传输视频,我仅使用MediaPlayer。
这是我上传并随后流式传输的视频的示例:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '123456.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-01-30T06:50:54.000000Z
Duration: 00:02:29.16, start: 0.000000, bitrate: 700 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 571 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
creation_time : 2018-01-30T06:50:54.000000Z
handler_name : ISO Media file. Created on: 01/29/2018.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
creation_time : 2018-01-30T06:50:54.000000Z
handler_name : ISO Media file. Created on: 01/29/2018.
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Main",
"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": 1,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuv420p",
"level": 31,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"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/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 13424400,
"duration": "149.160000",
"bit_rate": "571258",
"bits_per_raw_sample": "8",
"nb_frames": "3729",
"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": "2018-01-30T06:50:54.000000Z",
"language": "und",
"handler_name": "ISO Media file. Created on: 01/29/2018."
}
}
]
}
Is there any chance that my hosting provider uses some kind of software that can manipulate data that is on the server?
我还通过在代码中手动插入链接来手动检查来自不同网站的其他视频,以检查MediaPlayer是否正常工作以及每个视频都在播放。