
Recherche avancée
Autres articles (111)
-
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 -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (11682)
-
FFMPEG Streaming to twitch low bitrate
17 juillet 2020, par El_PresidenteI have a python script that will produce frames for a video stream. To stream it to twitch I decided to use ffmpeg (as it is the only option I found). However, the bitrate of my stream is very low (70 KB), although in ffmpeg options it's set to 3000K.


# This script copies the video frame by frame
import cv2
import subprocess as sp
twitch_stream_key = 'MY_TWITCH_STREAM_KEY'
input_file = 'video.mp4'

cap = cv2.VideoCapture(input_file)
ret, frame = cap.read()
height, width, ch = frame.shape

ffmpeg = 'FFMPEG'
dimension = '{}x{}'.format(width, height)

fps = cap.get(cv2.CAP_PROP_FPS)
command = []
command.extend([
 'FFMPEG',
 '-loglevel', 'verbose',
 '-y', # overwrite previous file/stream
 '-analyzeduration', '1',
 '-f', 'rawvideo',
 '-r', '%d' % fps, # set a fixed frame rate
 '-vcodec', 'rawvideo',
 # size of one frame
 '-s', '%dx%d' % (width, height),
 '-pix_fmt', 'rgb24', # The input are raw bytes
 '-thread_queue_size', '1024',
 '-i', '-', # The input comes from a pipe
]) 
command.extend([
 '-ar', '8000',
 '-ac', '1',
 '-f', 's16le',
 '-i', 'work.mp3',
])
command.extend([
 # VIDEO CODEC PARAMETERS
 '-vcodec', 'libx264',
 '-r', '%d' % fps,
 '-b:v', '3000k',
 '-s', '%dx%d' % (width, height),
 '-preset', 'faster', '-tune', 'zerolatency',
 '-crf', '23',
 '-pix_fmt', 'yuv420p',

 '-minrate', '3000k', '-maxrate', '3000k',
 '-bufsize', '12000k',
 '-g', '60', # key frame distance
 '-keyint_min', '1',

 # AUDIO CODEC PARAMETERS
 '-acodec', 'libmp3lame', '-ar', '44100', '-b:a', '160k',
 # '-bufsize', '8192k',
 '-ac', '1',
 '-map', '0:v', '-map', '1:a',

 '-threads', '2',
 # STREAM TO TWITCH
 '-f', 'flv', 'rtmp://live-hel.twitch.tv/app/%s' %
 twitch_stream_key
])
proc = sp.Popen(command, stdin=sp.PIPE, stderr=sp.PIPE)

while True:
 ret, frame = cap.read() 
 if not ret: 
 break 
 proc.stdin.write(frame.tostring())

cap.release()
proc.stdin.close()
proc.stderr.close()
proc.wait()



How can I increase the bitrate ? Maybe you can point me towards some different solution on how I can stream python frames to twitch or any other rtmp server.


Here is the complete log, the audio is also broken, it's just noise :


ffmpeg version git-2020-06-01-dd76226 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 9.3.1 (GCC) 20200523
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
 libavutil 56. 49.100 / 56. 49.100
 libavcodec 58. 90.100 / 58. 90.100
 libavformat 58. 44.100 / 58. 44.100
 libavdevice 58. 9.103 / 58. 9.103
 libavfilter 7. 84.100 / 7. 84.100
 libswscale 5. 6.101 / 5. 6.101
 libswresample 3. 6.100 / 3. 6.100
 libpostproc 55. 6.100 / 55. 6.100
Input #0, rawvideo, from 'pipe:':
 Duration: N/A, start: 0.000000, bitrate: 1443225 kb/s
 Stream #0:0: Video: rawvideo, 1 reference frame (RGB[24] / 0x18424752), rgb24, 1920x1080, 1443225 kb/s, 29 tbr, 29 tbn, 29 tbc
[s16le @ 0000026d64eb5340] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, s16le, from 'work.mp3':
 Metadata:
 encoded_by : iTunes v7.0
 Duration: 00:09:36.13, bitrate: 128 kb/s
 Stream #1:0: Audio: pcm_s16le, 8000 Hz, mono, s16, 128 kb/s
[tcp @ 0000026d64ee34c0] Starting connection attempt to 99.181.64.78 port 1935
[tcp @ 0000026d64ee34c0] Successfully connected to 99.181.64.78 port 1935
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
 Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
[graph 0 input from stream 0:0 @ 0000026d64f47c00] w:1920 h:1080 pixfmt:rgb24 tb:1/29 fr:29/1 sar:0/1
[scaler_out_0_0 @ 0000026d64f4c780] w:1920 h:1080 flags:'bicubic' interl:0
[scaler_out_0_0 @ 0000026d64f4c780] w:1920 h:1080 fmt:rgb24 sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x4
[libx264 @ 0000026d64edf840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000026d64edf840] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0000026d64edf840] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=4 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=60 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3000 vbv_bufsize=12000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
[graph_1_in_1_0 @ 0000026d651319c0] tb:1/8000 samplefmt:s16 samplerate:8000 chlayout:0x4
[format_out_0_1 @ 0000026d65132d80] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[auto_resampler_0 @ 0000026d651331c0] ch:1 chl:mono fmt:s16 r:8000Hz -> ch:1 chl:mono fmt:s16p r:44100Hz
Output #0, flv, to 'rtmp://live-hel.twitch.tv/app/live_*************':
 Metadata:
 encoder : Lavf58.44.100
 Stream #0:0: Video: h264 (libx264), 1 reference frame ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=-1--1, 3000 kb/s, 29 fps, 1k tbn, 29 tbc
 Metadata:
 encoder : Lavc58.90.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 3000000/0/3000000 buffer size: 12000000 vbv_delay: N/A
 Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, mono, s16p, delay 1105, 160 kb/s
 Metadata:
 encoder : Lavc58.90.100 libmp3lame



-
ffmpeg : xstack doesn't work when inputs are scaled to certain dimensions
4 juin 2020, par dfriend21I'm using ffmpeg to create a mosaic of videos using the
xstack
filter. The input videos may come in varying dimensions, so I'm using thescale
filter to scale them beforehand, and I'm using theforce_original_aspect_ratio
option and then thepad
filter to keep the original aspect ratios of each video and add black bars to the sides to make each video have the correct dimensions.


I have a command that's working - however, it's inconsistent. For some dimensions it works, while for others it doesn't.



I'm using the
fluent-ffmpeg
Node.js module to callffmpeg
from Node.js. To do this, I'm passing an array of strings to thecomplexFilter()
function.


The following strings for the complex filter works :



"[0:v]scale=400:250:force_original_aspect_ratio=decrease,pad=400:250:(ow-iw)/2:(oh-ih)/2 [s0]"
"[1:v]scale=400:250:force_original_aspect_ratio=decrease,pad=400:250:(ow-iw)/2:(oh-ih)/2 [s1]"
"[s0][s1]xstack=inputs=2:fill='black':layout=0_0|w0_0[v]"
"[0:a][1:a]amix=inputs=2[a]"




However, if I change the output dimensions of each video to be 400:225 instead of 400:250 it fails.



"[0:v]scale=400:225:force_original_aspect_ratio=decrease,pad=400:225:(ow-iw)/2:(oh-ih)/2 [s0]"
"[1:v]scale=400:225:force_original_aspect_ratio=decrease,pad=400:225:(ow-iw)/2:(oh-ih)/2 [s1]"
"[s0][s1]xstack=inputs=2:fill='black':layout=0_0|w0_0[v]"
"[0:a][1:a]amix=inputs=2[a]"




The following error is given :



An error occurred: ffmpeg exited with code 1: Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:1
Conversion failed!




If it's relevant, the first video has dimensions of 1280x720 while the second video has dimensions of 320x240.



Anyone know why one set of dimensions works while the other doesn't ?



EDIT : Here is the full ffmpeg log for when it fails :



ffmpeg version git-2020-05-13-b12b053 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 9.3.1 (GCC) 20200513
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
 libavutil 56. 45.100 / 56. 45.100
 libavcodec 58. 84.100 / 58. 84.100
 libavformat 58. 43.100 / 58. 43.100
 libavdevice 58. 9.103 / 58. 9.103
 libavfilter 7. 80.100 / 7. 80.100
 libswscale 5. 6.101 / 5. 6.101
 libswresample 3. 6.100 / 3. 6.100
 libpostproc 55. 6.100 / 55. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/Users/user_name/Desktop/vids/vid1.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: mp41isom
 creation_time : 2020-05-21T15:52:20.000000Z
 Duration: 00:00:10.76, start: 0.000000, bitrate: 8385 kb/s
 Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 1280x720 [SAR 1:1 DAR 16:9], 8237 kb/s, 29.99 fps, 30 tbr, 30k tbn, 60 tbc (default)
 Metadata:
 creation_time : 2020-05-21T15:52:20.000000Z
 handler_name : VideoHandler
 encoder : AVC Coding
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 165 kb/s (default)
 Metadata:
 creation_time : 2020-05-21T15:52:20.000000Z
 handler_name : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'C:/Users/user_name/Desktop/vids/vid2.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: mp41isom
 creation_time : 2020-05-21T15:54:37.000000Z
 Duration: 00:00:11.01, start: 0.000000, bitrate: 836 kb/s
 Stream #1:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc), 320x240 [SAR 1:1 DAR 4:3], 669 kb/s, 29.88 fps, 30 tbr, 30k tbn, 60 tbc (default)
 Metadata:
 creation_time : 2020-05-21T15:54:37.000000Z
 handler_name : VideoHandler
 encoder : AVC Coding
 Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 163 kb/s (default)
 Metadata:
 creation_time : 2020-05-21T15:54:37.000000Z
 handler_name : SoundHandler
Stream mapping:
 Stream #0:0 (h264) -> scale
 Stream #0:1 (aac) -> amix:input0
 Stream #1:0 (h264) -> scale
 Stream #1:1 (aac) -> amix:input1
 xstack -> Stream #0:0 (libx264)
 amix -> Stream #0:1 (aac)
Press [q] to stop, [?] for help
[swscaler @ 000001343fefc200] deprecated pixel format used, make sure you did set range correctly
[Parsed_pad_1 @ 000001343f8dc3c0] Padded dimensions cannot be smaller than input dimensions.
[Parsed_pad_1 @ 000001343f8dc3c0] Failed to configure input pad on Parsed_pad_1
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:1
Conversion failed!

Done in 0.66s.



-
can i speedup text watermarking on ffmpeg ?
3 juin 2020, par Easy Tricks For AndroidThis command i used
ffmpeg -i "1.mp4" -vf "drawtext=text='watermak_name':x=w-tw-50:y=h-th-50:fontfile=/Windows/fonts/calibri.ttf:fontsize=20:fontcolor=white:shadowcolor=black:shadowx=2:shadowy=2" "output.mp4"
. watermark is working with this command, but it takes more time up-to 3 hours +


this is the log i got from cmd



D :>ffmpeg -i "1.mp4" -vf "drawtext=text='watermak_name':x=w-tw-50:y=h/2-th:fontfile=/Windows/fonts/
courbd.ttf:fontsize=20:fontcolor=white" -max_muxing_queue_size 9999 "1_out.mp4"


ffmpeg version git-2020-05-23-26b4509 Copyright (c) 2000-2020 the FFmpeg developers

 built with gcc 9.3.1 (GCC) 20200523

 configuration : —enable-gpl —enable-version3 —enable-sdl2 —enable-fontconfig —enable-gnutls —enable-iconv
—enable-libass —enable-libdav1d —enable-libbluray —enable-libfreetype —enable-libmp3lame
—enable-libopencore-amrnb —enable-libopencore-amrwb —enable-libopenjpeg —enable-libopus —enable-libshine
—enable-libsnappy —enable-libsoxr —enable-libsrt —enable-libtheora —enable-libtwolame —enable-libvpx
—enable-libwavpack —enable-libwebp —enable-libx264 —enable-libx265 —enable-libxml2 —enable-libzimg
—enable-lzma —enable-zlib —enable-gmp —enable-libvidstab —enable-libvmaf —enable-libvorbis
—enable-libvo-amrwbenc —enable-libmysofa —enable-libspeex —enable-libxvid —enable-libaom
—disable-w32threads —enable-libmfx —enable-ffnvcodec —enable-cuda-llvm —enable-cuvid —enable-d3d11va
—enable-nvenc —enable-nvdec —enable-dxva2 —enable-avisynth —enable-libopenmpt —enable-amf

 libavutil 56. 48.100 / 56. 48.100

 libavcodec 58. 87.101 / 58. 87.101

 libavformat 58. 43.100 / 58. 43.100

 libavdevice 58. 9.103 / 58. 9.103

 libavfilter 7. 83.100 / 7. 83.100

 libswscale 5. 6.101 / 5. 6.101

 libswresample 3. 6.100 / 3. 6.100

 libpostproc 55. 6.100 / 55. 6.100

Truncating packet of size 95 to 83

Input #0, matroska,webm, from 'Uriyadi.mkv' :

 Metadata :

 title : Downloaded From ABCD

 encoder : Downloaded From ABCD

 creation_time : 2020-05-22T16:44:46.000000Z

 Duration : 02:11:50.86, start : 0.000000, bitrate : 750 kb/s

 Stream #0:0(mal) : Video : h264 (High), yuv420p(progressive), 720x304 [SAR 1:1 DAR 45:19], 25 fps, 25 tbr, 1k
tbn, 50 tbc (default)

 Metadata :

 title : Downloaded From ABCD

 Stream #0:1(mal) : Audio : mp3, 48000 Hz, stereo, fltp, 65 kb/s (default)

 Metadata :

 title : Downloaded From ABCD

Stream mapping :

 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))

 Stream #0:1 -> #0:1 (mp3 (mp3float) -> vorbis (libvorbis))

Press [q] to stop, [?] for help

Fontconfig error : Cannot load default config file

[Parsed_drawtext_0 @ 000001a470fe3f00] Using "C :/Windows/fonts/mingliub.ttc"

[libx264 @ 000001a470a10600] using SAR=1/1

[libx264 @ 000001a470a10600] using cpu capabilities : MMX2 SSE2Fast SSSE3 SSE4.2 AVX

[libx264 @ 000001a470a10600] profile High, level 3.0, 4:2:0, 8-bit

[libx264 @ 000001a470a10600] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 -
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=9 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, matroska, to '1_out.mp4' :

 Metadata :

 title : Downloaded From ABCD

 encoder : Lavf58.43.100

 Stream #0:0(mal) : Video : h264 (libx264) (H264 / 0x34363248), yuv420p, 720x304 [SAR 1:1 DAR 45:19], q=-1—1,
25 fps, 1k tbn, 25 tbc (default)

 Metadata :

 title : Downloaded From ABCD

 encoder : Lavc58.87.101 libx264

 Side data :

 cpb : bitrate max/min/avg : 0/0/0 buffer size : 0 vbv_delay : N/A

 Stream #0:1(mal) : Audio : vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz, stereo, fltp (default)

 Metadata :

 title : Downloaded From ABCD

 encoder : Lavc58.87.101 libvorbis

frame=35791 fps=308 q=28.0 size= 107264kB time=00:23:52.10 bitrate= 613.6kbits/s speed=12.3x