server icon indicating copy to clipboard operation
server copied to clipboard

can not record stereo audio

Open TKooijmans opened this issue 4 years ago • 6 comments

When I use this ADD 1 FILE "myfile 1.mp4" -codec:v libx264 -crf:v 23 -preset:v veryfast -filter:v format=pix_fmts=yuv420p,tinterlace=4 -flags:v +ildct+ilme -codec:a aac -b:a 128k -ar:a 48k

I get a mp4 file with 8 channels audio.

When I use this ADD 1 FILE "myfile 1.mp4" -codec:v libx264 -crf:v 23 -preset:v veryfast -filter:v format=pix_fmts=yuv420p,tinterlace=4 -flags:v +ildct+ilme -codec:a aac -b:a 128k -ar:a 48k -filter:a pan=stereo| FL < FL + 0FC + 0BL + 0SL | FR < FR + 0FC + 0BR + 0SR

I should get a file with stereo audio, but there is no sound. I only get silent audio. Is there something changed with v 2.2 and 2.3

Expected behaviour

I should be able to record stereo audio

Current behaviour

stereo cahnnel mapping doesnot seem to work anymore


Steps to reproduce

1.record a file with above settings (stereo remapped) 2.playback file 3. ...

Environment

  • Server version: v2.2 and 2.3 LTS
  • Operating system: Windows 10

TKooijmans avatar Aug 12 '20 09:08 TKooijmans

Does something like this work: -filter:a pan=stereo|c0=FL+0FC+0BL+0SL|c1=FR+0FC+0BR+0SR

Or simpler, if there is no audio on channel 3 to 8 anyway: -filter:a pan=stereo|c0=FL|c1=FR

saltomodules avatar Aug 12 '20 17:08 saltomodules

THANKS that works great! How about 4 channels? So record channel 1-4?

TKooijmans avatar Aug 13 '20 10:08 TKooijmans

Yes, i would guess so. Something like: -filter:a pan=4c|c0=c0|c1=c1|c2=c2|c3=c3|c4=c4

saltomodules avatar Aug 13 '20 12:08 saltomodules

This works fine for MXF recording, Thanks, Can we also do multichannel recording with mp4? (5.1) Is -filter:a pan=stereo|c0=FL|c1=FR the same as -filter:a pan=stereo|c0=c0|c1=c1?

TKooijmans avatar Aug 13 '20 13:08 TKooijmans

this works in 5.1 mode with mp4 ADD 1 FILE "myfile 6 channel.mp4" -codec:v libx264 -crf:v 23 -preset:v veryfast -filter:v format=pix_fmts=yuv420p,tinterlace=4 -flags:v +ildct+ilme -codec:a aac -b:a 128k -ar:a 48k -filter:a pan=5.1|c0=c0|c1=c1|c2=c2|c3=c3|c4=c4|c5=c5

now to get mp4 recordings imported in Adobe Premiere.....please see my other post..

TKooijmans avatar Aug 13 '20 13:08 TKooijmans

Good to see that you got the audio working.

I'd like to add to this issue that the pan filter command in the original post isn't wrong per se. It is the spaces in it that break CasparCG parsing of the command.

So if you turn this: -filter:a pan=stereo| FL < FL + 0FC + 0BL + 0SL | FR < FR + 0FC + 0BR + 0SR into this: -filter:a pan=stereo|FL<FL+0FC+0BL+0SL|FR<FR+0FC+0BR+0SR that style of command also works.

Also, according to the ffmpeg docs you should be able to use double quotes when a command contains whitespace, like this: -filter:a pan="stereo| FL < FL + 0FC + 0BL + 0SL | FR < FR + 0FC + 0BR + 0SR" source: https://ffmpeg.org/ffmpeg-filters.html#Remapping-examples

However, when you do it like that CasparCG gets stuck in an endless loop of repeating Invalid argument errors:

[2020-08-13 14:17:42.505] [info]    Received message from Console: ADD 1 FILE "myfile c.mp4" -codec:v libx264 -crf:v 23 -preset:v veryfast -filter:v format=pix_fmts=yuv420p -codec:a aac -b:a 128k -ar:a 48k -filter:a pan="stereo| FL < FL + 0FC + 0BL + 0SL | FR < FR + 0FC + 0BR + 0SR"\r\n
[2020-08-13 14:17:42.505] [debug]   Executing command: ADD
[2020-08-13 14:17:42.506] [info]    ffmpeg[myfile c.mp4] Initialized.
[2020-08-13 14:17:42.506] [debug]   Executed command (0s): ADD
[2020-08-13 14:17:42.507] [info]    [ffmpeg] [libx264 @ 0000000012198380] using SAR=1/1
[2020-08-13 14:17:42.507] [info]    
[2020-08-13 14:17:42.508] [info]    [ffmpeg] [libx264 @ 0000000012198380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[2020-08-13 14:17:42.508] [info]    
[2020-08-13 14:17:42.509] [info]    [ffmpeg] [libx264 @ 0000000012198380] profile High, level 4.0, 4:2:0, 8-bit
[2020-08-13 14:17:42.509] [info]    
[2020-08-13 14:17:42.510] [error]   [ffmpeg] [Parsed_pan_0 @ 0000000014A3B200] pan filter needs a channel layout and a set of channel definitions as parameter
[2020-08-13 14:17:42.510] [error]   
[2020-08-13 14:17:42.510] [error]   [ffmpeg] [AVFilterGraph @ 0000000014BECBC0] Error initializing filter 'pan'
[2020-08-13 14:17:42.510] [error]   [ffmpeg]  with args ''
[2020-08-13 14:17:42.510] [error]   [ffmpeg] 
[2020-08-13 14:17:42.510] [error]   
[2020-08-13 14:17:42.510] [error]   [ffmpeg] [Parsed_pan_0 @ 0000000014A3B200] pan filter needs a channel layout and a set of channel definitions as parameter
[2020-08-13 14:17:42.510] [error]   
[2020-08-13 14:17:42.510] [error]   [ffmpeg] [AVFilterGraph @ 0000000014BECBC0] Error initializing filter 'pan'
[2020-08-13 14:17:42.510] [error]   [ffmpeg]  with args ''
[2020-08-13 14:17:42.510] [error]   [ffmpeg] 
[2020-08-13 14:17:42.510] [error]   
[2020-08-13 14:17:42.559] [error]   Exception: C:\Program Files (x86)\Jenkins\workspace\casparcg-server-dep\master\src\modules\ffmpeg\consumer\ffmpeg_consumer.cpp(168): Throw in function __cdecl caspar::ffmpeg::Stream::Stream(struct AVFormatContext *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,enum AVCodecID,const struct caspar::core::video_format_desc &,bool,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > &)
[2020-08-13 14:17:42.559] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::ffmpeg::ffmpeg_error_t>
[2020-08-13 14:17:42.559] [error]   [struct boost::errinfo_api_function_ * __ptr64] = avfilter_graph_parse2(graph.get(), filter_spec.c_str(), &inputs, &outputs)
[2020-08-13 14:17:42.559] [error]   [struct boost::errinfo_errno_ * __ptr64] = 22, "Invalid argument"
[2020-08-13 14:17:42.559] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x000000013F5D9D0E in casparcg
[2020-08-13 14:17:42.559] [error]    1# 0x000000013F609070 in casparcg
[2020-08-13 14:17:42.559] [error]    2# 0x000000013F7BE710 in casparcg
[2020-08-13 14:17:42.559] [error]    3# 0x000000013F7B623B in casparcg
[2020-08-13 14:17:42.559] [error]    4# 0x000000013F7C4D1E in casparcg
[2020-08-13 14:17:42.559] [error]    5# 0x000000013F7C88F0 in casparcg
[2020-08-13 14:17:42.559] [error]    6# 0x000000013F5D4A49 in casparcg
[2020-08-13 14:17:42.559] [error]    7# crt_at_quick_exit in ucrtbase
[2020-08-13 14:17:42.559] [error]    8# BaseThreadInitThunk in kernel32
[2020-08-13 14:17:42.559] [error]    9# RtlUserThreadStart in ntdll
[2020-08-13 14:17:42.559] [error]   
[2020-08-13 14:17:42.559] [error]   

[2020-08-13 14:17:42.559] [error]    0# 0x000000013F5D9D0E in casparcg
[2020-08-13 14:17:42.559] [error]    1# 0x000000013F5D963F in casparcg
[2020-08-13 14:17:42.559] [error]    2# 0x000000013FADFB37 in casparcg
[2020-08-13 14:17:42.559] [error]    3# _C_specific_handler in VCRUNTIME140
[2020-08-13 14:17:42.559] [error]    4# _FrameUnwindFilter in VCRUNTIME140
[2020-08-13 14:17:42.559] [error]    5# RtlRestoreContext in ntdll
[2020-08-13 14:17:42.559] [error]    6# 0x000000013F6D733D in casparcg
[2020-08-13 14:17:42.559] [error]    7# 0x000000013F6D7DC5 in casparcg
[2020-08-13 14:17:42.559] [error]    8# 0x000000013F6CEC77 in casparcg
[2020-08-13 14:17:42.559] [error]    9# 0x000000013F6D19C0 in casparcg
[2020-08-13 14:17:42.559] [error]   10# 0x000000013F5D4A49 in casparcg
[2020-08-13 14:17:42.559] [error]   11# crt_at_quick_exit in ucrtbase
[2020-08-13 14:17:42.559] [error]   12# BaseThreadInitThunk in kernel32
[2020-08-13 14:17:42.559] [error]   13# RtlUserThreadStart in ntdll
[2020-08-13 14:17:42.559] [error]   
[2020-08-13 14:17:42.609] [error]   Exception: C:\Program Files (x86)\Jenkins\workspace\casparcg-server-dep\master\src\modules\ffmpeg\consumer\ffmpeg_consumer.cpp(168): Throw in function __cdecl caspar::ffmpeg::Stream::Stream(struct AVFormatContext *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,enum AVCodecID,const struct caspar::core::video_format_desc &,bool,class std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > > &)
[2020-08-13 14:17:42.609] [error]   Dynamic exception type: class boost::exception_detail::clone_impl<struct caspar::ffmpeg::ffmpeg_error_t>
[2020-08-13 14:17:42.609] [error]   [struct boost::errinfo_api_function_ * __ptr64] = avfilter_graph_parse2(graph.get(), filter_spec.c_str(), &inputs, &outputs)
[2020-08-13 14:17:42.609] [error]   [struct boost::errinfo_errno_ * __ptr64] = 22, "Invalid argument"
[2020-08-13 14:17:42.609] [error]   [struct caspar::tag_stacktrace_info * __ptr64] =  0# 0x000000013F5D9D0E in casparcg
[2020-08-13 14:17:42.609] [error]    1# 0x000000013F609070 in casparcg
[2020-08-13 14:17:42.609] [error]    2# 0x000000013F7BE710 in casparcg
[2020-08-13 14:17:42.609] [error]    3# 0x000000013F7B623B in casparcg
[2020-08-13 14:17:42.609] [error]    4# 0x000000013F7C4D1E in casparcg
[2020-08-13 14:17:42.609] [error]    5# 0x000000013F7C88F0 in casparcg
[2020-08-13 14:17:42.609] [error]    6# 0x000000013F5D4A49 in casparcg
[2020-08-13 14:17:42.609] [error]    7# crt_at_quick_exit in ucrtbase
[2020-08-13 14:17:42.609] [error]    8# BaseThreadInitThunk in kernel32
[2020-08-13 14:17:42.609] [error]    9# RtlUserThreadStart in ntdll
[2020-08-13 14:17:42.609] [error]   
[2020-08-13 14:17:42.609] [error]   

[2020-08-13 14:17:42.609] [error]    0# 0x000000013F5D9D0E in casparcg
[2020-08-13 14:17:42.609] [error]    1# 0x000000013F5D963F in casparcg
[2020-08-13 14:17:42.609] [error]    2# 0x000000013FADFB37 in casparcg
[2020-08-13 14:17:42.609] [error]    3# _C_specific_handler in VCRUNTIME140
[2020-08-13 14:17:42.609] [error]    4# _FrameUnwindFilter in VCRUNTIME140
[2020-08-13 14:17:42.609] [error]    5# RtlRestoreContext in ntdll
[2020-08-13 14:17:42.609] [error]    6# 0x000000013F6D733D in casparcg
[2020-08-13 14:17:42.609] [error]    7# 0x000000013F6D7DC5 in casparcg
[2020-08-13 14:17:42.609] [error]    8# 0x000000013F6CEC77 in casparcg
[2020-08-13 14:17:42.609] [error]    9# 0x000000013F6D19C0 in casparcg
[2020-08-13 14:17:42.609] [error]   10# 0x000000013F5D4A49 in casparcg
[2020-08-13 14:17:42.609] [error]   11# crt_at_quick_exit in ucrtbase
[2020-08-13 14:17:42.609] [error]   12# BaseThreadInitThunk in kernel32
[2020-08-13 14:17:42.609] [error]   13# RtlUserThreadStart in ntdll
[2020-08-13 14:17:42.609] [error]   
etc.

So that might actually be an issue with argument parsing.

saltomodules avatar Aug 13 '20 21:08 saltomodules