音频ffmpeg的连击视频同步的不

编程入门 行业动态 更新时间:2024-10-12 01:27:20
本文介绍了音频ffmpeg的连击视频同步的不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图来连接3 mp4文件到1。这是ffmpeg的命令IM制作:

i am trying to concatenate 3 mp4 files into 1. This is the ffmpeg command im making:

shell_exec('ffmpeg -f concat -i '.$random.'.txt -c:v libx264 -preset ultrafast -crf 30 -c:a copy '.$uploadfolder.$random.'.mp4 2>&1');

第1和第3个文件是进入和结束的图形场景,其中有上述信息:

The 1st and 3rd files are entry and end graphic scenes, which have the above information:

pinicial.mp4

ffprobe version N-76417-gee20354 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --prefix=/home/dmarcos89/ffmpeg_build --extra-cflags=-I/home/dmarcos89/ffmpeg_build/include --extra-ldflags=-L/home/dmarcos89/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 55. 5.100 / 55. 5.100 libavcodec 57. 13.102 / 57. 13.102 libavformat 57. 13.100 / 57. 13.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 14.101 / 6. 14.101 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filtremoscolombia/test/videos/placas/pinicio.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.13.100 Duration: 00:00:03.14, start: 0.021333, bitrate: 413 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 367 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 43 kb/s (default) Metadata: handler_name : SoundHandler

pfinal.mp4

ffprobe version N-76417-gee20354 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --prefix=/home/dmarcos89/ffmpeg_build --extra-cflags=-I/home/dmarcos89/ffmpeg_build/include --extra-ldflags=-L/home/dmarcos89/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 55. 5.100 / 55. 5.100 libavcodec 57. 13.102 / 57. 13.102 libavformat 57. 13.100 / 57. 13.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 14.101 / 6. 14.101 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filtremoscolombia/test/videos/placas/pfinal.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.13.100 Duration: 00:00:03.99, start: 0.021333, bitrate: 612 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 576 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 39 kb/s (default) Metadata: handler_name : SoundHandler

中间之一:

ffprobe version N-76417-gee20354 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --prefix=/home/dmarcos89/ffmpeg_build --extra-cflags=-I/home/dmarcos89/ffmpeg_build/include --extra-ldflags=-L/home/dmarcos89/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 55. 5.100 / 55. 5.100 libavcodec 57. 13.102 / 57. 13.102 libavformat 57. 13.100 / 57. 13.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 14.101 / 6. 14.101 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filtremoscolombia/test/upload/videos/vC6RvCf4pn.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.13.100 Duration: 00:00:16.90, start: 0.000000, bitrate: 1185 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x352 [SAR 1:1 DAR 20:11], 733 kb/s, 29.96 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, 5.1, fltp, 447 kb/s (default) Metadata: handler_name : SoundHandler

并这样做的结果是上面:

ffprobe version N-76417-gee20354 Copyright (c) 2007-2015 the FFmpeg developers built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) configuration: --prefix=/home/dmarcos89/ffmpeg_build --extra-cflags=-I/home/dmarcos89/ffmpeg_build/include --extra-ldflags=-L/home/dmarcos89/ffmpeg_build/lib --bindir=/usr/local/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 55. 5.100 / 55. 5.100 libavcodec 57. 13.102 / 57. 13.102 libavformat 57. 13.100 / 57. 13.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 14.101 / 6. 14.101 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'filtremoscolombia/test/upload/videos/lYF00bMR2p.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf57.13.100 Duration: 00:00:24.05, start: 0.000000, bitrate: 2121 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1793 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 327 kb/s (default) Metadata: handler_name : SoundHandler

这是视频本身: filtremoscolombia/test/upload/视频/ lYF00bMR2p.mp4

音频不能很好同步的,也音频比原始文件快...任何帮助将是巨大的。

The audio is not well synched and also audio is faster than the original file... Any help would be great

推荐答案

该CONCAT分路器使用第一个输入的时基,不重新调整第2和进一步投入的PTS。所以,你的中间文件的音频,这是在44.1千赫,正在加快,由于输出音频时基是1/48000

The concat demuxer uses the timebase of the first input and does not rescale PTS of 2nd and further inputs. So, your middle file's audio, which is at 44.1 KHz, is being sped up, since the output audio timebase is 1/48000.

重新连接code或者中间匹配项视频或进入&放大器;结束视频相匹配的中间,然后运行CONCAT。

Re-encode either the middle to match the entry video or the entry & end videos to match the middle, and then run concat.

如果重新编码中间:

ffmpeg -i vC6RvCf4pn.mp4 -crf 18 -vf scale=1280x720,setsar=1 -profile:v baseline -ar 48000 -strict -2 new-middle.mp4

更多推荐

音频ffmpeg的连击视频同步的不

本文发布于:2023-11-30 19:23:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651214.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连击   音频   视频   ffmpeg

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!