
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 (34)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)
Sur d’autres sites (5278)
-
Segmenting a video and adding text that differs in each segment [FFMPEG]
31 octobre 2023, par Kal-TohI have a folder full of videos I want to segment, resize and add text to. So far I've managed to segment and resize them.


I'm trying to add text in a TikTok Style : [Kind of like][1] this but black text in a white background. (If that isn't possible, I'd be fine with just white text).


I already have the font file(.oft file type, is that ok or does it need to be .ttf ?)
The video is being converted to 720x1280 (9:16) and I'd like the text to display at the top centre of the video, taking up roughly the top 25%.


Further to this, and this is where I'm having trouble understanding the process :


I'd like text at the bottom of the video in the same style, that would change each segment.


For example :


I have a 10 minute long video. I want to split this video into 60 second segments. Each segment will have a title (the same across each segment) and a sub title at the bottom that would differ for each segment (for example 'Part 1/10', 'Part 2/10' etc)


I know I could run one command to segment each video, add the title and change the aspect ratio and a second command to add the bottom text, feeding in a variable based on the number of mp4 files in the folder, however that doesn't seem like the most efficient process. Is there a way to do this all in one command ?


This is the command I'm using so far :


ffmpeg_command = [
 'ffmpeg',
 '-i', os.path.join(input_folder, video_file),
 '-vf', f'scale=720:1280:force_original_aspect_ratio=decrease,pad=720:1280:(ow-iw)/2:(oh-ih)/2
 ,drawtext=text=\'{text}\':x=(w-tw)/2:y=(h/4)-th:fontsize=24:fontfile={font_path}:fontcolor=black:box=1:boxcolor=white',
 '-threads', '100',
 "-c:a", "copy",
 '-t', str(duration),
 '-segment_time', '160', # 3 minutes
 '-reset_timestamps', '1',
 '-f', 'segment',
 os.path.join(output_subfolder, f'{video_name}_%03d.mp4')
 ]



Although not styled the way I want it to be, it's a decent start and all else works fine.


It's just the bottom text I can't figure.
[1] : https://i.insider.com/61aa608a983f360019c854a5?width=1300&format=jpeg&auto=webp


-
Video from images in Python
26 février 2018, par R. PattersonI can draw a series of images using plt.draw() and plt.pause() so it produces something similar to an animation in the python window. I have modified each of the images with various labels, drawings etc.
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import math
def display(Intensity):
l = plt.Line2D(Intensity[0],Intensity[1],color='yellow') #draw ROI/IAL
ax = plt.gca()
ax.add_line(l)
plt.axis('off')
plt.pause(0.05)
plt.draw()
plt.clf()
#rotate region of interest
def rotate(origin,Intensity,increment):
ox, oy = origin #coordinates of centre or rotation
x_points=[]
y_points=[]
angle=math.radians(increment)#change in angle between each image
for i in range(0,len(Intensity[0])):
px, py = Intensity[0][i], Intensity[1][i]
qx = ox+math.cos(angle)*(px-ox)-math.sin(angle)*(py-oy)
x_points.append(qx)
qy = oy+math.sin(angle)*(px-ox)+math.cos(angle)*(py-oy)
y_points.append(qy)
rotatecoordinates=[]
rotatecoordinates.append(x_points)
rotatecoordinates.append(y_points)
return rotatecoordinates
def animation(list, Intensity):
inc=0
for value in list:
item = np.array(value)
rotated=rotate([128,128],Intensity,inc)
im=plt.imshow(item, interpolation='nearest')
display(rotated)
inc+=1
Image_list=[]
for i in range(0,50):
array=np.linspace(0,1,256*256)
mat=np.reshape(array,(256,256))
img=Image.fromarray(np.uint8(mat*255),'L') #create images
Image_list.append(img)
myROI=([100,150,150,100,100],[100,100,150,150,100]) #region of interest on image
animation(Image_list,myROI)I would like to produce a video file using the images produced. I can’t use the module imageio, imagemagick, opencv, cv2 etc. I think ffmpeg would work, I have the following code.
def save():
os.system("ffmpeg -r 1 -i img%01d.png -vcodec mpeg4 -y movie.mp4")I don’t understand how to use it in relation to the code I already have. It doesn’t take any arguments, how would I relate it to the images I have ? I know how to use imagej/fiji to produce videos from images but I would like to do this in python and also it runs out of memory (I have a lot of images, over 2000). Any help would be appreciated, thank you.
-
Implementing picture zoom effect using Rmagick and FFmpeg
26 juin 2013, par DenisKoI have a picture and I need to get zoom effect on the resulting video. I almost get the desired result.. but. The resulting picture looks a bit shaky. It's because of rounding on cropping and resizing.. so centre of the picture shifts slightly with each conversion. What can i do with that ? Or maybe there is some other method to implement it ?
In the input I have
picture,zoom_type,zoom_percent,zoom_duration,scene_duration
Here is part of the code which making the job :img = Magick::ImageList.new(picture).first
width, height = img.columns.to_f, img.rows.to_f
img_fps = 30
if width >= height
aspect_ratio = (width / height)
zoom_small_size = ((height * (100 - zoom_percent)) / 100).to_f
small_size = height
else
aspect_ratio = (height / width)
zoom_small_size = ((width * (100 - zoom_percent)) / 100).to_f
small_size = width
end
factor = (((small_size - zoom_small_size) / (img_fps * zoom_duration))).to_f
while factor < 2
img_fps -= 1
factor = ((small_size - zoom_small_size) / (img_fps * zoom_duration))
end
total_images = img_fps * scene_duration
zoom_images = img_fps * zoom_duration_seed
new_width = width
new_height = height
zoom_changed_small_size = small_size
total_images.times do |i|
if zoom_images > 0 && zoom_changed_small_size > zoom_small_size
img_n = img.crop(new_width, new_height, true)
new_width = (width <= height) ? (new_width - factor).round : (new_width-factor*aspect_ratio).round
new_height = (width >= height) ? (new_height-factor).round : (new_height-factor*aspect_ratio).round
zoom_changed_small_size = (width >= height) ? img_n.rows : img_n.columns
img_n.resize_to_fill!(width, height)
img_n.write("#{sprintf("img_%04d.jpg" % (i+1))}")
zoom_images -= 1
img = img_n.copy if zoom_images == 0 || zoom_changed_small_size <= zoom_small_size
img_n.destroy!
else
img.write("#{sprintf("img_%04d.jpg" % (i+1))}")
puts "Writing - #{img.filename}"
end
endThen ffmpeg -y -f image2 -r 30 -i img_%04d.jpg -crf 0 -preset ultrafast -tune stillimage -pix_fmt yuv420p out.mp4