
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (81)
-
Formulaire personnalisable
21 juin 2013, parCette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire. (...) -
Qu’est ce qu’un masque de formulaire
13 juin 2013, parUn masque de formulaire consiste en la personnalisation du formulaire de mise en ligne des médias, rubriques, actualités, éditoriaux et liens vers des sites.
Chaque formulaire de publication d’objet peut donc être personnalisé.
Pour accéder à la personnalisation des champs de formulaires, il est nécessaire d’aller dans l’administration de votre MediaSPIP puis de sélectionner "Configuration des masques de formulaires".
Sélectionnez ensuite le formulaire à modifier en cliquant sur sont type d’objet. (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)
Sur d’autres sites (5958)
-
Multiple Dialogue lines of an ASS subtitle file is displayed at the same time on the video file
14 janvier 2024, par Furkan GözükaraI am trying to code an ASS subtitle burner.


Converting given SRT file into ASS subtitle


Let me show examples


Below is given SRT file - generated with Whisper


1
00:00:00,000 --> 00:00:00,080
<u>American</u> XL Bully Dog

2
00:00:00,080 --> 00:00:00,640
American <u>XL</u> Bully Dog

3
00:00:00,640 --> 00:00:01,140
American XL <u>Bully</u> Dog

4
00:00:01,140 --> 00:00:01,280
American XL Bully <u>Dog</u>

5
00:00:01,280 --> 00:00:01,520
<u>is</u> a danger to

6
00:00:01,520 --> 00:00:01,640
is <u>a</u> danger to

7
00:00:01,640 --> 00:00:01,800
is a <u>danger</u> to

8
00:00:01,800 --> 00:00:02,220
is a danger <u>to</u>

9
00:00:02,220 --> 00:00:02,380
<u>our</u> communities, particularly our

10
00:00:02,380 --> 00:00:02,680
our <u>communities,</u> particularly our

11
00:00:02,680 --> 00:00:03,360
our communities, particularly our

12
00:00:03,360 --> 00:00:03,580
our communities, <u>particularly</u> our

13
00:00:03,580 --> 00:00:04,060
our communities, particularly <u>our</u>

14
00:00:04,060 --> 00:00:04,280
<u>children.</u>



Then this above SRT file is converted into the below ASS subtitle


[Script Info]
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,16,&H00FFFFFF,&H0000FF00,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,00:00:00.000,00:00:00.080,Default,,0,0,0,,{\c&H00FF00&}American{\c&HFFFFFF&} XL Bully Dog
Dialogue: 0,00:00:00.080,00:00:00.640,Default,,0,0,0,,American {\c&H00FF00&}XL{\c&HFFFFFF&} Bully Dog
Dialogue: 0,00:00:00.640,00:00:01.140,Default,,0,0,0,,American XL {\c&H00FF00&}Bully{\c&HFFFFFF&} Dog
Dialogue: 0,00:00:01.140,00:00:01.280,Default,,0,0,0,,American XL Bully {\c&H00FF00&}Dog{\c&HFFFFFF&}
Dialogue: 0,00:00:01.280,00:00:01.520,Default,,0,0,0,,{\c&H00FF00&}is{\c&HFFFFFF&} a danger to
Dialogue: 0,00:00:01.520,00:00:01.640,Default,,0,0,0,,is {\c&H00FF00&}a{\c&HFFFFFF&} danger to
Dialogue: 0,00:00:01.640,00:00:01.800,Default,,0,0,0,,is a {\c&H00FF00&}danger{\c&HFFFFFF&} to
Dialogue: 0,00:00:01.800,00:00:02.220,Default,,0,0,0,,is a danger {\c&H00FF00&}to{\c&HFFFFFF&}
Dialogue: 0,00:00:02.220,00:00:02.380,Default,,0,0,0,,{\c&H00FF00&}our{\c&HFFFFFF&} communities, particularly our
Dialogue: 0,00:00:02.380,00:00:02.680,Default,,0,0,0,,our {\c&H00FF00&}communities,{\c&HFFFFFF&} particularly our
Dialogue: 0,00:00:02.680,00:00:03.360,Default,,0,0,0,,our communities, particularly our
Dialogue: 0,00:00:03.360,00:00:03.580,Default,,0,0,0,,our communities, {\c&H00FF00&}particularly{\c&HFFFFFF&} our
Dialogue: 0,00:00:03.580,00:00:04.060,Default,,0,0,0,,our communities, particularly {\c&H00FF00&}our{\c&HFFFFFF&}
Dialogue: 0,00:00:04.060,00:00:04.280,Default,,0,0,0,,{\c&H00FF00&}children.{\c&HFFFFFF&}



Both when playing the subtitle in any video player or burning into video via FFMPEG, what happens is, multiple Dialogue lines are being displayed at the same time on the screen.


I am doing a lot of research regarding this but still couldn't find out the issue.


Here screenshot of what I mean. So how can I fix this issue ? What is wrong with my ASS file format ?




Here below the functio that I am use to generate that ASS format


def convert_srt_to_ass(srt_content):
 # ASS header
 ass_header = (
 "[Script Info]\n"
 "ScriptType: v4.00+\n"
 "PlayResX: 384\n"
 "PlayResY: 288\n\n"
 "[V4+ Styles]\n"
 "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding\n"
 "Style: Default,Arial,16,&H00FFFFFF,&H0000FF00,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,1,0,2,10,10,10,1\n\n"
 "[Events]\n"
 "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\n"
 )

 ass_content = ass_header
 # Adjust regex to properly capture subtitle number, start time, end time, and text
 matches = list(re.finditer(r'(\d+)\n(\d{2}:\d{2}:\d{2},\d{3}) --> (\d{2}:\d{2}:\d{2},\d{3})\n(.+?)\n\n', srt_content, re.DOTALL))

 prev_end = None
 
 for match in matches:
 start, end, text = match.group(2), match.group(3), match.group(4)
 start = start.replace(',', '.')
 end = end.replace(',', '.')

 # Calculate the correct start and end times to ensure no overlap
 if prev_end and start <= prev_end:
 # Adjust the previous end time to be a bit before the current start time
 prev_end_time = datetime.strptime(prev_end, '%H:%M:%S.%f')
 adjusted_end_time = prev_end_time - timedelta(milliseconds=100) # Adjust by 100 milliseconds
 prev_end = adjusted_end_time.strftime('%H:%M:%S.%f')[:-3] # Truncate to 3 decimal places

 ass_content = ass_content.rstrip()
 ass_content = re.sub(r'(\d{2}:\d{2}:\d{2}\.\d{3}),Default,,$', f'{prev_end},Default,,', ass_content, 1)
 ass_content += '\n'

 prev_end = end

 # Formatting the text and adding it to the content
 text = text.replace('<u>', '{\\c&H00FF00&}').replace('</u>', '{\\c&HFFFFFF&}')
 text = text.replace('\n', '\\N') # Convert newlines within text for ASS format
 ass_content += f"Dialogue: 0,{start},{end},Default,,0,0,0,,{text}\n"

 
 # Conversion of text and other formatting remains the same

 return ass_content



-
FFMPEG (WINDOWS) - Jerky Videos with vidstabdetect & vidstabtransform
26 avril 2016, par Onish MistryI require to stabilize multiple video clips and finally stitch all the clips, along with images into one final video. These "Scenes" consisting video clips as well as images also can have overlays like Texts and/or other Images.
Basically the code I have in place as of now does everything for me just fine, where all the video clips are first converted into frame images. It then reads all the frames, puts on the overlays, adds a fade transition in-between "Scenes".
Coming to the issue I am facing with stabilization, when I extract image frames out of the stabilized video clip and simply try to recreate video from those extracted image frames, it comes out with a weird jerk, almost like as if it is missing those stabilization calculations or something, not sure. It still looks a bit stabilized but with missing frames. I have checked duration and number of frames extracted, everything matches with the source, non-stabilized video.
Below is the command used to stabilize the video, result of which is a perfectly stabilized video.
ffmpeg -i 1.MOV -r 30 -vf vidstabdetect=result="transforms.trf" -f null NUL && ffmpeg -i 1.MOV -r 30 -vf vidstabtransform=smoothing=30:input="transforms.trf" -vcodec libx264 -b:v 2000k -f mp4 results.mp4
Below is the command I use for video to image :
ffmpeg -i results.mp4 -r 30 -qscale 1 -f image2 %d.jpg
Below is the command I use for image to video :
ffmpeg -i %d.jpg -r 30 -vcodec libx264 -b:v 2000k -f mp4 final.mp4
Any help or suggestions are welcomed and appreciated.
Thanks,
-
How to convert an FFMPEG AVFrame in YUVJ420P to AVFoundation cVPixelBufferRef ?
17 août 2016, par arbiefI have an FFMPEG
AVFrame
inYUVJ420P
and I want to convert it to aCVPixelBufferRef
withCVPixelBufferCreateWithBytes
. The reason I want to do this is to use AVFoundation to show/encode the frames.I selected
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
and tried converting it since the AVFrame has the data in three planes
Y480
Cb240
Cr240
. And according to what I’ve researched this matches the selectedkCVPixelFormatType
. By being biplanar I need to convert it into a buffer that containsY480
andCbCr480
Interleaved.I tried to create a buffer with 2 planes :
frame->data[0]
on the first plane,frame->data[1]
andframe->data[2]
interleaved on the second plane.
However, I’m getting return error
-6661 (invalid a)
fromCVPixelBufferCreateWithBytes
:"Invalid function parameter. For example, out of range or the wrong type."
I don’t have expertise on image processing at all, so any pointers to documentation that can get me started in the right approach to this problem are appreciated. My C skills aren’t top of the line either so maybe I’m making a basic mistake here.
uint8_t **buffer = malloc(2*sizeof(int *));
buffer[0] = frame->data[0];
buffer[1] = malloc(frame->linesize[0]*sizeof(int));
for(int i = 0; ilinesize[0]; i++){
if(i%2){
buffer[1][i]=frame->data[1][i/2];
}else{
buffer[1][i]=frame->data[2][i/2];
}
}
int ret = CVPixelBufferCreateWithBytes(NULL, frame->width, frame->height, kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange, buffer, frame->linesize[0], NULL, 0, NULL, cvPixelBufferSample)The frame is the
AVFrame
with the rawData from FFMPEG Decoding.