convert mp4 file to y4m keeping audio stream











up vote
0
down vote

favorite












I'm trying to convert an mp4 file into y4m to use with Chrome as a webrtc fake device. (using --use-file-for-fake-video-capture=path/to/file.y4m as described in https://webrtc.org/testing/)



I'm using




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




and the video conversion does work, but the resulting file has no audio stream.
Here's the full output of 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%


Looks like I'm missing some option to map the audio stream or some step to add the audio stream back to the y4m file but after trying several switches I'm still not able to get this working.



Does anybody have any suggestions on how to make this work?










share|improve this question




















  • 1




    You can't. YUV4MPEG is a video-only single-stream container.
    – Gyan
    Dec 2 at 12:23










  • I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
    – slhck
    Dec 2 at 15:07










  • Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
    – user2987504
    Dec 3 at 15:51












  • @slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
    – user2987504
    Dec 3 at 15:51










  • You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
    – Gyan
    Dec 3 at 15:54















up vote
0
down vote

favorite












I'm trying to convert an mp4 file into y4m to use with Chrome as a webrtc fake device. (using --use-file-for-fake-video-capture=path/to/file.y4m as described in https://webrtc.org/testing/)



I'm using




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




and the video conversion does work, but the resulting file has no audio stream.
Here's the full output of 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%


Looks like I'm missing some option to map the audio stream or some step to add the audio stream back to the y4m file but after trying several switches I'm still not able to get this working.



Does anybody have any suggestions on how to make this work?










share|improve this question




















  • 1




    You can't. YUV4MPEG is a video-only single-stream container.
    – Gyan
    Dec 2 at 12:23










  • I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
    – slhck
    Dec 2 at 15:07










  • Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
    – user2987504
    Dec 3 at 15:51












  • @slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
    – user2987504
    Dec 3 at 15:51










  • You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
    – Gyan
    Dec 3 at 15:54













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to convert an mp4 file into y4m to use with Chrome as a webrtc fake device. (using --use-file-for-fake-video-capture=path/to/file.y4m as described in https://webrtc.org/testing/)



I'm using




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




and the video conversion does work, but the resulting file has no audio stream.
Here's the full output of 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%


Looks like I'm missing some option to map the audio stream or some step to add the audio stream back to the y4m file but after trying several switches I'm still not able to get this working.



Does anybody have any suggestions on how to make this work?










share|improve this question















I'm trying to convert an mp4 file into y4m to use with Chrome as a webrtc fake device. (using --use-file-for-fake-video-capture=path/to/file.y4m as described in https://webrtc.org/testing/)



I'm using




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




and the video conversion does work, but the resulting file has no audio stream.
Here's the full output of 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%


Looks like I'm missing some option to map the audio stream or some step to add the audio stream back to the y4m file but after trying several switches I'm still not able to get this working.



Does anybody have any suggestions on how to make this work?







audio video ffmpeg video-conversion






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 3 at 15:50

























asked Dec 2 at 10:54









user2987504

112




112








  • 1




    You can't. YUV4MPEG is a video-only single-stream container.
    – Gyan
    Dec 2 at 12:23










  • I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
    – slhck
    Dec 2 at 15:07










  • Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
    – user2987504
    Dec 3 at 15:51












  • @slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
    – user2987504
    Dec 3 at 15:51










  • You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
    – Gyan
    Dec 3 at 15:54














  • 1




    You can't. YUV4MPEG is a video-only single-stream container.
    – Gyan
    Dec 2 at 12:23










  • I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
    – slhck
    Dec 2 at 15:07










  • Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
    – user2987504
    Dec 3 at 15:51












  • @slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
    – user2987504
    Dec 3 at 15:51










  • You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
    – Gyan
    Dec 3 at 15:54








1




1




You can't. YUV4MPEG is a video-only single-stream container.
– Gyan
Dec 2 at 12:23




You can't. YUV4MPEG is a video-only single-stream container.
– Gyan
Dec 2 at 12:23












I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
– slhck
Dec 2 at 15:07




I think this is a typical [XY problem])(xyproblem.info) – perhaps you can explain more about the "fake device" and what kind of input it requires.
– slhck
Dec 2 at 15:07












Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
– user2987504
Dec 3 at 15:51






Thanks @Gyan, that's probably why. I didn't know about this. Using other y4m files it "looked like" chrome was producing sound (and I assumed that was contained in the y4m file which is probably wrong).
– user2987504
Dec 3 at 15:51














@slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
– user2987504
Dec 3 at 15:51




@slhck I've updated the "fake device" information; it's basically a chrome flag that allows you to use a recording instead of a real webcam for webrtc tests.
– user2987504
Dec 3 at 15:51












You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
– Gyan
Dec 3 at 15:54




You need a separate WAV file for audio. See cs.chromium.org/chromium/src/media/base/…
– Gyan
Dec 3 at 15:54















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380162%2fconvert-mp4-file-to-y4m-keeping-audio-stream%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1380162%2fconvert-mp4-file-to-y4m-keeping-audio-stream%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕