Xbox One Edge 브라우저에서 사용할 수 있도록 ffmpeg를 올바르게 사용하여 mkv를 mp4로 변환하는 방법은 무엇입니까?

Xbox One Edge 브라우저에서 사용할 수 있도록 ffmpeg를 올바르게 사용하여 mkv를 mp4로 변환하는 방법은 무엇입니까?

영화/쇼가 추가되고 자동으로 변환되는 서버가 있습니다. 문제는 mkv로 시작하는 대부분의 파일이 Xbox에서 작동하지 않는다는 것입니다(특히 내 웹사이트의 엣지 브라우저에서 재생됨). 저는 파일 변환에 대해 잘 알지 못하기 때문에 Google에서 찾을 수 있는 모든 조합을 시도한 후에 무엇을 해야할지 모르겠습니다.

모두 작동하게 하려면 어떻게 해야 합니까?

상상할 수 있듯이 우선, 키워드가 포함된 항목을 검색 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 "FILENAME.mkv" -target ntsc-vcd "FILENAME.MP4"

엑스트라 없이...

답변2

ffmpeg를 사용하여 mkv를 mp4로 변환

https://gist.github.com/jamesmacwhite/58aebfe4a82bb8d645a797a1ba975132

"기존 비디오 및 오디오 스트림을 그대로 새 컨테이너에 복사하면 됩니다. 재미있는 일이 아닙니다."

댓글도 읽어주세요

--작성자: nickdgamer400이 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가 필요한지 잘 모르겠습니다. 전송 중에 비디오 재생을 시작하기 위해 스트리밍 비디오에 사용됩니다.

관련 정보