
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (107)
-
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...) -
Use, discuss, criticize
13 avril 2011, parTalk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
A discussion list is available for all exchanges between users. -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)
Sur d’autres sites (10767)
-
mp4 video written with ffmpeg has different first frame based on total number of frames
25 janvier 2023, par Nitzan WeissmanI have a code that writes and reads videos in Python, I'm doing the writing using ffmpeg. I noticed a weird phenomenon, where the first frame changes based on the total number of frames in the video. I find it weird because the first frame is a key frame (I checked it using ffprobe)


The code I'm using :


The writing function


import shutil
import subprocess
def write_h264_video(video_path: str, images: np.ndarray, fps: float):
 image_name_template = '00%04d.png'
 tmp_image_dir = (Path(video_path).parent / 'tmp_imgs')
 tmp_image_dir.mkdir()

 for ii, image in enumerate(images):
 cv2.imwrite(f'{str(tmp_image_dir / str(ii).zfill(6))}.png', image[..., ::-1]) 
 command = f'ffmpeg -hide_banner -loglevel error -framerate {fps} -y -i {tmp_image_dir}/{image_name_template} ' \
 f' -c:v libx264 -pix_fmt yuv420p {video_path} -y'
 subprocess.call(command, shell=True)
 shutil.rmtree(tmp_image_dir)



The main code


import numpy as np
from pathlib import Path
import decord
decord.bridge.set_bridge('torch')

input_video_path = Path('')
tmp_path = Path('')
input_video = decord.VideoReader(str(input_video_path))

frames = np.zeros((20, 512, 512, 3), dtype = np.uint8)
for i in range(20):
 frames[i] = input_video[i].detach().cpu().numpy()
 
long_video_path = tmp_path / 'long_video.mp4'
short_video_path = tmp_path / 'short_video.mp4'

fps = 30
write_h264_video(str(long_video_path), frames, fps=fps)
write_h264_video(str(short_video_path), frames[:10], fps=fps)


long_video = decord.VideoReader(str(long_video_path))
short_video = decord.VideoReader(str(short_video_path))

long_frame_0 = long_video[0]
short_frame_0 = short_video[0]
(long_frame_0 == short_frame_0).all()



I am supposed to get True, but I'm getting False.
I tried reading using other methods, using opencv for example, and the issue persists.
There are other ways to write videos of course, but I'm interested in ffmpeg-based ways.


Thanks !


-
FFmpeg max audio overhead
15 août 2020, par AlsorsSo I'm encoding videos with FFmpeg. I've set the video stream to have a maximum rate of 6840 kbps and the audio stream to have a constant rate of 160 kbps (AAC) so once they're added together it's a maximum combined rate of 7000 kbps (the maximum rate before my video sharing service re-encodes the video and audio). The problem is sometimes the audio stream likes to go above it's designated constant rate (not by much however enough to take it over 7000 kbps), even with the exact same command it'll sometimes go above and sometime stay the same.


My question : is there a way to calculate the maximum overhead of the audio stream ? I'm assuming FFmpeg has a point where it will not allow the audio rate to go any higher ? What is that exact rate ?


-
Call FFmpeg via JavaCPP:Caused by : java.lang.NoClassDefFoundError : Could not initialize class org.bytedeco.javacpp.avformat$AVFormatContext
8 décembre 2017, par XuanIn CentOS, use javacpp call FFmpeg to do video cropping a frame, in my own development machine using this code is no problem, but in centos6 reported NoClassDefFound : Could not initialize class org.bytedeco.javacpp.avutil
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avformat$AVFormatContext
at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:383) ~[javacv-1.0.jar:1.0]
at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:377) ~[javacv-1.0.jar:1.0]
at cn.xxtui.support.upload.BasicUpload.convertImage(BasicUpload.java:211) ~[classes/:?]
at cn.xxtui.support.upload.BasicUpload.upload(BasicUpload.java:197) ~[classes/:?]
at cn.com.ql.wiseBeijing.upload.UploadImage.upload(UploadImage.java:144) ~[classes/:?]
at cn.com.ql.wiseBeijing.upload.UploadImage.imageCategory(UploadImage.java:51) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_25]
at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) ~[cxf-core-3.1.12.jar:3.1.12]
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ~[cxf-core-3.1.12.jar:3.1.12]
... 37 moreThis is my pom configuration:
<dependency>
<groupid>org.bytedeco</groupid>
<artifactid>javacv</artifactid>
<version>1.0</version>
</dependency>
<dependency>
<groupid>org.bytedeco</groupid>
<artifactid>javacpp</artifactid>
<version>1.0</version>
</dependency>
<dependency>
<groupid>com.github.hoary.ffmpeg</groupid>
<artifactid>FFmpeg-linux-x86_64</artifactid>
<version>2.0.1.1
</version>
</dependency>
<dependency>
<groupid>org.bytedeco.javacpp-presets</groupid>
<artifactid>ffmpeg</artifactid>
<version>2.7.1-1.0</version>
</dependency>This is my code:
public String convertImage(String filePath, String imagePath) throws IOException, FrameGrabber.Exception {
FFmpegFrameGrabber g = new FFmpegFrameGrabber(filePath);
g.start();
Java2DFrameConverter java2DFrameConverter = new Java2DFrameConverter();
BufferedImage bufferedImage = java2DFrameConverter.convert(g.grabImage());
String path = imagePath + System.currentTimeMillis() + ".png";
ImageIO.write(bufferedImage, "png", new File(path));
g.stop();
return path;
}