
Recherche avancée
Autres articles (89)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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 (14967)
-
How to use FFMPEG with Nvidia Acceleration (Nvenc) to hardcode / burn in subtitles
11 février 2024, par Ibraheem NofalSo I'm trying to use Nvenc to accelerate video encoding. The aim is to have 1 input video file and 1 input subtitle, and to get multiple outputs at different resolutions with subtitles hardcoded or burned into the video. I've tried multiple approaches but can't figure out how to do it.


Here's the command that I'm currently using :


ffmpeg -hwaccel cuvid -i 3030025890-TEST.mp4 -i output_ar.srt -filter_complex "[0:v]scale_npp=1920:1080, hwdownload,format=nv12[base], [base]subtitles=output_ar.srt[marked]" -map "[marked]" -c:v h264_nvenc -map 0:v:0 -map 0:a:0 -g 50 -b:v 5M -maxrate 5.5M -minrate 4M -bufsize 5M -preset fast 1080_output.mp4



and here's the output :


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '3030025890-TEST.mp4':
 Metadata:
 major_brand : M4V 
 minor_version : 1
 compatible_brands: isomavc1mp42
 creation_time : 2021-01-05T13:45:58.000000Z
 Duration: 00:45:04.28, start: 0.000000, bitrate: 5574 kb/s
 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5000 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Video Media Handler
 encoder : Elemental H.264
 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:2(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:3(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:4(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:5(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:6(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
Input #1, srt, from 'output_ar.srt':
 Duration: N/A, bitrate: N/A
 Stream #1:0: Subtitle: subrip
[Parsed_subtitles_3 @ 0x5601070b1dc0] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x5601070b1dc0] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x5601070b1dc0] Using font provider fontconfig
Stream mapping:
 Stream #0:0 (h264) -> scale_npp (graph 0)
 subtitles (graph 0) -> Stream #0:0 (h264_nvenc)
 Stream #0:0 -> #0:1 (h264 (native) -> h264 (h264_nvenc))
 Stream #0:1 -> #0:2 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x56010792f980] Error creating a NVDEC decoder: 1
[h264 @ 0x56010792f980] Failed setup for format cuda: hwaccel initialisation returned error.
[Parsed_subtitles_3 @ 0x560107364cc0] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x560107364cc0] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x560107364cc0] Using font provider fontconfig
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[aac @ 0x56010734d400] Qavg: 65536.000
[aac @ 0x56010734d400] 2 frames left in the queue on closing
Conversion failed!



Edit : Made some progress. I now no longer get an error, but upon viewing the output, there's no subtitles burned in.
Command :


ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 3030025890-TEST.mp4 -c:v h264_nvenc -map 0:v:0 -map 0:a:0 -g 50 -b:v 5M -maxrate 5.5M -minrate 4M -bufsize 5M -vf "scale_npp=1920:1080, hwdownload, format=nv12, subtitles=output_ar.srt, hwupload" -preset fast 1080_output.mp4



-
How to use FFMPEG with Nvidia Acceleration (Nvenc) to hardcode subtitles
21 février 2021, par Ibraheem NofalSo I'm trying to use Nvenc to accelerate video encoding. The aim is to have 1 input video file and 1 input subtitle, and to get multiple outputs at different resolutions with subtitles hardcoded or burned into the video. I've tried multiple approaches but can't figure out how to do it.


Here's the command that I'm currently using :


ffmpeg -hwaccel cuvid -i 3030025890-TEST.mp4 -i output_ar.srt -filter_complex "[0:v]scale_npp=1920:1080, hwdownload,format=nv12[base], [base]subtitles=output_ar.srt[marked]" -map "[marked]" -c:v h264_nvenc -map 0:v:0 -map 0:a:0 -g 50 -b:v 5M -maxrate 5.5M -minrate 4M -bufsize 5M -preset fast 1080_output.mp4



and here's the output :


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '3030025890-TEST.mp4':
 Metadata:
 major_brand : M4V 
 minor_version : 1
 compatible_brands: isomavc1mp42
 creation_time : 2021-01-05T13:45:58.000000Z
 Duration: 00:45:04.28, start: 0.000000, bitrate: 5574 kb/s
 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5000 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Video Media Handler
 encoder : Elemental H.264
 Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:2(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:3(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:4(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:5(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
 Stream #0:6(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 93 kb/s (default)
 Metadata:
 creation_time : 2021-01-05T13:45:58.000000Z
 handler_name : ETI ISO Audio Media Handler
Input #1, srt, from 'output_ar.srt':
 Duration: N/A, bitrate: N/A
 Stream #1:0: Subtitle: subrip
[Parsed_subtitles_3 @ 0x5601070b1dc0] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x5601070b1dc0] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x5601070b1dc0] Using font provider fontconfig
Stream mapping:
 Stream #0:0 (h264) -> scale_npp (graph 0)
 subtitles (graph 0) -> Stream #0:0 (h264_nvenc)
 Stream #0:0 -> #0:1 (h264 (native) -> h264 (h264_nvenc))
 Stream #0:1 -> #0:2 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x56010792f980] Error creating a NVDEC decoder: 1
[h264 @ 0x56010792f980] Failed setup for format cuda: hwaccel initialisation returned error.
[Parsed_subtitles_3 @ 0x560107364cc0] Shaper: FriBidi 0.19.7 (SIMPLE)
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x560107364cc0] No usable fontconfig configuration file found, using fallback.
Fontconfig error: Cannot load default config file
[Parsed_subtitles_3 @ 0x560107364cc0] Using font provider fontconfig
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
[aac @ 0x56010734d400] Qavg: 65536.000
[aac @ 0x56010734d400] 2 frames left in the queue on closing
Conversion failed!



Edit : Made some progress. I now no longer get an error, but upon viewing the output, there's no subtitles burned in.
Command :


ffmpeg -hwaccel cuvid -c:v h264_cuvid -i 3030025890-TEST.mp4 -c:v h264_nvenc -map 0:v:0 -map 0:a:0 -g 50 -b:v 5M -maxrate 5.5M -minrate 4M -bufsize 5M -vf "scale_npp=1920:1080, hwdownload, format=nv12, subtitles=output_ar.srt, hwupload" -preset fast 1080_output.mp4



-
Mixing various audio and video sources into a single video
18 février 2021, par BasjI've already read FFmpeg - Overlay one video onto another video ?, How to overlay 2 videos at different time over another video in single ffmpeg command ?, FFmpeg - Multiple videos with 4 areas and different play times (and many similar questions tagged
[ffmpeg]
aboutsetpts
), and the following code is working, but I'm sure we can simplify it, and have a more elegant solution.

I'd like to mix multiple sources (image and sound) , with different starting points :


t (seconds) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 
test.png [-------------------------------]
a.mp3 [-------]
without_sound.mp4 [-------------------] (overlay at x,y=200,200)
b.mp3 [---]
with_sound.mp4 [---------------------------------------] (overlay at x,y=100,100)



This works :


ffmpeg -i test.png 
 -t 2 -i a.mp3 
 -t 5 -i without_sound.mp4 
 -t 1 -i b.mp3 
 -t 10 -i with_sound.mp4 
 -filter_complex "
 [0]setpts=PTS-STARTPTS[s0];
 [1]adelay=2000^|2000[s1];
 [2]setpts=PTS-STARTPTS+7/TB[s2];
 [3]adelay=5000^|5000[s3];
 [4]setpts=PTS-STARTPTS+3/TB[s4];
 [4:a]adelay=3000^|3000[t4];
 [s1][s3][t4]amix=inputs=3[outa];
 [s0][s4]overlay=100:100[o2];
 [o2][s2]overlay=200:200[outv]
 " -map [outa] -map [outv]
 out.mp4 -y



but :


- 

-
is it normal that we have to use both
setpts
andadelay
? I have tried withoutadelay
and then the sound is not shifted. Said differently, is there a way to simplify :

[4]setpts=PTS-STARTPTS+3/TB[s4];
[4:a]adelay=3000^|3000[t4];



?


-
is there a way to do it with
setpts
andasetpts
only ? When I replacedadelay=5000|5000
withasetpts=PTS-STARTPTS+5/TB
and also for the other one, it didn't give the expected time-shifting (see below)

-
in similar questions/answers I often see
overlay=...:enable='between(t,...,...)'
, here it seems it is not needed, why ?









More generally, how would you simplify this "mix multiple audio and video"
ffmpeg
code ?


More details about the second bullet point : if we replace
adelay
byasetpts
,

-filter_complex "
 [0]setpts=PTS-STARTPTS[s0];
 [1]asetpts=PTS-STARTPTS+2/TB[s1];
 [2]setpts=PTS-STARTPTS+7/TB[s2];
 [3]asetpts=PTS-STARTPTS+5/TB[s3];
 [4]setpts=PTS-STARTPTS+3/TB[s4];
 [4:a]asetpts=PTS-STARTPTS+3/TB[t4];
 [s1][s3][t4]amix=inputs=3[outa];
 [s0][s4]overlay=100:100[o2];
 [o2][s2]overlay=200:200[outv]



it doesn't work : [3] should begin at 0'05", and [4:a] at 0'03" but they all begin at the same time than [1], i.e. at 0'02".


It seems that
amix
only takes the firstasetpts
in consideration, and discards the others ; is it true ?

-