我正在尝试将 mp4 文件转换为 y4m,以便在 Chrome 中用作 webrtc 虚假设备。(使用 --use-file-for-fake-video-capture=path/to/file.y4m,如中所述https://webrtc.org/testing/)
我在用着
ffmpeg -i 我的文件.mp4 -pix_fmt yuv420p 我的文件.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 文件的一些步骤,但尝试了几次开关后我仍然无法让它工作。
有人对如何实现这个功能有什么建议吗?