將 mp4 檔案轉換為 y4m 並保留音訊串流

將 mp4 檔案轉換為 y4m 並保留音訊串流

我正在嘗試將 mp4 檔案轉換為 y4m 以便與 Chrome 一起用作 webrtc 假裝置。 (使用 --use-file-for-fake-video-capture=path/to/file.y4m 所述https://webrtc.org/testing/

我在用著

ffmpeg -i myfile.mp4 -pix_fmt yuv420p myfile.y4m

視訊轉換確實有效,但產生的檔案沒有音訊串流。這是 ffmpeg 的完整輸出:

ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'myfile.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
  Duration: 00:00:19.73, start: 0.000000, bitrate: 542 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x480, 342 kb/s, 29.97 fps, 29.97 tbr, 29970 tbn, 59940 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 195 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File 'myfile.y4m' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
Output #0, yuv4mpegpipe, to 'myfile.y4m':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    encoder         : Lavf58.20.100
    Stream #0:0(und): Video: wrapped_avframe, yuv420p, 640x480, q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.35.100 wrapped_avframe
frame=  593 fps=0.0 q=-0.0 Lsize=  266854kB time=00:00:19.78 bitrate=110482.9kbits/s speed=  30x    
video:310kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 85871.289062%

看起來我缺少一些映射音訊串流的選項或將音訊串流添加回 y4m 檔案的某些步驟,但在嘗試了幾次開關後我仍然無法正常工作。

有人對如何進行這項工作有任何建議嗎?

相關內容