首页 > 解决方案 > 以单一 mp4 格式复制 m3u8 段文件

问题描述

嗨,我使用以下命令将 m3u8 段文件复制到单个 mp4 文件: 我在 c#类
上运行此命令。Process

    -y -i "D:\OtherProjects\ConvertProj\video\2018\4\1\m3u8\200p\out.m3u8"  
    -y -i "D:\OtherProjects\ConvertProj\video\2018\4\1\m3u8\360p\out.m3u8"  
    -y -i "D:\OtherProjects\ConvertProj\video\2018\4\1\m3u8\480p\out.m3u8"  
    -y -i "D:\OtherProjects\ConvertProj\video\2018\4\1\m3u8\720p\out.m3u8" 
-map 0 -c:v copy -c:a copy -threads 0 "D:\OtherProjects\ConvertProj\video\2018\4\1\1-200.mp4" 
-map 1 -c:v copy -c:a copy -threads 0 "D:\OtherProjects\ConvertProj\video\2018\4\1\1-360.mp4" 
-map 2 -c:v copy -c:a copy -threads 0 "D:\OtherProjects\ConvertProj\video\2018\4\1\1-480.mp4" 
-map 3 -c:v copy -c:a copy -threads 0 "D:\OtherProjects\ConvertProj\video\2018\4\1\1.mp4" 

我得到这个错误:

[hls,applehttp @ 00000000047e3400] Failed to open segment of playlist 0
    Last message repeated 353 times
[hls,applehttp @ 00000000047e3400] Error when loading first segment 'out0.ts'
D:\OtherProjects\ConvertProj\video\2018\4\6208-3905956\m3u8\200p\out.m3u8: Invalid data found when processing input

问题是什么?我必须做什么?这是一个错误吗?

标签: c#asp.netffmpeg

解决方案


我在下面的新命令中以这种方式更改了输入和输出的寻址作为ffmpeg的路径:

-y -i "../video/2018/4/1/m3u8/200p/out.m3u8"  
-y -i "../video/2018/4/1/m3u8/360p/out.m3u8"  
-y -i "../video/2018/4/1/m3u8/480p/out.m3u8"  
-y -i "../video/2018/4/1/m3u8/720p/out.m3u8" 
-map 0 -c:v copy -c:a copy -threads 0 "../video/2018/4/1/1-200.mp4" 
-map 1 -c:v copy -c:a copy -threads 0 "../video/2018/4/1/1-360.mp4" 
-map 2 -c:v copy -c:a copy -threads 0 "../video/2018/4/1/1-480.mp4" 
-map 3 -c:v copy -c:a copy -threads 0 "../video/2018/4/1/1.mp4"

我设置了ffmpeg 不存在的 c# 进程类的/video/路径。WorkingDirectory


推荐阅读