MP4 videos are not including the audios but wmv files are including.
Rajagopalan-M opened this issue · 15 comments
I am trying to include the voice out in your video recording, it's working for wmv files but it's not including the voice for mp4 files. But wmv files are not clear to see on the other hand mp4 videos are very clear to see. I am getting this error
The code I have written
advanced = {log: 'AppData/Logs/recorder.log', f: 'dshow', i: 'audio="virtual-audio-capturer"'}
if noOfThreads.eql? 1
ScreenRecorder.ffmpeg_binary = File.expand_path("VideoRecorder/ffmpeg.exe")
recorder = ScreenRecorder::Window.new(title: ScreenRecorder::Titles.fetch('chrome').last, output: File.expand_path("Output/Video/#{scenario}/#{testCase.first + '_' + testCase[2]}.mp4"), advanced: advanced)
recorder.start
end
What are you using to play the MP4 file? That error is simply complaining that playback of the file is not supported. Please try a different video player, like VLC.
window media player I used and also I used VLC, In the case of VLC, it's not running the video and also it's not even showing any error message. Can you try once recording in your system whether it works for you?
Yeah, I'll give it a try. Meanwhile, can you please share the output from @recorder.video
after stopping the recorder? I am interested in the info (metadata) for the audio track specifically.
Hi, for me .mkv records the audio as well. That satisfy my need. Can you try recording .MP4 ?
@Rajagopalan-M Sorry, haven't had a chance to test a MP4 file on Windows. Can you please use mediainfo
and share the info that it provides for both the MKV and MP4 files. That metadata comparison might be helpful in debugging this.
@Rajagopalan-M I just did an audio capture test with MP4 and it worked for me using 'audio="Microphone (Realtek High Definition Audio)"'
on Windows 10. I notice you are using 'audio="virtual-audio-capturer"'
, but I am not sure what exactly that is. Is it https://github.com/rdp/virtual-audio-capture-grabber-device? And which Windows version are you on?
Note: Please use the Issue template next time so I can have the basic debugging info early on. Otherwise, it just delays the troubleshooting process. Thanks!
@kapoorlakshya Hi, Thanks for replying. I don't want to input audio to record. I want to record the audio which comes out of the speaker. Microphone is to input the audio , yes?
@Rajagopalan-M Yes, I understand that. I'm just saying that audio recording (with any input source) is working with MP4 files for me. I am not sure what's wrong with your setup which is causing only MP4 files to not have audio.
Please read through my comment(s) and answer the questions I have asked you so I can better reproduce and troubleshoot this issue.
Hi, You asked me the details of recorder.video
, Here it is for .mkv. I will post the one for MP4 next.
#<FFMPEG::Movie:0x05e499b8 @path="C:/A/RubyAutomation_POM_VoiceVideo/Output/Video/TS1-PolicyCreation/Contactcreation_Test1.mkv", @metadata={:streams=>[{:index=>0, :codec_name=>"h264", :codec_long_name=>"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", :profile=>"High", :codec_type=>"video", :codec_time_base=>"1001/60000", :codec_tag_string=>"[0][0][0][0]", :codec_tag=>"0x0000", :width=>1366, :height=>736, :coded_width=>1376, :coded_height=>736, :has_b_frames=>2, :pix_fmt=>"yuv420p", :level=>32, :chroma_location=>"left", :field_order=>"progressive", :refs=>1, :is_avc=>"true", :nal_length_size=>"4", :r_frame_rate=>"30000/1001", :avg_frame_rate=>"30000/1001", :time_base=>"1/1000", :start_pts=>0, :start_time=>"0.000000", :bits_per_raw_sample=>"8", :disposition=>{:default=>1, :dub=>0, :original=>0, :comment=>0, :lyrics=>0, :karaoke=>0, :forced=>0, :hearing_impaired=>0, :visual_impaired=>0, :clean_effects=>0, :attached_pic=>0, :timed_thumbnails=>0}, :tags=>{:ENCODER=>"Lavc58.101.101 libx264", :DURATION=>"00:00:34.003000000"}}, {:index=>1, :codec_name=>"vorbis", :codec_long_name=>"Vorbis", :codec_type=>"audio", :codec_time_base=>"1/44100", :codec_tag_string=>"[0][0][0][0]", :codec_tag=>"0x0000", :sample_fmt=>"fltp", :sample_rate=>"44100", :channels=>2, :channel_layout=>"stereo", :bits_per_sample=>0, :r_frame_rate=>"0/0", :avg_frame_rate=>"0/0", :time_base=>"1/1000", :start_pts=>0, :start_time=>"0.000000", :disposition=>{:default=>1, :dub=>0, :original=>0, :comment=>0, :lyrics=>0, :karaoke=>0, :forced=>0, :hearing_impaired=>0, :visual_impaired=>0, :clean_effects=>0, :attached_pic=>0, :timed_thumbnails=>0}, :tags=>{:ENCODER=>"Lavc58.101.101 libvorbis", :DURATION=>"00:00:32.303000000"}}], :format=>{:filename=>"C:/A/RubyAutomation_POM_VoiceVideo/Output/Video/TS1-PolicyCreation/Contactcreation_Test1.mkv", :nb_streams=>2, :nb_programs=>0, :format_name=>"matroska,webm", :format_long_name=>"Matroska / WebM", :start_time=>"0.000000", :duration=>"34.003000", :size=>"729410", :bit_rate=>"171610", :probe_score=>100, :tags=>{:ENCODER=>"Lavf58.51.101"}}}, @container="matroska,webm", @duration=34.003, @time=0.0, @format_tags={:ENCODER=>"Lavf58.51.101"}, @creation_time=nil, @bitrate=171610, @video_codec="h264", @ColorSpace="yuv420p", @width=1366, @height=736, @video_bitrate=0, @sar=nil, @Dar=nil, @frame_rate=(30000/1001), @video_stream="h264 (High) ([0][0][0][0] / 0x0000), yuv420p, 1366x736 [SAR DAR ]", @rotation=nil, @audio_streams=[{:index=>1, :channels=>2, :codec_name=>"vorbis", :sample_rate=>44100, :bitrate=>0, :channel_layout=>"stereo", :tags=>nil, :overview=>"vorbis ([0][0][0][0] / 0x0000), 44100 Hz, stereo, fltp, bit/s"}], @audio_channels=2, @audio_codec="vorbis", @audio_sample_rate=44100, @audio_bitrate=0, @audio_channel_layout="stereo", @audio_tags=nil, @audio_stream="vorbis ([0][0][0][0] / 0x0000), 44100 Hz, stereo, fltp, bit/s"
Hi, here is the video for MP4. But wanted to tell you, now video is running properly with voice. I think that day I haven't closed the video properly. But you asked me about virtual-audio-capturer
, I actually ran your comment ffmpeg -list_devices true -f dshow -i dummy
so it displays the following, from that list which got displayed, I picked up virtual-audio-capturer
. May I know what you are using instead of virtual-audio-capturer to capture the audio?
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
[dshow @ 000001c148079280] DirectShow video devices (some may be both video and audio devices)
[dshow @ 000001c148079280] "Integrated Camera"
[dshow @ 000001c148079280] Alternative name "@device_pnp_\\?\usb#vid_04f2&pid_b449&mi_00#6&293a28f6&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 000001c148079280] "screen-capture-recorder"
[dshow @ 000001c148079280] Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{4EA69364-2C8A-4AE6-A561-56E4B5044439}"
[dshow @ 000001c148079280] DirectShow audio devices
[dshow @ 000001c148079280] "Microphone Array (Realtek High Definition Audio)"
[dshow @ 000001c148079280] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{935EE785-6778-4817-A4C7-50280D8BD8FC}"
[dshow @ 000001c148079280] "virtual-audio-capturer"
[dshow @ 000001c148079280] Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E146464-DB61-4309-AFA1-3578E927E935}"
[dshow @ 000001c148079280] "Headset Microphone (Jabra UC VOICE 150a MS)"
[dshow @ 000001c148079280] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{F5273A14-3E0B-49B2-85FD-0310E87EFD44}"
dummy: Immediate exit requested
C:\WINDOWS\System32>
#<FFMPEG::Movie:0x06ea0ac8 @path="C:/A/RubyAutomation_POM_VoiceVideo/Output/Video/TS1-PolicyCreation/Contactcreation_Test1.MP4", @metadata={:streams=>[{:index=>0, :codec_name=>"h264", :codec_long_name=>"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", :profile=>"High", :codec_type=>"video", :codec_time_base=>"1001/60000", :codec_tag_string=>"avc1", :codec_tag=>"0x31637661", :width=>1366, :height=>736, :coded_width=>1376, :coded_height=>736, :has_b_frames=>2, :pix_fmt=>"yuv420p", :level=>32, :chroma_location=>"left", :refs=>1, :is_avc=>"true", :nal_length_size=>"4", :r_frame_rate=>"30000/1001", :avg_frame_rate=>"30000/1001", :time_base=>"1/30000", :start_pts=>0, :start_time=>"0.000000", :duration_ts=>1091090, :duration=>"36.369667", :bit_rate=>"132149", :bits_per_raw_sample=>"8", :nb_frames=>"1090", :disposition=>{:default=>1, :dub=>0, :original=>0, :comment=>0, :lyrics=>0, :karaoke=>0, :forced=>0, :hearing_impaired=>0, :visual_impaired=>0, :clean_effects=>0, :attached_pic=>0, :timed_thumbnails=>0}, :tags=>{:language=>"und", :handler_name=>"VideoHandler"}}, {:index=>1, :codec_name=>"aac", :codec_long_name=>"AAC (Advanced Audio Coding)", :profile=>"LC", :codec_type=>"audio", :codec_time_base=>"1/44100", :codec_tag_string=>"mp4a", :codec_tag=>"0x6134706d", :sample_fmt=>"fltp", :sample_rate=>"44100", :channels=>2, :channel_layout=>"stereo", :bits_per_sample=>0, :r_frame_rate=>"0/0", :avg_frame_rate=>"0/0", :time_base=>"1/44100", :start_pts=>0, :start_time=>"0.000000", :duration_ts=>1529300, :duration=>"34.678005", :bit_rate=>"128592", :max_bit_rate=>"128592", :nb_frames=>"1494", :disposition=>{:default=>1, :dub=>0, :original=>0, :comment=>0, :lyrics=>0, :karaoke=>0, :forced=>0, :hearing_impaired=>0, :visual_impaired=>0, :clean_effects=>0, :attached_pic=>0, :timed_thumbnails=>0}, :tags=>{:language=>"und", :handler_name=>"SoundHandler"}}], :format=>{:filename=>"C:/A/RubyAutomation_POM_VoiceVideo/Output/Video/TS1-PolicyCreation/Contactcreation_Test1.MP4", :nb_streams=>2, :nb_programs=>0, :format_name=>"mov,mp4,m4a,3gp,3g2,mj2", :format_long_name=>"QuickTime / MOV", :start_time=>"0.000000", :duration=>"36.370000", :size=>"1198257", :bit_rate=>"263570", :probe_score=>100, :tags=>{:major_brand=>"isom", :minor_version=>"512", :compatible_brands=>"isomiso2avc1mp41", :encoder=>"Lavf58.51.101"}}}, @container="mov,mp4,m4a,3gp,3g2,mj2", @duration=36.37, @time=0.0, @format_tags={:major_brand=>"isom", :minor_version=>"512", :compatible_brands=>"isomiso2avc1mp41", :encoder=>"Lavf58.51.101"}, @creation_time=nil, @bitrate=263570, @video_codec="h264", @colorspace="yuv420p", @width=1366, @height=736, @video_bitrate=132149, @sar=nil, @dar=nil, @frame_rate=(30000/1001), @video_stream="h264 (High) (avc1 / 0x31637661), yuv420p, 1366x736 [SAR DAR ]", @rotation=nil, @audio_streams=[{:index=>1, :channels=>2, :codec_name=>"aac", :sample_rate=>44100, :bitrate=>128592, :channel_layout=>"stereo", :tags=>nil, :overview=>"aac (mp4a / 0x6134706d), 44100 Hz, stereo, fltp, 128592 bit/s"}], @audio_channels=2, @audio_codec="aac", @audio_sample_rate=44100, @audio_bitrate=128592, @audio_channel_layout="stereo", @audio_tags=nil, @audio_stream="aac (mp4a / 0x6134706d), 44100 Hz, stereo, fltp, 128592 bit/s">
@kapoorlakshya Hi, I just wanted to tell you, In my company, we are going to use this gem to prepare the training video material. This gem is of great use now! Thank you so much.
@Rajagopalan-M Thank you for all the information. It's helpful!
Hi, here is the video for MP4. But wanted to tell you, now video is running properly with voice. I think that day I haven't closed the video properly.
Are you now able to record audio for MP4 files then? Based on the output from @recorder.video
, the MP4 file does have two audio tracks in it. Please confirm if it's working now or not.
May I know what you are using instead of virtual-audio-capturer to capture the audio?
My test was using the microphone only. Looks like you have screen-capture-recorder-to-video-windows-free installed which is where the virtual-audio-capture
is coming from.
Hi, I just wanted to tell you, In my company, we are going to use this gem to prepare the training video material. This gem is of great use now! Thank you so much.
Oh good! I'm glad this gem is useful :)
Are you now able to record audio for MP4 files then? Based on the output from @recorder.video, the MP4 file does have two audio tracks in it. Please confirm if it's working now or not.
Works like a charm! thanks.
My test was using the microphone only. Looks like you have screen-capture-recorder-to-video-windows-free installed which is where the virtual-audio-capture is coming from.
Actually in my case, recently I installed shareX. It was choosing that virtual recorder, so I have chosen as well. I don't know whether shareX has installed this software because it was installing ffmpeg automatically.
Oh good! I'm glad this gem is useful :)
All Thanks goes to you for such a beautiful gem!
Perfect! I'll go ahead and close this issue then.