Re: [FFmpeg-user] Audio out of sync after video concatenation
> try to replace cl=2 by cl=stereo Yes, this worked. Thanks a lot! -Original Message- From: ffmpeg-user On Behalf Of Michael Koch Sent: Tuesday, June 22, 2021 10:43 PM To: ffmpeg-user@ffmpeg.org Subject: Re: [FFmpeg-user] Audio out of sync after video concatenation Am 22.06.2021 um 20:16 schrieb ibur...@compuscience.com: >> Have you tried adding (silent) audio to video 2 and trying your join > operation again? You could use `anullsrc': > > This is what I am trying to do, but wasn't able to accomplish the > first step which is adding a silent audio to my video using anullsrc. > > I came up with the following command after doing some search and also > based on Michael's command sample: > > Ffmpeg -i video.mp4 -f lavfi -i anullsrc=r=48000:cl=2 -c:v copy -c:a > aac -shortest output.mp4 > > At the end of the console output I get the following: > > Press [q] to stop, [?] for help > [aac @ 023281941140] Unsupported channel layout "1 channels (FR)" try to replace cl=2 by cl=stereo Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio out of sync after video concatenation
Am 22.06.2021 um 20:16 schrieb ibur...@compuscience.com: Have you tried adding (silent) audio to video 2 and trying your join operation again? You could use `anullsrc': This is what I am trying to do, but wasn't able to accomplish the first step which is adding a silent audio to my video using anullsrc. I came up with the following command after doing some search and also based on Michael's command sample: Ffmpeg -i video.mp4 -f lavfi -i anullsrc=r=48000:cl=2 -c:v copy -c:a aac -shortest output.mp4 At the end of the console output I get the following: Press [q] to stop, [?] for help [aac @ 023281941140] Unsupported channel layout "1 channels (FR)" try to replace cl=2 by cl=stereo Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio out of sync after video concatenation
>Have you tried adding (silent) audio to video 2 and trying your join operation again? You could use `anullsrc': This is what I am trying to do, but wasn't able to accomplish the first step which is adding a silent audio to my video using anullsrc. I came up with the following command after doing some search and also based on Michael's command sample: Ffmpeg -i video.mp4 -f lavfi -i anullsrc=r=48000:cl=2 -c:v copy -c:a aac -shortest output.mp4 At the end of the console output I get the following: >>> Press [q] to stop, [?] for help [aac @ 023281941140] Unsupported channel layout "1 channels (FR)" [aac @ 023281941140] Qavg: nan Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed! <<< Here is some additional data: 1 - The file I need to concatenate to already has audio and below are the parameters. As I need to create the silent audio with similar parameters, I used the same sample rate and number of channels (48000 and 2) [STREAM] index=1 codec_name=aac codec_long_name=AAC (Advanced Audio Coding) profile=LC codec_type=audio codec_tag_string=mp4a codec_tag=0x6134706d sample_fmt=fltp sample_rate=48000 channels=2 channel_layout=stereo bits_per_sample=0 id=N/A r_frame_rate=0/0 avg_frame_rate=0/0 time_base=1/48000 start_pts=0 start_time=0.00 duration_ts=624000 duration=13.00 bit_rate=129137 max_bit_rate=N/A bits_per_raw_sample=N/A nb_frames=611 nb_read_frames=N/A nb_read_packets=N/A DISPOSITION:default=1 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 DISPOSITION:timed_thumbnails=0 TAG:language=und TAG:handler_name=SoundHandler TAG:vendor_id=[0][0][0][0] [/STREAM] The full console output of adding the audio is here: ffmpeg -i trans_final_4_radial.mp4 -f lavfi -i anullsrc=r=48000:cl=2 -c:v copy -c:a aac -shortest trans_final_4_radial_WithAudio.mp4 ffmpeg version 2021-03-14-git-1d61a31497-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband libavutil 56. 68.100 / 56. 68.100 libavcodec 58.131.100 / 58.131.100 libavformat58. 74.100 / 58. 74.100 libavdevice58. 12.100 / 58. 12.100 libavfilter 7.109.100 / 7.109.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc55. 8.100 / 55. 8.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'trans_final_4_radial.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.74.100 Duration: 00:00:04.10, start: 0.00, bitrate: 301 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 293 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default) Metadata: handler_name: VideoHandler vendor_id : [0][0][0][0] Input #1, lavfi, from 'anullsrc=r=48000:cl=2': Duration: N/A, start: 0.00, bitrate: 384 kb/s Stream #1:0: Audio: pcm_u8, 48000 Hz, 1 channels (FR), u8, 384 kb/s Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #1:0 -> #0:1 (pcm_u8 (native) -> aac (native)) Press [q] to stop, [?] for help [aac @ 023281941140] Unsupported channel layout "1 channels (FR)" [aac @ 023281941140] Qavg: nan Error initializing output stream 0:1 -- Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed! -Original Message- From: ffmpeg-user On Behalf Of Rob Hallam Sent: Tuesday, June 22, 2021 1:31 PM To: FFmpeg user questions Subject: Re: [FFmpeg-user] Audio out of sync after video concatenation On Tue, 22 Jun 2021 at 11:15, wrote: > Video 1 - 13 seconds with audi
Re: [FFmpeg-user] Audio out of sync after video concatenation
ibur...@compuscience.com (12021-06-22): > Video 2 - 4 seconds without audio (I generated this video using xfade > transition Only use the concat demuxer with original compressed streams. If you need to concatenate the result of other processing, do not encode them and use the concat filter. Regards, -- Nicolas George signature.asc Description: PGP signature ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio out of sync after video concatenation
Am 22.06.2021 um 12:14 schrieb ibur...@compuscience.com: I concatenate 3 videos as below: Video 1 - 13 seconds with audio Video 2 - 4 seconds without audio (I generated this video using xfade transition Video 3 - 4 seconds with audio If I concatenate video 1 and 3 everything works fine; audio synchronization is correct from start to end. However, when I concatenate all 3 of them, the audio from video 3 starts playing a little bit before the end of video 2. As video 3 is a person talking, you clearly see that the audio doesn't match the mouth movements. When you use the concat demuxer, all input streams must have the same size (width * height), same video codec, same framerate, same audio codec, same number of audio tracks and the same audio sample rate. There are two possible solutions: 1. You can add a silent audio track when you generate the second video. Just add a second input to your command line, for example: -f lavfi -i anullsrc=cl=stereo -shortest 2. Or use the "acrossfade" filter when you generate the second video. Michael ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-user] Audio out of sync after video concatenation
On Tue, 22 Jun 2021 at 11:15, wrote: > Video 1 - 13 seconds with audio > Video 2 - 4 seconds without audio (I generated this video using xfade > transition > Video 3 - 4 seconds with audio > > If I concatenate video 1 and 3 everything works fine; audio synchronization > is correct from start to end. However, when I concatenate all 3 of them, the > audio from video 3 starts playing a little bit before the end of video 2. As > video 3 is a person talking, you clearly see that the audio doesn't match > the mouth movements. > > Why is this happening and how can I fix it? Have you tried adding (silent) audio to video 2 and trying your join operation again? You could use `anullsrc': https://ffmpeg.org/ffmpeg-filters.html#anullsrc or make silent audio elsewhere and add to video 2 separately. You may also want to look up the `-shortest' option if you don't know of it already. Cheers, Rob ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-user] Audio out of sync after video concatenation
I concatenate 3 videos as below: Video 1 - 13 seconds with audio Video 2 - 4 seconds without audio (I generated this video using xfade transition Video 3 - 4 seconds with audio If I concatenate video 1 and 3 everything works fine; audio synchronization is correct from start to end. However, when I concatenate all 3 of them, the audio from video 3 starts playing a little bit before the end of video 2. As video 3 is a person talking, you clearly see that the audio doesn't match the mouth movements. I use the following to concatenate: Ffmpeg -safe 0 -f concat -i D:\99_FFMpeg\file_list.txt -c copy concatenated.mp4 Why is this happening and how can I fix it? Console output is below: EXE: -safe 0 -f concat -i D:\99_FFMpeg\file_list.txt -c copy concatenated.mp4 ffmpeg version 2021-03-14-git-1d61a31497-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 10.2.0 (Rev6, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband libavutil 56. 68.100 / 56. 68.100 libavcodec 58.131.100 / 58.131.100 libavformat58. 74.100 / 58. 74.100 libavdevice58. 12.100 / 58. 12.100 libavfilter 7.109.100 / 7.109.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc55. 8.100 / 55. 8.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 029fff0972c0] Auto-inserting h264_mp4toannexb bitstream filter Input #0, concat, from 'D:\99_FFMpeg\file_list.txt': Duration: N/A, start: -0.021333, bitrate: 2623 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 2494 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc Metadata: handler_name: VideoHandler vendor_id : [0][0][0][0] Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s Metadata: handler_name: SoundHandler vendor_id : [0][0][0][0] Output #0, mp4, to 'concatenated.mp4': Metadata: encoder : Lavf58.74.100 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2494 kb/s, 60 fps, 60 tbr, 15360 tbn, 15360 tbc Metadata: handler_name: VideoHandler vendor_id : [0][0][0][0] Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 129 kb/s Metadata: handler_name: SoundHandler vendor_id : [0][0][0][0] Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help frame=1 fps=0.0 q=-1.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x [mov,mp4,m4a,3gp,3g2,mj2 @ 029fff0ac6c0] Auto-inserting h264_mp4toannexb bitstream filter [mov,mp4,m4a,3gp,3g2,mj2 @ 029fff098dc0] Auto-inserting h264_mp4toannexb bitstream filter frame= 1266 fps=0.0 q=-1.0 Lsize=6209kB time=00:00:21.11 bitrate=2409.4kbits/s speed= 638x video:5906kB audio:268kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.566926% Thanks ___ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".