HLS-ffmpeg失败,无法为输出文件#0写入标头(编解码器参数不正确?):没有此类文件或目录

时间:2019-05-11 12:07:30

标签: video ffmpeg video-streaming hls m3u8

几天以来,我一直在努力解决这个问题。 我尝试转换mkv电影,当ffmpeg尝试写入* .ts文件时失败,并显示此错误。 我已经在许多主机(Mac,CentOS,Unraid)上尝试了相同的命令,但是结果是相同的。这里的命令:

$ ffmpeg -i MYMOVIE\ FRENCH\ HDLight\ 1080p\ x264\ AC3.mkv -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -c:a aac -ar 48000 -b:a 128k -c:v h264 -profile:v main -crf 20 -g 48 -keyint_min 48 -sc_threshold 0 -b:v 2500k -maxrate 2675k -bufsize 3750k -hls_time 4 -hls_playlist_type vod -hls_segment_filename mymovie/720p_%03d.ts mymovie/720p.m3u8

请在下面找到ffmpeg命令的整个输出:

ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, matroska,webm, from 'MYMOVIE FRENCH HDLight 1080p x264 AC3.mkv':
  Metadata:
    title           : ˜”*°• Wita •°*”˜
    encoder         : libebml v1.3.3 + libmatroska v1.4.4
    creation_time   : 2016-01-18T20:04:46.000000Z
  Duration: 02:28:06.88, start: 0.000000, bitrate: 3276 kb/s
    Chapter #0:0: start 0.000000, end 369.119000
    Metadata:
      title           : 00:00:00.000
    Chapter #0:1: start 369.119000, end 784.784000
    Metadata:
      title           : 00:06:09.119
    Chapter #0:2: start 784.784000, end 1138.471000
    Metadata:
      title           : 00:13:04.784
    Chapter #0:3: start 1138.471000, end 1486.777000
    Metadata:
      title           : 00:18:58.471
    Chapter #0:4: start 1486.777000, end 1684.057000
    Metadata:
      title           : 00:24:46.777
    Chapter #0:5: start 1684.057000, end 1935.559000
    Metadata:
      title           : 00:28:04.057
    Chapter #0:6: start 1935.559000, end 2218.591000
    Metadata:
      title           : 00:32:15.559
    Chapter #0:7: start 2218.591000, end 2516.639000
    Metadata:
      title           : 00:36:58.591
    Chapter #0:8: start 2516.639000, end 2773.145000
    Metadata:
      title           : 00:41:56.639
    Chapter #0:9: start 2773.145000, end 3051.924000
    Metadata:
      title           : 00:46:13.145
    Chapter #0:10: start 3051.924000, end 3223.220000
    Metadata:
      title           : 00:50:51.924
    Chapter #0:11: start 3223.220000, end 3621.368000
    Metadata:
      title           : 00:53:43.220
    Chapter #0:12: start 3621.368000, end 4008.213000
    Metadata:
      title           : 01:00:21.368
    Chapter #0:13: start 4008.213000, end 4258.963000
    Metadata:
      title           : 01:06:48.213
    Chapter #0:14: start 4258.963000, end 4514.093000
    Metadata:
      title           : 01:10:58.963
    Chapter #0:15: start 4514.093000, end 4735.648000
    Metadata:
      title           : 01:15:14.093
    Chapter #0:16: start 4735.648000, end 5171.041000
    Metadata:
      title           : 01:18:55.648
    Chapter #0:17: start 5171.041000, end 5380.000000
    Metadata:
      title           : 01:26:11.041
    Chapter #0:18: start 5380.000000, end 5803.548000
    Metadata:
      title           : 01:29:40.000
    Chapter #0:19: start 5803.548000, end 6104.390000
    Metadata:
      title           : 01:36:43.548
    Chapter #0:20: start 6104.390000, end 6546.415000
    Metadata:
      title           : 01:41:44.390
    Chapter #0:21: start 6546.415000, end 6952.821000
    Metadata:
      title           : 01:49:06.415
    Chapter #0:22: start 6952.821000, end 7179.214000
    Metadata:
      title           : 01:55:52.821
    Chapter #0:23: start 7179.214000, end 7459.744000
    Metadata:
      title           : 01:59:39.214
    Chapter #0:24: start 7459.744000, end 7768.511000
    Metadata:
      title           : 02:04:19.744
    Chapter #0:25: start 7768.511000, end 8045.663000
    Metadata:
      title           : 02:09:28.511
    Chapter #0:26: start 8045.663000, end 8382.374000
    Metadata:
      title           : 02:14:05.663
    Chapter #0:27: start 8382.374000, end 8886.880000
    Metadata:
      title           : 02:19:42.374
    Stream #0:0(fre): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default) (forced)
    Metadata:
      title           : AC3 Fr
      BPS             : 448000
      BPS-eng         : 448000
      DURATION        : 02:28:06.880000000
      DURATION-eng    : 02:28:06.880000000
      NUMBER_OF_FRAMES: 277715
      NUMBER_OF_FRAMES-eng: 277715
      NUMBER_OF_BYTES : 497665280
      NUMBER_OF_BYTES-eng: 497665280
      _STATISTICS_WRITING_APP: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-01-18 20:04:46
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-18 20:04:46
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(fre): Subtitle: subrip (default) (forced)
    Metadata:
      title           : FR Forcé
      BPS             : 1
      BPS-eng         : 1
      DURATION        : 02:27:01.396000000
      DURATION-eng    : 02:27:01.396000000
      NUMBER_OF_FRAMES: 53
      NUMBER_OF_FRAMES-eng: 53
      NUMBER_OF_BYTES : 1254
      NUMBER_OF_BYTES-eng: 1254
      _STATISTICS_WRITING_APP: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-01-18 20:04:46
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-18 20:04:46
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(fre): Video: h264 (High), yuv420p(progressive), 1920x808 [SAR 1:1 DAR 240:101], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default) (forced)
    Metadata:
      title           : ˜”*°• Wita •°*”˜
      BPS             : 2826414
      BPS-eng         : 2826414
      DURATION        : 02:28:06.837000000
      DURATION-eng    : 02:28:06.837000000
      NUMBER_OF_FRAMES: 213071
      NUMBER_OF_FRAMES-eng: 213071
      NUMBER_OF_BYTES : 3139735201
      NUMBER_OF_BYTES-eng: 3139735201
      _STATISTICS_WRITING_APP: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v8.8.0 ('Wind at my back') 64bit
      _STATISTICS_WRITING_DATE_UTC: 2016-01-18 20:04:46
      _STATISTICS_WRITING_DATE_UTC-eng: 2016-01-18 20:04:46
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:2 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (ac3 (native) -> aac (native))
  Stream #0:1 -> #0:2 (subrip (srt) -> webvtt (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f967102da00] using SAR=1/1
[libx264 @ 0x7f967102da00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f967102da00] profile Main, level 4.0
[hls @ 0x7f9671037200] Opening 'mymovie/720p_000.ts' for writing
Could not write header for output file #0 (incorrect codec parameters ?): No such file or directory
Error initializing output stream 0:0 -- 
[aac @ 0x7f967102f200] Qavg: 27242.438
[aac @ 0x7f967102f200] 2 frames left in the queue on closing
Conversion failed!

可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

我的错!我错过了创建输出目录mymovie的机会。现在问题已经解决。感谢您的帮助和关注。