
Recherche avancée
Médias (91)
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#1 The Wires
11 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (49)
-
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (7974)
-
ffmpeg demux concat drops audio even though streams look identical
27 septembre 2022, par Ben OlayinkaI'm trying to demux two videos, but I'm getting an error and the audio from the second video is lost. Here's the ffprobe outputs


video 1 :


ffprobe bumpers/intro_final.mp4
ffprobe version 5.1.2 Copyright (c) 2007-2022 the FFmpeg developers
 built with Apple clang version 14.0.0 (clang-1400.0.29.102)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bumpers/intro_final.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf59.27.100
 Duration: 00:00:10.05, start: 0.000000, bitrate: 795 kb/s
 Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 654 kb/s, 25 fps, 25 tbr, 25 tbn (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.37.100 libx264
 Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 135 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]




video 2 :


ffprobe input/ORIGINAL.mp4 
ffprobe version 5.1.2 Copyright (c) 2007-2022 the FFmpeg developers
 built with Apple clang version 14.0.0 (clang-1400.0.29.102)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input/ORIGINAL.mp4':
 Metadata:
 major_brand : isom
 minor_version : 1
 compatible_brands: iso4avc1isom
 creation_time : 2022-09-22T09:39:50.000000Z
 com.apple.proapps.clipID: ThingsConference_ST2_01 6
 com.blackmagic-design.camera.dateRecorded: 2022:09:22
 com.apple.proapps.cameraName: 0
 com.blackmagic-design.camera.uuid: 92162B194AF84F1D8F186FBFEC9EDA9F-0
 Duration: 00:17:34.00, start: 0.000000, bitrate: 30012 kb/s
 Stream #0:0[0x1](eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 29880 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn (default)
 Metadata:
 creation_time : 2022-09-22T09:39:50.000000Z
 handler_name : ?Apple Video Media Handler
 vendor_id : BMAG
 encoder : H264/AVC
 timecode : 11:39:50:00
 Stream #0:1[0x2](eng): Data: none (tmcd / 0x64636D74) (default)
 Metadata:
 creation_time : 2022-09-22T09:39:50.000000Z
 handler_name : ?Time Code Media Handler
 timecode : 11:39:50:00
 Stream #0:2[0x3](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 creation_time : 2022-09-22T09:39:50.000000Z
 handler_name : ?Apple Sound Media Handler
 vendor_id : [0][0][0][0]
 timecode : 11:39:50:00
Unsupported codec with id 0 for input stream 1



And I'm running


ffmpeg -f concat -safe 0 -i mylist.txt -c copy output-demux.mp4



Which returns


[mov,mp4,m4a,3gp,3g2,mj2 @ 0x13ef058c0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'mylist.txt':
 Duration: N/A, start: -0.021333, bitrate: 789 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 654 kb/s, 25 fps, 25 tbr, 25 tbn
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.37.100 libx264
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 135 kb/s
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
File 'output-demux.mp4' already exists. Overwrite? [y/N] y
Output #0, mp4, to 'output-demux.mp4':
 Metadata:
 encoder : Lavf59.27.100
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, q=2-31, 654 kb/s, 25 fps, 25 tbr, 12800 tbn
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 encoder : Lavc59.37.100 libx264
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 135 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= [mov,mp4,m4a,3gp,3g2,mj2 @ 0x13ee06b10] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0x13ee10a90] Non-monotonous DTS in output stream 0:1; previous: 482304, current: 1275; changing to 482305. This may result in incorrect timestamps in the output file.
[concat @ 0x13ef05200] New audio stream 0:2 at pos:792252 and DTS:10.0053s
frame= 2963 fps=0.0 q=-1.0 size= 336384kB time=00:01:58.52 bitrate=23250.6kbitsframe= 5465 fps=5464 q=-1.0 size= 695552kB time=00:03:38.60 bitrate=26065.7kbitframe= 8609 fps=5738 q=-1.0 size= 1033728kB time=00:05:44.36 bitrate=24591.4kbitframe=10978 fps=5488 q=-1.0 size= 1353984kB time=00:07:19.12 bitrate=25259.2kbitframe=13365 fps=5345 q=-1.0 size= 1715968kB time=00:08:54.60 bitrate=26294.8kbitframe=16480 fps=5492 q=-1.0 size= 2077952kB time=00:10:59.20 bitrate=25823.1kbitframe=18595 fps=5311 q=-1.0 size= 2436608kB time=00:12:23.80 bitrate=26836.1kbitframe=20753 fps=5187 q=-1.0 size= 2787072kB time=00:13:50.12 bitrate=27504.1kbitframe=22825 fps=5068 q=-1.0 size= 3157504kB time=00:15:13.00 bitrate=28331.1kbitframe=24700 fps=4935 q=-1.0 size= 3497216kB time=00:16:28.00 bitrate=28997.2kbitframe=26601 fps=4859 q=-1.0 Lsize= 3845642kB time=00:17:44.04 bitrate=29607.4kbits/s speed= 194x 
video:3845343kB audio:166kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003468%



I just noticed the "Unsupported codec" error for video 2, but I've tried concating video 1 with itself and video 2 with itself and both work fine.


-
Transcode WEBM to RTMP
7 avril 2024, par Justin WhiteSummary


My goal is to take a webcam stream from the browser and feed it into a program called Restreamer that takes in an RTMP stream.


I've deduced that the browser Recording API produces Blobs that can be saved as WEBM.


In order to stream the WEBM content to Restreamer I am attempting to use FFmpeg. I've read that forcing FLV format is required but otherwise all of the arguments are Greek to me. I've been unable to find a comparable topic where someone has tried to go from WEBM to RTMP. I have found examples of going the other direction, but reversing the FFmpeg command proved unfruitful.


Saving to FLV works fine. Using the following command, I am able to transcode a WEBM file to FLV and play it on VLC :

ffmpeg -i ~/big-buck-bunny_trailer.webm -f flv out.flv


However, if instead of outputting to a file I pass it to RTMP I get the following output :

ffmpeg -i ~/Downloads/big-buck-bunny_trailer.webm -f flv "rtmp://example.com/live"


ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12 (GCC)
 configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librav1e --enable-librtmp --enable-librubberband --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libglslang --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
 libavutil 57. 17.100 / 57. 17.100
 libavcodec 59. 18.100 / 59. 18.100
 libavformat 59. 16.100 / 59. 16.100
 libavdevice 59. 4.100 / 59. 4.100
 libavfilter 8. 24.100 / 8. 24.100
 libswscale 6. 4.100 / 6. 4.100
 libswresample 4. 3.100 / 4. 3.100
 libpostproc 56. 3.100 / 56. 3.100
Input #0, matroska,webm, from '/home/kyjus25/big-buck-bunny_trailer.webm':
 Metadata:
 encoder : http://sourceforge.net/projects/yamka
 creation_time : 2010-05-20T08:21:12.000000Z
 Duration: 00:00:32.48, start: 0.000000, bitrate: 533 kb/s
 Stream #0:0(eng): Video: vp8, yuv420p(progressive), 640x360, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default)
 Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp (default)
HandShake: client signature does not match!
Stream mapping:
 Stream #0:0 -> #0:0 (vp8 (native) -> flv1 (flv))
 Stream #0:1 -> #0:1 (vorbis (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, flv, to 'rtmp://example.com/live':
 Metadata:
 encoder : Lavf59.16.100
 Stream #0:0(eng): Video: flv1 ([2][0][0][0] / 0x0002), yuv420p(tv, bt470bg/unknown/unknown, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 1k tbn (default)
 Metadata:
 encoder : Lavc59.18.100 flv
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
 Stream #0:1(eng): Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, mono, fltp (default)
 Metadata:
 encoder : Lavc59.18.100 libmp3lame
WriteN, RTMP send error 32 (136 bytes)7kB time=00:00:00.39 bitrate= 136.7kbits/s speed=71.2x 
WriteN, RTMP send error 32 (35 bytes)
WriteN, RTMP send error 9 (42 bytes)
av_interleaved_write_frame(): Operation not permitted
 Last message repeated 1 times
[flv @ 0x55d0dd0af700] Failed to update header with correct duration.
[flv @ 0x55d0dd0af700] Failed to update header with correct filesize.
Error writing trailer of rtmp://example.com/live: Operation not permitted
frame= 53 fps=0.0 q=4.3 Lsize= 146kB time=00:00:02.45 bitrate= 486.8kbits/s speed=42.8x 
video:128kB audio:19kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Error closing file rtmp://example.com/live: Operation not permitted
Conversion failed!



There are several interesting rabbit holes to follow here, but after following all of them I've come up with nothing.


•
HandShake: client signature does not match!
:

More of a warning than an error, I assumed because I was going from "WEBM -> FLV" instead of the more traditional "MP4 -> FLV".

•
av_interleaved_write_frame(): Operation not permitted
:

I found several issues on this. One of them calling it a storage issue, the other calling it a file permissions issue. I have plenty of disk space and have tried setting the input file to 777 permissions. However, the examples I've found on it being a file permissions issue all deal with outputting to a file rather than to an an RTMP IP.

•
Failed to update header with correct duration
:

Advice I found was to add-flvflags no_duration_filesize
to the command, which does suppress both "Failed to update..." errors, but does not fix the over-arching issue.

What I've Tried


• Multi-format transcoding


MP4 to RTMP does work correctly :

ffmpeg -i ~/Downloads/big-buck-bunny_trailer.mp4 -f flv "rtmp://example.com/live"

Theoretically, I could stream the WEBM to a file, transcode that to an MP4 file, and then transcode that to FLV/RTMP. Sounds awful.

• Pay for a service (Wowza, Flashphoner, api.video, etc)


Unfortunately precisely what I am trying to avoid.


• WebRTC to RTMP ?


WebRTC seems to be a peer-to-peer connection and doesn't play nicely with a server/client scenario.


• WebRTC to other ingest formats


Restreamer also supports incoming streams of HLS, DASH, RTP, RTSP, RTMP, and SRT. However, these all seem to be examples of network sources that would be exposed via an IP URL. I am not sure that FFmpeg can do that.


• Utilizing ffmpeg-wasm instead of CLI


Available here, I thought that maybe by using a browser implementation I may get different results. But no. Not even an error to the console.


• Streaming from OBS


For the record, yes, I have tried streaming from OBS instead of going through FFmpeg and the Restreamer platform itself does work for normal use. I use it often.


Post Script


I've not been able to find any relevant solutions online. I am shocked that streaming from a browser webcam has not been solved 1000 times prior. This is related to a question made 7 years ago but it was not resolved and Flash is no longer an option.


Recommendations


• Adding
-c:v libx264 -flags:v +global_header -c:a aac -ac 2
:

ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12 (GCC)
 configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librav1e --enable-librtmp --enable-librubberband --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libglslang --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
 libavutil 57. 17.100 / 57. 17.100
 libavcodec 59. 18.100 / 59. 18.100
 libavformat 59. 16.100 / 59. 16.100
 libavdevice 59. 4.100 / 59. 4.100
 libavfilter 8. 24.100 / 8. 24.100
 libswscale 6. 4.100 / 6. 4.100
 libswresample 4. 3.100 / 4. 3.100
 libpostproc 56. 3.100 / 56. 3.100
Input #0, matroska,webm, from '/home/kyjus25/big-buck-bunny_trailer.webm':
 Metadata:
 encoder : http://sourceforge.net/projects/yamka
 creation_time : 2010-05-20T08:21:12.000000Z
 Duration: 00:00:32.48, start: 0.000000, bitrate: 533 kb/s
 Stream #0:0(eng): Video: vp8, yuv420p(progressive), 640x360, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default)
 Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp (default)
HandShake: client signature does not match!
Stream mapping:
 Stream #0:0 -> #0:0 (vp8 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (vorbis (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x561564271fc0] using SAR=1/1
[libx264 @ 0x561564271fc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x561564271fc0] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0x561564271fc0] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=11 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://example.com/live':
 Metadata:
 encoder : Lavf59.16.100
 Stream #0:0(eng): Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, bt470bg/unknown/unknown, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 25 fps, 1k tbn (default)
 Metadata:
 encoder : Lavc59.18.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1(eng): Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 encoder : Lavc59.18.100 aac
Larger timestamp than 24-bit: 0xffffff77kB time=00:00:30.18 bitrate= 460.0kbits/s speed=19.7x 
[flv @ 0x56156425e440] Failed to update header with correct duration.
[flv @ 0x56156425e440] Failed to update header with correct filesize.
frame= 812 fps=475 q=-1.0 Lsize= 1901kB time=00:00:32.52 bitrate= 479.0kbits/s speed= 19x 
video:1354kB audio:508kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.123872%
[libx264 @ 0x561564271fc0] frame I:21 Avg QP:15.05 size: 8839
[libx264 @ 0x561564271fc0] frame P:293 Avg QP:20.78 size: 3087
[libx264 @ 0x561564271fc0] frame B:498 Avg QP:22.20 size: 593
[libx264 @ 0x561564271fc0] consecutive B-frames: 14.7% 7.6% 9.2% 68.5%
[libx264 @ 0x561564271fc0] mb I I16..4: 42.6% 41.9% 15.5%
[libx264 @ 0x561564271fc0] mb P I16..4: 4.0% 8.0% 0.9% P16..4: 22.7% 8.0% 4.0% 0.0% 0.0% skip:52.4%
[libx264 @ 0x561564271fc0] mb B I16..4: 1.4% 1.5% 0.2% B16..8: 12.0% 1.0% 0.2% direct: 3.3% skip:80.5% L0:44.1% L1:47.1% BI: 8.8%
[libx264 @ 0x561564271fc0] 8x8 transform intra:53.6% inter:57.0%
[libx264 @ 0x561564271fc0] coded y,uvDC,uvAC intra: 35.1% 37.7% 11.2% inter: 7.8% 9.5% 2.4%
[libx264 @ 0x561564271fc0] i16 v,h,dc,p: 56% 21% 14% 9%
[libx264 @ 0x561564271fc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 26% 21% 3% 3% 4% 4% 3% 4%
[libx264 @ 0x561564271fc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 21% 18% 4% 7% 7% 6% 5% 4%
[libx264 @ 0x561564271fc0] i8c dc,h,v,p: 62% 21% 15% 2%
[libx264 @ 0x561564271fc0] Weighted P-Frames: Y:20.8% UV:19.5%
[libx264 @ 0x561564271fc0] ref P L0: 70.3% 17.7% 9.0% 2.9% 0.0%
[libx264 @ 0x561564271fc0] ref B L0: 89.3% 8.9% 1.9%
[libx264 @ 0x561564271fc0] ref B L1: 96.4% 3.6%
[libx264 @ 0x561564271fc0] kb/s:341.30
[aac @ 0x561564223140] Qavg: 952.636



Seems to complete successfully, but does so rather quickly. Log outputs a new
Larger timestamp than 24-bit: 0xffffff77kB


-
FFmpeg joined audio & video out of sync in some parts of the video
20 septembre 2022, par ankur625I've developed a video joining service. Here is how it works in brief.


Step 1 : Users upload their video (different video file types) from desktop/mobile. These videos are processed on the server, a logo is added, and converted to .mp4 format.


Step 2 : All received mp4 files are then joined, a background music is added and saved.


Everything is working as expected. The only problem is, when video files are joined. The final output video has audio out of sync in some parts. In step 2, I get "Non-monotonous DTS in output stream 0:1 ;" error message.


Following are step 1 and step 2 codes.


Step 1 :


ffmpeg -y -i inputVideo -i inputImage -r 30000/1001 -video_track_timescale 30k -filter_complex "[0]scale=854:480:force_original_aspect_ratio=decrease,pad=854:480:(ow-iw)/2:(oh-ih)/2:black,setsar=1/1,setdar=16/9[v0];[1:v]format=argb,colorchannelmixer=aa=1.0,scale=71:72[overl1],[v0][overl1]overlay=297:285[v1]" -map "[v1]" -map 0:a -b:v 250k -maxrate 250k -bufsize 500k -crf 5 -preset slower -vbr 4 -movflags +faststart -b:a 96k -async 1 outputVideo.mp4



Step 2 :


ffmpeg -safe 0 -f concat -segment_time_metadata 1 -i videoList.txt -stream_loop -1 -i backgroundMusic.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.5[a0];[1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.03[a1];[a0][a1]amerge=inputs=2[a]' -map 0:v -map '[a]' -c:v copy -ac 2 finalVideo.mp4



I'm not expert with ffmpeg, and not sure, what's missing. can anyone help me fix this issue ?


Step 2 (using amix suggested by kesh)


ffmpeg -safe 0 -f concat -segment_time_metadata 1 -i list.txt -stream_loop -1 -i track1.mp3 -filter_complex "[0:a]volume=1.5[a0];[1:a]volume=0.03[a1];[a0][a1]amix=inputs=2:duration=first[a]" -map 0:v -map "[a]" -c:v copy -ac 2 out.mp4



And, following is the full log of step 2,


ffmpeg version 5.0.1-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 11.2.0 (Rev7, 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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --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-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
 libavutil 57. 17.100 / 57. 17.100
 libavcodec 59. 18.100 / 59. 18.100
 libavformat 59. 16.100 / 59. 16.100
 libavdevice 59. 4.100 / 59. 4.100
 libavfilter 8. 24.100 / 8. 24.100
 libswscale 6. 4.100 / 6. 4.100
 libswresample 4. 3.100 / 4. 3.100
 libpostproc 56. 3.100 / 56. 3.100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff7163ed40] Auto-inserting h264_mp4toannexb bitstream filter
 Input #0, concat, from 'list.txt':
 Duration: N/A, start: -0.023220, bitrate: 63 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 854x480, 61 kb/s, 29.97 fps, 29.97 tbr, 30k tbn
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s
 Metadata:
 handler_name : SoundHandler
 vendor_id : [0][0][0][0]
 Input #1, mp3, from 'track1.mp3':
 Metadata:
 title : Safety Net
 artist : Riot
 album : YouTube Audio Library
 genre : Country & Folk
 encoder : Google
 Duration: 00:01:30.88, start: 0.025057, bitrate: 128 kb/s
 Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
 Metadata:
 encoder : Lavf
 Stream mapping:
 Stream #0:1 (aac) -> volume:default
 Stream #1:0 (mp3float) -> volume:default
 Stream #0:0 -> #0:0 (copy)
 amix:default -> Stream #0:1 (aac)
 Press [q] to stop, [?] for help
 Output #0, mp4, to 'out.mp4':
 Metadata:
 encoder : Lavf59.16.100
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 854x480, q=2-31, 61 kb/s, 29.97 fps, 29.97 tbr, 30k tbn
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
 Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
 Metadata:
 encoder : Lavc59.18.100 aac
 frame= 3 fps=0.0 q=-1.0 size= 0kB time=00:00:00.02 bitrate= 16.5kbits/s speed=44.7x 
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff719acac0] Auto-inserting h264_mp4toannexb bitstream filter
 frame= 478 fps=0.0 q=-1.0 size= 256kB time=00:00:15.89 bitrate= 132.0kbits/s speed=31.7x 
 frame= 1084 fps=1083 q=-1.0 size= 1024kB time=00:00:36.11 bitrate= 232.3kbits/s speed=36.1x 
 frame= 1668 fps=1111 q=-1.0 size= 1536kB time=00:00:55.59 bitrate= 226.3kbits/s speed= 37x 
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff719acac0] Auto-inserting h264_mp4toannexb bitstream filter
 frame= 2282 fps=1140 q=-1.0 size= 2560kB time=00:01:16.08 bitrate= 275.6kbits/s speed= 38x 
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff71ce81c0] Auto-inserting h264_mp4toannexb bitstream filter
 frame= 2848 fps=1138 q=-1.0 size= 3328kB time=00:01:34.97 bitrate= 287.1kbits/s speed=37.9x 
 frame= 3443 fps=1146 q=-1.0 size= 4352kB time=00:01:54.82 bitrate= 310.5kbits/s speed=38.2x 
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff718f2c40] Auto-inserting h264_mp4toannexb bitstream filter
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000001ff718f26c0] Auto-inserting h264_mp4toannexb bitstream filter
 [aac @ 000001ff716ed2c0] Queue input is backward in time
 [mp4 @ 000001ff71661600] Non-monotonous DTS in output stream 0:1; previous: 6224608, current: 6221946; changing to 6224609. This may result in incorrect timestamps in the output file.
 [mp4 @ 000001ff71661600] Non-monotonous DTS in output stream 0:1; previous: 6224609, current: 6222970; changing to 6224610. This may result in incorrect timestamps in the output file.
 [mp4 @ 000001ff71661600] Non-monotonous DTS in output stream 0:1; previous: 6224610, current: 6223994; changing to 6224611. This may result in incorrect timestamps in the output file.
 frame= 4336 fps=1238 q=-1.0 size= 5376kB time=00:02:24.65 bitrate= 304.4kbits/s speed=41.3x 
 frame= 4406 fps=1230 q=-1.0 Lsize= 5783kB time=00:02:27.07 bitrate= 322.1kbits/s speed=41.1x 
 video:3486kB audio:2149kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.641165%
 [aac @ 000001ff716ed2c0] Qavg: 853.082