Ffmpeg fails to convert webm files when h264_nvenc forced
Hi, I have been working with below environment. ==>Ubuntu 16.04.3 ==>FFmpeg :3.4.2 -- configuration: --prefix=/usr/local/ffmpeg_new/ --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-libvpx --enable-libvorbis --enable-libfreetype ==>Cuda 9.1.85 ==> GPU: GeForce GTX 1080ti My purpose is to accelerate video modifications via GPU source since there is high rate traffic on my media server. Here is the main steps of my process: 1.Split video and audio of the caller. time ffmpeg -y -i 230087_caller.webm -vn -ab 256 230087_caller.wav 2.Split video and audio of the callee time ffmpeg -y -i 230087_callee.webm -vn -ab 256 230087_callee.wav 3.Mux original caller video with callee audio to store the conversation. time ffmpeg -y -i 230087_caller.webm -i 230087_callee.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[out]' -map 0:v -map '[out]' -c:v copy -c:a libvorbis -shortest -f webm caller_temp.webm 4.Add time fontfile to the caller_temp fil which fails with below error. time ffmpeg -y -i caller_temp.webm -vf drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S' -strict -2 -shortest -c:a libvorbis -c:v h264_nvenc final_font_test.webm [webm @ 0x29e8540] Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM. av_interleaved_write_frame(): Invalid argument Error writing trailer of output_temwp.webm: Invalid argument ================================== Here is the details of my webm file : Stream #0:0(eng): Video: vp8, yuv420p, 640x480, SAR 1:1 DAR 4:3, 27.58 tbr, 1k tbn, 1k tbc (default) Metadata: title : Video Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default) ================================== I have take a look at the nvidia video encode/Decode support matrix,my gpu seems should be supporting this conversion. https://developer.nvidia.com/video-encode-decode-gpu-support-matrix ================================= However,when I have changed the output file format to mp4/avi/mpeg GPU can be used without any issue.Yet ,webm is important for us as the other container file size becomes risky with storage perspective of view. I will be appreciated if you share your comments and feeedbacks to proceed with this issue. Thanks in advance.
On Wed, Feb 28, 2018 at 05:53:17 +0000, oktay eşgül wrote:
Here is the main steps of my process: 1.Split video and audio of the caller. time ffmpeg -y -i 230087_caller.webm -vn -ab 256 230087_caller.wav 2.Split video and audio of the callee time ffmpeg -y -i 230087_callee.webm -vn -ab 256 230087_callee.wav 3.Mux original caller video with callee audio to store the conversation. time ffmpeg -y -i 230087_caller.webm -i 230087_callee.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[out]' -map 0:v -map '[out]' -c:v copy -c:a libvorbis -shortest -f webm caller_temp.webm 4.Add time fontfile to the caller_temp fil which fails with below error. time ffmpeg -y -i caller_temp.webm -vf drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S' -strict -2 -shortest -c:a libvorbis -c:v h264_nvenc final_font_test.webm
I'm pretty sure this can all be done in one step, but that was not the aim of your email. ;-)
[webm @ 0x29e8540] Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM. [...] However,when I have changed the output file format to mp4/avi/mpeg GPU can be used without any issue.Yet ,webm is important for us as the other container file size becomes risky with storage perspective of view.
Did you read this message? ffmpeg's webm muxer refuses to mux H.264 video into WebM. You need to encode to vp9 or vp9. (I realize that there's no nvenc acceleration for that though, IIUC.) Moritz
Hi Moritz, Thank you for your comment.Yes ,seems webm encoding is not supportef by my gpu.İnstead,I am planning toy use mkv as output container type. With respect to combine below 4 steps as an one step for all operation,what instruction do you recommend? Thank you On 28 Feb 2018 Wed at 11:59 Moritz Barsnick <barsnick@gmx.net> wrote:
On Wed, Feb 28, 2018 at 05:53:17 +0000, oktay eşgül wrote:
Here is the main steps of my process: 1.Split video and audio of the caller. time ffmpeg -y -i 230087_caller.webm -vn -ab 256 230087_caller.wav 2.Split video and audio of the callee time ffmpeg -y -i 230087_callee.webm -vn -ab 256 230087_callee.wav 3.Mux original caller video with callee audio to store the conversation. time ffmpeg -y -i 230087_caller.webm -i 230087_callee.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[out]' -map 0:v -map '[out]' -c:v copy -c:a libvorbis -shortest -f webm caller_temp.webm 4.Add time fontfile to the caller_temp fil which fails with below error. time ffmpeg -y -i caller_temp.webm -vf drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S' -strict -2 -shortest -c:a libvorbis -c:v h264_nvenc final_font_test.webm
I'm pretty sure this can all be done in one step, but that was not the aim of your email. ;-)
[webm @ 0x29e8540] Only VP8 or VP9 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM. [...] However,when I have changed the output file format to mp4/avi/mpeg GPU can be used without any issue.Yet ,webm is important for us as the other container file size becomes risky with storage perspective of view.
Did you read this message? ffmpeg's webm muxer refuses to mux H.264 video into WebM. You need to encode to vp9 or vp9. (I realize that there's no nvenc acceleration for that though, IIUC.)
Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On Wed, Feb 28, 2018 at 09:04:22 +0000, oktay eşgül wrote:
Thank you for your comment.Yes ,seems webm encoding is not supportef by my gpu.İnstead,I am planning toy use mkv as output container type.
MKV should work fine.
instruction do you recommend?
On Wed, Feb 28, 2018 at 05:53:17 +0000, oktay eşgül wrote:
Here is the main steps of my process: 1.Split video and audio of the caller. time ffmpeg -y -i 230087_caller.webm -vn -ab 256 230087_caller.wav
You weren't even using the output of this step. It's not needed.
2.Split video and audio of the callee time ffmpeg -y -i 230087_callee.webm -vn -ab 256 230087_callee.wav
You can get the audio of this file by referring "1:a" and ignoring "1:v" - as you already actually did in step 3. Therefore not needed.
3.Mux original caller video with callee audio to store the conversation. time ffmpeg -y -i 230087_caller.webm -i 230087_callee.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[out]' -map 0:v -map '[out]' -c:v copy -c:a libvorbis -shortest -f webm caller_temp.webm
You can integrate the video filter and encoding of step 4 into this step: ffmpeg -y -i 230087_caller.webm -i 230087_callee.webm \ -filter_complex \ '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; \ [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; \ [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[aout]; \ [0:v]drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S[vout]' \ -map '[vout]' -map '[aout]' -c:v h264_nvenc -c:a libvorbis -shortest final_font_test.webm (Untested.)
4.Add time fontfile to the caller_temp fil which fails with below error. time ffmpeg -y -i caller_temp.webm -vf drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S' -strict -2 -shortest -c:a libvorbis -c:v h264_nvenc final_font_test.webm
Hint: You were encoding to libvorbis a second time, you could have used "-c:a copy". But as I have combined it into one step, it doesn't matter anymore. ;-) Cheers, Moritz
On Wed, Feb 28, 2018 at 11:30:28 +0100, Moritz Barsnick wrote:
[0:v]drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S[vout]' \ -map '[vout]' -map '[aout]' -c:v h264_nvenc -c:a libvorbis -shortest final_font_test.webm
(Untested.)
D'uh. Of course, "-c:v h264_nvenc -c:a libvorbis -shortest final_font_test.webm" is the part that won't work. Please replace the video codec, or choose .mkv as file suffix. Moritz
Thank you very much Moritz for your feedbacks and help. On 28 Feb 2018 Wed at 13:32 Moritz Barsnick <barsnick@gmx.net> wrote:
On Wed, Feb 28, 2018 at 11:30:28 +0100, Moritz Barsnick wrote:
[0:v]drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S[vout]' \
-map '[vout]' -map '[aout]' -c:v h264_nvenc -c:a libvorbis -shortest final_font_test.webm
(Untested.)
D'uh. Of course, "-c:v h264_nvenc -c:a libvorbis -shortest final_font_test.webm" is the part that won't work. Please replace the video codec, or choose .mkv as file suffix.
Moritz _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (2)
-
Moritz Barsnick -
oktay eşgül