使用 ffmpeg 修复 HLS 下载的视频

使用 ffmpeg 修复 HLS 下载的视频

我从流(HLS)下载了一个视频并把它转换成 mp4 文件。

默认的 Windows 10 照片应用程序可以毫无问题地播放视频。但“Midia Player Classic”和“VLC Player”无法播放。

我正在尝试使用 ffmpeg 转换视频,以便在平板电脑上为我的孩子播放。

以下是 ffmpeg 的输出

我尝试指定源格式、编解码器和速率,但没有成功。我还尝试指定视频的时长,但没有成功。有人能帮我吗?

转换输出

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x56121fa2dd80] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x316376  61), none, 1280x720, 3037 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '12e01 Primo Ludovico.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomiso2avc1mp41mp42
  Duration: 00:28:33.33, start: 0.000000, bitrate: 3170 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 3037 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97   tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : dailymotion/hls.js
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
**Cannot determine format of input stream 0:0 after EOF**4:32:22.77 bitrate=  -0.0kbits/s speed=N/A
Error marking filters as finished
[aac @ 0x56121fa58f80] Qavg: 216.471
[aac @ 0x56121fa58f80] 2 frames left in the queue on closing
Conversion failed!

视频信息:

    root@atom:~# ffmpeg -i video.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x561b8b0f2840] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 3037 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '12e01 Primo Ludovico.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomiso2avc1mp41mp42
  Duration: 00:28:33.33, start: 0.000000, bitrate: 3170 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 3037 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : dailymotion/hls.js
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

尝试按照@Gyan 的建议增加探测(结果:只有音频)

root@atom:~# ffmpeg -probesize 50M -analyzeduration 50M -y -i video.mp4 -c copy new.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55ab30d17a00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 3037 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomiso2avc1mp41mp42
  Duration: 00:28:33.33, start: 0.000000, bitrate: 3170 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 3037 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : dailymotion/hls.js
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, mp4, to 'new.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isomiso2avc1mp41mp42
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3037 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : dailymotion/hls.js
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    0 fps=0.0 q=-1.0 Lsize=   27060kB time=00:28:33.30 bitrate= 129.4kbits/s speed= 545x
video:0kB audio:26771kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.080556%

相关内容