
Recherche avancée
Autres articles (48)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (11530)
-
ffmpeg audio out of sync with video stacking
3 avril 2024, par s0mbreThe problem


When trying to do horizontal stacking of two videos in
ffmpeg
, the combined audio track loses sync with the video on the second input. As far as I've look it up, this problem is very common, not to say notorious withffmpeg
.

I do hstack muxing like this :


ffmpeg -i 1.mp4 -i 2.mp4 -filter_complex \
"[0:v]scale=1280:-2,crop=w=640:h=720:x=0[v1]; \
[1:v]scale=1280:-2,crop=w=640:h=720:x=0[v2]; \
[v1][v2]hstack=shortest=1[v]; \
[0:a][1:a]amix=duration=shortest[a]" \
-map [v] -map [a] -c:v libx264 -c:a libmp3lame -r 30 -y stuff/out.mp4



It encodes just fine as far as the hsplit goes. But the resulting video is out of sync with the audio : the second input (located on the right side in the resulting split) demonstrates about 3 sec. audio off-syncking, where the audio track is ahead of the picture. I realize this is somehow connected with the source videos' timestamps, but no popular remediation recipes helped (see below).


What I expect


I'd expect a resulting stacked video where the audio track is muxed with exact correspondence to the original input pictures.


What I tried (all in vain !)


Something I've tried but to no avail :


- 

- Appending
-async 1
option as suggested here and here - Using the
aresample=async=1
oraresample=async=1000
filter on each audio input as suggested here and here - Padding each audio track with
apad
as suggested here - Using the
adelay=0
andadelay=[delay]s
filters on the failing input - Changing the audio codec to a number of alternatives (aac etc.)
- Infinite combinations of 1-5 above...














What seems indeed to work is manual passing a delay value to the
-itsoffset
filter as suggested here and in the docs and using the offset track as an extra (pure audio) input. But how do I find the exact offset with a different set of videos ?

In short, I am at a standstill after 7+ days of ravenous search-and-try.


- Appending
-
ffmpeg command produces black image as output
3 mars 2020, par Nishad DESHMUKHInput #0, video4linux2,v4l2, from ’/dev/video0’ :
Duration : N/A, start : 13555.753906, bitrate : 147456 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping :
Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x55fd0eafa3e0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to ’test1.jpeg’ :Metadata :
encoder : Lavf57.83.100
Stream #0:0: Video: mjpeg, yuvj422p(pc), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1frame= 1 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=8.41x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead : unknown
-
ffmpeg add semi transparent watermark(png) with different size
20 septembre 2016, par ArcherI’m trying to add a png watermark (with alpha channel) over h264 video with semi transparent. By using overlay filter I managed to add watermark to the video.
ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0][1] overlay=0:0" -c:v libx264 -an output.mp4
But overlay filter does not provide transparent option. So I tried to use blend filter. However, when I use origin resolution, error message comes out.
ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0][1]blend=all_mode=overlay:all_opacity=0.3" -c:v libx264 -an output.mp4
Output :
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.41.100
Duration: 00:00:45.08, start: 0.000000, bitrate: 1872 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 1869 kb/s, 29.72 fps, 30 tbr, 16k tbn, 32k tbc (default)
Metadata:
handler_name : VideoHandler
Input #1, png_pipe, from 'watermark.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 64x64, 25 tbr, 25 tbn, 25 tbc
[Parsed_blend_0 @ 00750600] First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (64x64, SAR 0:1)
[Parsed_blend_0 @ 00750600] Failed to configure output pad on Parsed_blend_0
Error configuring complex filters.
Invalid argumentThe result looks like some resolution issue with the parameters. So that I tried to scale the watermark before blending.
ffmpeg -y -i input.mp4 -i watermark.png -filter_complex "[0:0]scale=1920x1080[a]; [1:0]scale=1920x1080[b]; [a][b]blend=all_mode=overlay:all_opacity=0.3" -c:v libx264 -an output.mp4
FFMPEG works with these parameters. But the output wasn’t I expected, because watermark had been stretched.
Any idea to blend watermark with different resolution without stretching to video with transparency ?Here are the testing file. (ffmpeg version 3.1.2)
https://drive.google.com/open?id=0B2X3VLS01TogdHVJZ2I1ZC1GUUU
https://drive.google.com/open?id=0B2X3VLS01TogbjhuZTlBOFFpN1k