
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (82)
-
Les vidéos
21 avril 2011, parComme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...) -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users. -
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
Sur d’autres sites (4933)
-
ffmpeg audio - video sync issue (audio ahead of video) - while screen recording using x11grab
12 juillet 2023, par maheshgWhile screen-recording using the below ffmpeg options I consistently get audio ahead of video, delay is in the order of few seconds


ffmpeg cmd :


ffmpeg -y -f x11grab -thread_queue_size 1024 -draw_mouse 0 -video_size 1920x1080 -i :0 -f pulse -thread_queue_size 1024 -i default -c:v libx264 -threads 0 -preset faster -c:a flac -async 1 -vsync 1 -crf 30 -crf_max 33 -f matroska output.mkv


ffprobe output below :


$ ffprobe demo.mkv 
ffprobe version 3.4.4-1~16.04.york0 Copyright (c) 2007-2018 the FFmpeg developers
 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
 configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
 libavutil 55. 78.100 / 55. 78.100
 libavcodec 57.107.100 / 57.107.100
 libavformat 57. 83.100 / 57. 83.100
 libavdevice 57. 10.100 / 57. 10.100
 libavfilter 6.107.100 / 6.107.100
 libavresample 3. 7. 0 / 3. 7. 0
 libswscale 4. 8.100 / 4. 8.100
 libswresample 2. 9.100 / 2. 9.100
 libpostproc 54. 7.100 / 54. 7.100
Input #0, matroska,webm, from 'demo.mkv':
 Metadata:
 ENCODER : Lavf57.71.100
 Duration: 01:00:31.93, start: 0.000000, bitrate: 416 kb/s
 Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
 Metadata:
 ENCODER : Lavc57.89.100 libx264
 DURATION : 01:00:31.928000000
 Stream #0:1: Audio: flac, 48000 Hz, stereo, s16 (default)
 Metadata:
 ENCODER : Lavc57.89.100 flac
 DURATION : 01:00:30.912000000



I have even tried using
avoid_negative_ts
flag, but it didnt help with the sync issue.



OS :
Ubuntu-18.04


ffmpeg version :
3.4




Update : (with ffmpeg-4.0)
I have since split this process into 2 parts and tried as shown below (quality is better, but audio/video sync is still an issue)


# STEP-1: screen recording
/usr/bin/ffmpeg -y -f x11grab -thread_queue_size 1024 -draw_mouse 0 \
-video_size 1920x1080 -i :91141925 -f pulse -thread_queue_size 1024 \
-i virtual_sink.monitor -c:v libx264rgb -threads 0 -preset ultrafast \
-c:a flac -ac 1 -crf 0 -f matroska output.mkv

# STEP-2: audio/video encoding
/usr/bin/ffmpeg -y -i output.mkv -c:v libx264 -threads 0 \
-preset faster -pix_fmt yuv420p -c:a copy -ac 1 -crf 25 \
-f matroska final_output.mkv



STEP-1 uses much less CPU during screen recording, but audio is still ahead of video. the display I am using is
xvfb
one in STEP-1 (since, this is a headless machine in the cloud)

Also, i have tried flags
-filter_complex aresample=44100 -vsync 1
in STEP-1 to no avail.

Can someone please help !




Update 2 : (with latest ffmpeg from git master)


IT WORKED ! THANKS @llogan for the helpful comments.




-
stream 0, timescale not set when concat video using ffmpeg
17 février 2018, par no nameI have 2 video which i want to add them together so i make a text file which contains the file names
file No-fade_25fps.mp4
file video.mp4then i start using this command
ffmpeg -f concat -i ffmpeg-sound.txt -c copy final_output.mp4
the problem is i got this from ffmpeg
[mov,mp4,m4a,3gp,3g2,mj2 @ 0561dbc0] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 0561dbc0] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'out.txt':
Duration: N/A, start: 0.000000, bitrate: 464 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 464 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 2018-02-09T10:36:18.000000Z
handler_name : Core Media Video
Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
Output #0, mp4, to 'final_output.mp4':
Metadata:
encoder : Lavf58.7.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 464 kb/s, 25 fps, 25 tbr, 12800 tbn, 25 tbc
Metadata:
creation_time : 2018-02-09T10:36:18.000000Z
handler_name : Core Media Video
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 05c3e940] Auto-inserting h264_mp4toannexb bitstream filter
frame= 8194 fps=0.0 q=-1.0 Lsize= 2254kB time=46:35:51.68 bitrate= 0.1kbits/s speed=1.19e+006x
video:2157kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.486598%the result give me a video mp4 file with a long duration like 46:33:20 and it not work, and iam sure that both videos have same reslution.
what i tried is to use this command to convert the videoffmpeg -y -i No-fade_25fps.mp4 -r 25 -s 1280x720 -c:v libx264 -b:v 3M -strict -2 -movflags faststart destination.mp4
and when i concate them again it worked and give me result mp4 file which have a right duration and worked fine but without a sound, because the first video file i use is muted no sound in it and second one contains a sound.
my question is how to concate those videos togther without this problem also what make the video have the problem of this long duration and when i convert them using the command line it worked ?
first video info which is No-fade_25fps.mp4[mov,mp4,m4a,3gp,3g2,mj2 @ 03e05000] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'No-fade_25fps.mp4':
Metadata:
major_brand : M4V
minor_version : 1
compatible_brands: M4V M4A mp42isom
creation_time : 2018-02-09T10:36:18.000000Z
keywords : tunepro,orange
album_artist : Kiran Khan
description : This video is about new tunepro
artist : Kiran Khan
title : new tunepro
Duration: 00:00:06.48, start: 0.000000, bitrate: 497 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 464 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)
Metadata:
creation_time : 2018-02-09T10:36:18.000000Z
handler_name : Core Media Video
Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
At least one output file must be specifiedsecond video video.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.7.100
Duration: 00:05:21.28, start: 0.000000, bitrate: 181 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 45 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: mp3 (mp4a / 0x6134706D), 44100 Hz, stereo, s16p, 127 kb/s (default)
Metadata:
handler_name : SoundHandlerwhat i want is to add any number of videos togthers without a problems like this they all have same reslution and frame per second is there something else need to be checked before i start merge videos ?
Update
this what i get when i use the command without copy codec[mov,mp4,m4a,3gp,3g2,mj2 @ 058ddb80] stream 0, timescale not set
[mov,mp4,m4a,3gp,3g2,mj2 @ 058ddb80] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'out.txt':
Duration: N/A, start: 0.000000, bitrate: 464 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 464 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 2018-02-09T10:36:18.000000Z
handler_name : Core Media Video
Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 90k tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 05937d00] using SAR=1/1
[libx264 @ 05937d00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 05937d00] profile High, level 3.1
[libx264 @ 05937d00] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 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, mp4, to 'final_output.mp4':
Metadata:
encoder : Lavf58.7.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
creation_time : 2018-02-09T10:36:18.000000Z
handler_name : Core Media Video
encoder : Lavc58.9.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[mov,mp4,m4a,3gp,3g2,mj2 @ 058ddb80] Auto-inserting h264_mp4toannexb bitstream filtered=3.41x
More than 1000 frames duplicatedand it stop like it’s in infinite loop
-
How encrypt video file using ffmpeg with a single file output
9 décembre 2016, par Akshay KumarI am trying to encrypt a video(mp4) file having a single file output. Here is the command that I use :
ffmpeg -i -c:v libx264 -preset slow -hls_list_size 0 -hls_key_info_file encrypt.keyinfo -f hls -hls_playlist_type vod -hls_time 20 -threads 0 .
However when I play the generated m3u8 file in safari the video stop for seconds(timer goes on) and resume after few seconds. This is happens multiple times in a single video playback.
Can anyone help me to encode video file with single output file.Full command :
/usr/local/bin/ffmpeg -i MJ.mp4 -c:v libx264 -preset slow -hls_list_size 0 -hls_key_info_file encrypt.keyinfo -f hls -hls_playlist_type vod -hls_flags single_file -hls_time 20 -threads 0 encrypted15.m3u8
It’s corresponding console output :
ffmpeg version 3.2.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 8.0.0 (clang-800.0.42.1)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MJ.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.63.104
Duration: 00:04:43.21, start: 0.000000, bitrate: 1070 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 938 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 @ 0x7f8930818200] using SAR=1/1
[libx264 @ 0x7f8930818200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f8930818200] profile High, level 3.1
Output #0, hls, to 'encrypted15.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.56.100
Stream #0:0(und): Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 90k tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.64.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.64.101 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 7079 fps= 64 q=-1.0 Lsize=N/A time=00:04:43.21 bitrate=N/A speed=2.55x
video:30401kB audio:4156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x7f8930818200] frame I:66 Avg QP:16.19 size: 44529
[libx264 @ 0x7f8930818200] frame P:2496 Avg QP:20.09 size: 7995
[libx264 @ 0x7f8930818200] frame B:4517 Avg QP:21.77 size: 1823
[libx264 @ 0x7f8930818200] consecutive B-frames: 5.7% 10.3% 52.4% 31.6%
[libx264 @ 0x7f8930818200] mb I I16..4: 34.7% 39.2% 26.0%
[libx264 @ 0x7f8930818200] mb P I16..4: 4.8% 7.0% 0.7% P16..4: 31.6% 7.1% 2.6% 0.0% 0.0% skip:46.2%
[libx264 @ 0x7f8930818200] mb B I16..4: 0.4% 0.4% 0.0% B16..8: 24.8% 1.6% 0.1% direct: 0.9% skip:71.8% L0:39.4% L1:57.4% BI: 3.2%
[libx264 @ 0x7f8930818200] 8x8 transform intra:52.6% inter:73.7%
[libx264 @ 0x7f8930818200] direct mvs spatial:99.9% temporal:0.1%
[libx264 @ 0x7f8930818200] coded y,uvDC,uvAC intra: 23.4% 41.8% 12.7% inter: 3.8% 6.4% 0.3%
[libx264 @ 0x7f8930818200] i16 v,h,dc,p: 40% 25% 12% 23%
[libx264 @ 0x7f8930818200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 16% 36% 2% 3% 4% 4% 3% 4%
[libx264 @ 0x7f8930818200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 19% 14% 5% 8% 7% 8% 6% 6%
[libx264 @ 0x7f8930818200] i8c dc,h,v,p: 49% 21% 21% 8%
[libx264 @ 0x7f8930818200] Weighted P-Frames: Y:6.7% UV:6.2%
[libx264 @ 0x7f8930818200] ref P L0: 66.8% 10.5% 12.6% 4.9% 5.1% 0.2% 0.0%
[libx264 @ 0x7f8930818200] ref B L0: 82.4% 12.1% 4.5% 1.0%
[libx264 @ 0x7f8930818200] ref B L1: 99.2% 0.8%
[libx264 @ 0x7f8930818200] kb/s:879.53
[aac @ 0x7f8930811e00] Qavg: 7830.089