我有一个服务器,里面有电影/节目可以自动添加和转换。问题是大多数以 mkv 开头的文件在 Xbox 上都无法播放(特别是在我的网站上的 Edge 浏览器上播放)。我对转换文件不太了解,所以在尝试了我在谷歌上找到的所有组合后,我不知道该怎么做。
我该怎么做才能使它们全部正常工作?
首先,你可以想象,搜索包含关键字的任何内容Xbox
并获得有用的信息非常困难。但是,我发现这篇文章似乎显示了支持的文件类型。我不知道 edge 是否有略微不同的要求:
https://www.ign.com/wikis/xbox-one/Supported_File_Types
列出的文件类型之一是mpeg 4 h264 aac
我一直尝试将电影转换为但仍无法播放的文件类型。
我尝试过的一些命令:
< /dev/null ffmpeg -n -i "$i" -c:v libx264 -c:a aac -movflags +faststart -vf format=yuv420p "${name}.mp4" -hide_banner;
< /dev/null ffmpeg -i "$i" -f mp4 -vcodec libx264 -preset fast -profile:v main -c:a aac "${name}.mp4" -hide_banner;
ffmpeg -i "$i" -f mp4 -vcodec libx264 -preset fast -profile:v main -c:a aac "${name}.mp4" -hide_banner;
ffmpeg -i "$i" -f mp4 -vcodec libx264 -preset fast -profile:v main -c:v libx264 -c:a aac "${name}.mp4" -hide_banner;
ffmpeg -i "$i" -codec copy "${name}.mp4";
和更多...
希望有用的文件信息:MKV:
ffprobe -loglevel error -show_entries stream=codec_name -of default=nw=1 /var/www/html/uploads/Videos/TV/'Silicon Valley'/'Season 1'/S01E01*.mkv;
codec_name=h264
codec_name=dts
转换后的 MP4 不起作用:
ffprobe -loglevel error -show_entries stream=codec_name -of default=nw=1 /var/www/html/uploads/Videos/TV/'Silicon Valley'/'Season 1'/S01E01*.mp4; codec_name=h264
codec_name=aac
codec_name=bin_data
工作MP4:
ffprobe -loglevel error -show_entries stream=codec_name -of default=nw=1 /var/www/html/uploads/Videos/TV/'Rick and Morty'/'Season 4'/*S04E03*.mp4;
codec_name=h264
codec_name=aac
到目前为止我能看出的唯一区别是 bin-data 编解码器。但我不知道为什么它在一个上有而在另一个上没有。
非工作 mkv-mp4 上的转换日志:
# for i in /var/www/html/uploads/Videos/TV/'Silicon Valley'/'Season 1'/S01E01*.mkv;
> do name=$(echo "${i//.mkv/}");
> echo "$name";
> < /dev/null ffmpeg -n -i "$i" -c:v libx264 -c:a aac -movflags +faststart -vf format=yuv420p "${name}.mp4" -hide_banner;
> done
/var/www/html/uploads/Videos/TV/Silicon Valley/Season 1/S01E01 - Minimum Viable Product Bluray-1080p
Input #0, matroska,webm, from '/var/www/html/uploads/Videos/TV/Silicon Valley/Season 1/S01E01 - Minimum Viable Product Bluray-1080p.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.0
creation_time : 2015-03-13T05:58:12.000000Z
Duration: 00:29:21.39, start: 0.000000, bitrate: 10636 kb/s
Chapter #0:0: start 0.000000, end 182.432000
Metadata:
title : 00:00:00.000
Chapter #0:1: start 182.432000, end 504.838000
Metadata:
title : 00:03:02.432
Chapter #0:2: start 504.838000, end 913.329000
Metadata:
title : 00:08:24.838
Chapter #0:3: start 913.329000, end 1236.110000
Metadata:
title : 00:15:13.329
Chapter #0:4: start 1236.110000, end 1691.523000
Metadata:
title : 00:20:36.110
Chapter #0:5: start 1691.523000, end 1761.387000
Metadata:
title : 00:28:11.523
Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (dts (dca) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x561f95f4b5c0] Using a PCE to encode channel layout "5.1(side)"
[libx264 @ 0x561f95e9fbc0] using SAR=1/1
[libx264 @ 0x561f95e9fbc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x561f95e9fbc0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x561f95e9fbc0] 264 - core 157 r2980 34c06d1 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=34 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/www/html/uploads/Videos/TV/Silicon Valley/Season 1/S01E01 - Minimum Viable Product Bluray-1080p.mp4':
Metadata:
encoder : Lavf58.29.100
Chapter #0:0: start 0.000000, end 182.432000
Metadata:
title : 00:00:00.000
Chapter #0:1: start 182.432000, end 504.838000
Metadata:
title : 00:03:02.432
Chapter #0:2: start 504.838000, end 913.329000
Metadata:
title : 00:08:24.838
Chapter #0:3: start 913.329000, end 1236.110000
Metadata:
title : 00:15:13.329
Chapter #0:4: start 1236.110000, end 1691.523000
Metadata:
title : 00:20:36.110
Chapter #0:5: start 1691.523000, end 1761.387000
Metadata:
title : 00:28:11.523
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 13978 tbn, 23.98 tbc (default)
Metadata:
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1(side), fltp, 394 kb/s (default)
Metadata:
encoder : Lavc58.54.100 aac
frame= 41 fps=0.0 q=0.0 size= 0kB time=00:00:02.34 bitrate= 0.7kbits/s speed=4.68x frame= 58 fps= 58 q=0.0 size= 0kB time=00:00:03.05 bitrate= 0.5kbits/s speed=3.05x frame= 74 fps= 47 q=0.0 size= 0kB time=00:00:03.73
--SNIPPED TOO LONG--
bitrate=3985.6kbits/s speed=2.25xframe=42207 fps= 54 q=28.0 size= 856576kB time=00:29:21.10 bitrate=3984.5kbits/s speed=2.25x[matroska,webm @ 0x561f95e78580] File extends beyond end of segment.
frame=42224 fps= 54 q=28.0 size= 856832kB time=00:29:21.34 bitrate=3985.1kbits/s speed=2.25x[mp4 @ 0x561f95ea1040] Starting second pass: moving the moov atom to the beginning of the file
frame=42230 fps= 54 q=-1.0 Lsize= 863321kB time=00:29:21.38 bitrate=4015.2kbits/s speed=2.24x
video:776974kB audio:84842kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.174605%
[libx264 @ 0x561f95e9fbc0] frame I:466 Avg QP:19.32 size:207180
[libx264 @ 0x561f95e9fbc0] frame P:11673 Avg QP:21.92 size: 35007
[libx264 @ 0x561f95e9fbc0] frame B:30091 Avg QP:23.52 size: 9652
[libx264 @ 0x561f95e9fbc0] consecutive B-frames: 2.8% 4.8% 5.2% 87.2%
[libx264 @ 0x561f95e9fbc0] mb I I16..4: 9.2% 89.1% 1.7%
[libx264 @ 0x561f95e9fbc0] mb P I16..4: 2.7% 8.7% 0.5% P16..4: 49.0% 9.5% 7.1% 0.0% 0.0% skip:22.6%
[libx264 @ 0x561f95e9fbc0] mb B I16..4: 0.2% 1.0% 0.0% B16..8: 37.4% 1.6% 0.2% direct: 2.4% skip:57.2% L0:44.7% L1:52.2% BI: 3.0%
[libx264 @ 0x561f95e9fbc0] 8x8 transform intra:77.9% inter:91.0%
[libx264 @ 0x561f95e9fbc0] coded y,uvDC,uvAC intra: 56.8% 83.6% 51.8% inter: 9.8% 25.7% 2.8%
[libx264 @ 0x561f95e9fbc0] i16 v,h,dc,p: 41% 19% 10% 31%
[libx264 @ 0x561f95e9fbc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 14% 35% 4% 5% 6% 5% 6% 5%
[libx264 @ 0x561f95e9fbc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 16% 13% 5% 9% 9% 8% 6% 5%
[libx264 @ 0x561f95e9fbc0] i8c dc,h,v,p: 59% 16% 19% 6%
[libx264 @ 0x561f95e9fbc0] Weighted P-Frames: Y:1.1% UV:0.7%
[libx264 @ 0x561f95e9fbc0] ref P L0: 58.5% 11.4% 22.6% 7.4% 0.0%
[libx264 @ 0x561f95e9fbc0] ref B L0: 86.8% 10.7% 2.5%
[libx264 @ 0x561f95e9fbc0] ref B L1: 95.2% 4.8%
[libx264 @ 0x561f95e9fbc0] kb/s:3613.70
[aac @ 0x561f95f4b5c0] Qavg: 284.855
我曾多次认为我成功地从 60 个视频中挑选出一个视频,但后来才意识到我错了。如果有其他方法可以让我获得更好的日志,请告诉我,我会的。
答案1
尝试添加这个
ffmpeg.exe -i “文件名.mkv” -target ntsc-vcd “文件名.MP4”
沒有額外的...
答案2
使用 ffmpeg 将 mkv 转换为 mp4
https://gist.github.com/jamesmacwhite/58aebfe4a82bb8d645a797a1ba975132
“只需将现有的视频和音频流按原样复制到新容器中,没什么好说的”
还请阅读评论
--作者:nickdagamer400,评论于 2018 年 2 月 19 日
(关于 Windows 中的批处理 (.bat) 文件)
对于/R %%f IN (*.mkv) DO ffmpeg -i "%%f" -c copy "%%~nf.mp4"
答案3
首先,我建议获取 mediainfo 来比较工作/非工作文件,这样您就可以看到媒体详细信息。
> mediainfo S01E08.Much\ More.mp4
General
Complete name : S01E08.Much More.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 634 MiB
Duration : 59 min 38 s
Overall bit rate mode : Variable
Overall bit rate : 1 487 kb/s
Movie name : S01E08.Much More
Writing application : Lavf58.35.100
Comment : -filter_complex [0:0]fps=fps=24000/1001[vOut];[0:1]loudnorm=linear=true:measured_I=-22.63:measured_tp=-3.77:measured_LRA=19.00:measured_thresh=-34.34[aOut] -c:v libx264 -crf 21 -preset medium -tune film -maxrate 8m -bufsize 2m -c:a libfdk_aac -b:a 128k -ar 48k -c:s mov_text -metadata:s:s:0 language=eng
LongDescription : No info
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 59 min 38 s
Bit rate : 1 353 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.061
Stream size : 577 MiB (91%)
Writing library : x264 core 158
Encoding settings : cabac=1 / ref=3 / deblock=1:-1:-1 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=22 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 59 min 38 s
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 6 channels
Channel layout : C L R Ls Rs LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 54.6 MiB (9%)
Default : Yes
Alternate group : 1
Text #1
ID : 3
Format : Timed Text
Muxing mode : sbtl
Codec ID : tx3g
Duration : 58 min 38 s
Bit rate mode : Variable
Bit rate : 44 b/s
Stream size : 19.1 KiB (0%)
Language : English
Default : Yes
Forced : No
Alternate group : 3
Text #2
ID : 4
Format : Timed Text
Muxing mode : sbtl
Codec ID : tx3g
Duration : 58 min 38 s
Bit rate mode : Variable
Bit rate : 56 b/s
Stream size : 24.0 KiB (0%)
Title : SDH
Language : English
Default : No
Forced : No
Alternate group : 3
比较用于工作文件的编解码器和配置文件。
检查输入文件流并仅映射您真正关心的流(视频/音频(以您的语言)/字幕?)
> ffprobe S01E08.Much\ More.mp4 2>&1 |grep Stream
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1353 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 128 kb/s (default)
Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
Stream #0:3(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
然后构建你的 ffmpeg 命令:
> ffmpeg -y -i "S01E08.Much More.mkv" \
-c:v libx264 -crf 21 -preset medium -tune film -maxrate 8m -bufsize 2m -map 0:0 \
-c:a libfdk_aac -b:a 128k -ar 48k -map 0:1 \
-c:s mov_text -metadata:s:s:0 language=eng -map 0:3 \
"S01E08.Much More.mp4"
我不确定您是否需要 -movflags 或 -faststart,它们用于在传输过程中开始播放流视频。