
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (77)
-
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
Problèmes fréquents
10 mars 2010, parPHP et safe_mode activé
Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site -
Mediabox : ouvrir les images dans l’espace maximal pour l’utilisateur
8 février 2011, parLa visualisation des images est restreinte par la largeur accordée par le design du site (dépendant du thème utilisé). Elles sont donc visibles sous un format réduit. Afin de profiter de l’ensemble de la place disponible sur l’écran de l’utilisateur, il est possible d’ajouter une fonctionnalité d’affichage de l’image dans une boite multimedia apparaissant au dessus du reste du contenu.
Pour ce faire il est nécessaire d’installer le plugin "Mediabox".
Configuration de la boite multimédia
Dès (...)
Sur d’autres sites (5842)
-
Desktop grabbing with FFmpeg at 60 fps using NVENC codec
30 avril 2023, par AkatoshI'm having trouble recording my desktop at 60FPS using the latest Windows compiled FFmpeg with NVENC codec. Metadata says the file is 60 fps but when I play it, I can see clearly see it is not 60FPS.



The command-line I use is the following :



ffmpeg -y -rtbufsize 2000M -f gdigrab -framerate 60 -offset_x 0 -offset_y 0 -video_size 1920x1080 -i desktop -c:v h264_nvenc -preset:v fast -pix_fmt nv12 out.mp4




I tried using a real time buffer, using another DirectShow device, changing the profile or forcing a bitrate, but the video always seems to be at 30fps.



Recording the screen using NVIDIA's ShadowPlay works well, so I know it's feasible on my machine.



Using FFprobe to check the ShadowPlay's output file I can see :





Stream #0:0(und) : Video : h264 (High) (avc1 / 0x31637661), yuv420p(tv,
 smpte170m/smpte170m/bt470m), 1920x1080 [SAR 1:1 DAR 16:9], 4573 kb/s,
 59.38 fps, 240 tbr, 60k tbn, 120 tbc (default)





But If I force my output to have the same bitrate and profile I get :





Stream #0:0(und) : Video : h264 (High) (avc1 / 0x31637661), yuv420p,
 1920x1080 [SAR 1:1 DAR 16:9], 5519 kb/s, 60 fps, 60 tbr, 15360 tbn,
 120 tbc (default)





I can see
tbr
andtbn
are different, so I know my output is duplicating frames.


For testing, all of my recordings had this 60 frame rate test page on the background, and I could clearly see the differences.



I know ShadowPlay probably does a lot more under the hood than FFmpeg using the same codec. I know OBS can do it quite easily but I want to understand what I am doing wrong. Maybe it's some FFmpeg limitation ?



Full console output



Using -v trace command :



[gdigrab @ 0000000002572cc0] Capturing whole desktop as 1920x1080x32 at (0,0)
[gdigrab @ 0000000002572cc0] Cursor pos (1850,750) -> (1842,741)
[gdigrab @ 0000000002572cc0] Probe buffer size limit of 5000000 bytes reached
[gdigrab @ 0000000002572cc0] Stream #0: not enough frames to estimate rate; consider increasing probesize
[gdigrab @ 0000000002572cc0] stream 0: start_time: 1467123648.275 duration: -9223372036854.775
[gdigrab @ 0000000002572cc0] format: start_time: 1467123648.275 duration: -9223372036854.775 bitrate=3981337 kb/s
Input #0, gdigrab, from 'desktop':
 Duration: N/A, start: 1467123648.275484, bitrate: 3981337 kb/s
 Stream #0:0, 1, 1/1000000: Video: bmp, 1 reference frame, bgra, 1920x1080 (0x0), 0/1, 3981337 kb/s, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output file out.mp4.
Applying option c:v (codec name) with argument h264_nvenc.
Applying option pix_fmt (set pixel format) with argument nv12.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[file @ 0000000000e3a7c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'pix_fmt' to value '30'
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 000000000257ec00] Setting 'frame_rate' to value '60/1'
[graph 0 input from stream 0:0 @ 000000000257ec00] w:1920 h:1080 pixfmt:bgra tb:1/1000000 fr:60/1 sar:0/1 sws_param:flags=2
[format @ 000000000257ffc0] compat: called with args=[nv12]
[format @ 000000000257ffc0] Setting 'pix_fmts' to value 'nv12'
[auto-inserted scaler 0 @ 00000000025802c0] Setting 'flags' to value 'bicubic'
[auto-inserted scaler 0 @ 00000000025802c0] w:iw h:ih flags:'bicubic' interl:0
[format @ 000000000257ffc0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0000000000e373c0] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
[auto-inserted scaler 0 @ 00000000025802c0] w:1920 h:1080 fmt:bgra sar:0/1 -> w:1920 h:1080 fmt:nv12 sar:0/1 flags:0x4
[h264_nvenc @ 0000000000e3ca20] Nvenc initialized successfully
[h264_nvenc @ 0000000000e3ca20] 1 CUDA capable devices found
[h264_nvenc @ 0000000000e3ca20] [ GPU #0 - < GeForce GTX 670 > has Compute SM 3.0 ]
[h264_nvenc @ 0000000000e3ca20] supports NVENC
[mp4 @ 0000000000e3b580] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'out.mp4':
 Metadata:
 encoder : Lavf57.40.101
 Stream #0:0, 0, 1/15360: Video: h264 (h264_nvenc) (Main), 1 reference frame ([33][0][0][0] / 0x0021), nv12, 1920x1080, 0/1, q=-1--1, 2000 kb/s, 60 fps, 15360 tbn, 60 tbc
 Metadata:
 encoder : Lavc57.47.100 h264_nvenc
 Side data:
 cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
Stream mapping:
 Stream #0:0 -> #0:0 (bmp (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[gdigrab @ 0000000002572cc0] Cursor pos (1850,750) -> (1842,741)
*** 35 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1850,750) -> (1842,741)
*** 7 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1850,649) -> (1850,649)
*** 1 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1858,535) -> (1858,535)
*** 3 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1859,454) -> (1859,454)
*** 2 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1865,384) -> (1865,384)
*** 2 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1846,348) -> (1846,348)
*** 3 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1770,347) -> (1770,347)
*** 2 dup!
[gdigrab @ 0000000002572cc0] Cursor pos (1545,388) -> (1545,388)
*** 4 dup!
frame= 69 fps=0.0 q=35.0 size= 184kB time=00:00:00.63 bitrate=2384.0kbits/[gdigrab @ 0000000002572cc0] Cursor pos (1523,389) -> (1519,378)



-
ffmpeg : avfilter's anull says "Rematrix is needed between stereo and 0 channels but there is not enough information to do it"
12 juillet 2017, par kuanyuiI’m trying to write a transcoder according to FFMpeg’s official example with ffmpeg 3.2.4 (official prebuild Win32), and try to transcode a video with stereo audio stream source (from
avformat
’sdshow
).In the example code, which passes
anull
intoavfilter_graph_parse_ptr()
for audio stream, and"time_base=1/44100:sample_rate=44100:sample_fmt=s16:channels=2:channel_layout=0x3"
is passed intoavfilter_graph_create_filter()
, occurs error in the followingavfilter_graph_config()
:[auto-inserted scaler 0 @ 32f77600] w:iw h:ih flags:'bilinear' interl:0
[Parsed_null_0 @ 2e9d79a0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'in' and the filter 'Parsed_null_0'
[swscaler @ 3331bfe0] deprecated pixel format used, make sure you did set range correctly
[auto-inserted scaler 0 @ 32f77600] w:1920 h:1080 fmt:yuvj422p sar:1/1 -> w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x2
[libmp3lame @ 2e90a360] Channel layout not specified
[in @ 3866e8a0] tb:1/44100 samplefmt:s16 samplerate:44100 chlayout:0x3
[Parsed_anull_0 @ 330e8820] auto-inserting filter 'auto-inserted resampler 0' between the filter 'in' and the filter 'Parsed_anull_0'
[auto-inserted resampler 0 @ 330e8dc0] [SWR @ 3809b620] Rematrix is needed between stereo and 0 channels but there is not enough information to do it
[auto-inserted resampler 0 @ 330e8dc0] Failed to configure output pad on auto-inserted resampler 0I’ve googled for days but didn’t find any clue for it. Doesn’t what
anull
do is only "Pass the audio source unchanged to the output", why libav want to resample stereo to 0 channel ? What’s going wrong ? -
Shaking/trembling in video slideshow generated by frames from an image
18 mai 2017, par razielI have a PHP program which is used to generate a video slideshow from the series of images. Basically, I just need to smoothly ‘move’ from one image area to the another one according to the specified top/left coordinates and width/height area of the image. In order to do smooth movement, I use easing functions during the coordinates calculations for the each of video frame. I make an jpeg image frame based on these calculations using PHP’s Imagick library, then I combine all the generated frames into a single video using ffmpeg command.
<?php
const TEMP_FRAMES_DIR = __DIR__;
const VIDEO_WIDTH = 1080;
const VIDEO_HEIGHT = 720;
const FPS = 30;
const MOVEMENT_DURATION_SECONDS = 3;
const IMAGE_PATH = __DIR__ . '/test_image.png';
$start_coords = [
'x' => 100,
'y' => 100,
'width' => 480,
'height' => 270
];
$end_coords = [
'x' => 400,
'y' => 200,
'width' => 480,
'height' => 270
];
$timeline = make_timeline($start_coords, $end_coords);
render_frames(IMAGE_PATH, $timeline);
render_video_from_frames();
function make_timeline($start_coords, $end_coords) {
$timeline = [];
$total_frames = MOVEMENT_DURATION_SECONDS * FPS;
$x_change = $end_coords['x'] - $start_coords['y'];
$y_change = $end_coords['y'] - $start_coords['y'];
$width_change = $end_coords['width'] - $start_coords['width'];
$height_change = $end_coords['height'] - $start_coords['height'];
for ($i = 0; $i < $total_frames; $i++) {
$timeline[$i] = [
'x' => easingOutExpo($i, $start_coords['x'], $x_change, $total_frames),
'y' => easingOutExpo($i, $start_coords['y'], $y_change, $total_frames),
'width' => easingOutExpo($i, $start_coords['width'], $width_change, $total_frames),
'height' => easingOutExpo($i, $start_coords['height'], $height_change, $total_frames)
];
}
return $timeline;
}
function render_frames($image_path, $timeline) {
$image = new Imagick($image_path);
//remove frames from the previous render
array_map('unlink', glob( TEMP_FRAMES_DIR . "/frame*" ));
foreach ($timeline as $frame_number => $frame) {
$frame_img = clone $image;
$frame_img->cropImage($frame["width"],$frame["height"], $frame["x"],$frame["y"]);
$frame_img->resizeImage(VIDEO_WIDTH, VIDEO_HEIGHT, imagick::FILTER_LANCZOS, 0.9);
$frame_img->writeImage(TEMP_FRAMES_DIR. "/frame$frame_number.jpg");
}
}
function render_video_from_frames() {
$fps = FPS;
$frames_dir = TEMP_FRAMES_DIR;
$SEP = DIRECTORY_SEPARATOR;
$video_file = $frames_dir. $SEP . 'video.mp4';
if (file_exists($video_file)) unlink($video_file);
system("ffmpeg -framerate $fps -i $frames_dir{$SEP}frame%01d.jpg $video_file");
}
function easingOutExpo($t, $b, $c, $d) {
return $c * ( -pow( 2, -10 * $t/$d ) + 1 ) + $b;
}The problem is that I have annoying shaking/trembling when I need to move at a low speed (like at the end of easing out expo function).
Here you can get the test video with the problem, the test image which was used and the PHP script :
https://drive.google.com/drive/u/1/folders/0B9FOrF6IlWaGeHJCS1h6djhVZ28You can see this shaking starting from the middle of the test video ( 1.5 sec).
How can I avoid shaking in such kind of situations ? Thanks in advance !