
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 (87)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation"
Sur d’autres sites (11099)
-
Resuming ffmpeg hls trancoding from an existing segment
2 juillet 2024, par FdebijlI'm setting up a service to transcode input videos, generally MP4, for HLS with MPEG-TS as the container format. This currently works fine when starting from scratch, but I would like the transcode to be resumable in case the service crashes while working on a longer video.


I'm running into two issues with resuming the transcoding process :


- 

- ffmpeg generates too many segments : if the processing is halted at, say, 10 segments for a video that should be 20 segments long and processing is resumed later, the manifest contains 10 + 20 segments, where the final 10 segments don't actually play back properly
- Adjacent to this, running the command again when the video is fully transcoded results in the playlist being appended with the entire video once more, with the numbers above that would result in 20 additional segments being added to the playlist every time the conversion is ran. In other words, ffmpeg doesn't realize the transcoding is already complete






The desired result here is that running the ffmpeg command again simply continues the transcode after the last completed segment and appends these segments to the m3u8 playlist. If all the segments are already present ffmpeg should not output or modify anything. I've tried to coax ffmpeg into this behaviour, but no combination of
-start_number
,-ss
andappend_list
gets me there.

Here's my current command that is executed when a transcode should be resumed (I've ommited some filters for brevity) :


ffmpeg -i input -map 0:v -map 0:a -map 0:v -map 0:a -map 0:v -map 0:a \
-c:v libx264 -preset veryfast -c:a libfdk_aac \
-maxrate:v:0 1500K -b:a:0 128k \
-maxrate:v:1 3000K -b:a:1 192k \ 
-maxrate:v:2 6000K -b:a:2 256k \
-flags +cgop -g 60 -hls_time 5 -hls_list_size 0 \
-hls_flags independent_segments+temp_file+append_list \
-var_stream_map "v:0,a:0,name:480p v:1,a:1,name:720p v:2,a:2,name:1080p" \
-y -f hls -master_pl_name master.m3u8 ./%v.m3u8



Here is the folder structure that ffmpeg would work in for a resumed transcode, assuming the service crashed after the first two chunks :


.
├── 1080p.m3u8 
├── 1080p0.ts 
├── 1080p1.ts 
├── 480p.m3u8 
├── 480p0.ts 
├── 480p1.ts 
├── 720p.m3u8 
├── 720p0.ts 
├── 720p1.ts 
├── input 
└── master.m3u8 



Here is the contents of
480p.m3u8
:

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-ENDLIST



However, as explained in the prelude, running the command against this folder results in too many chunks being appended to the playlist.


This is the expected 480p playlist :


#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.733333,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.000000,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:3.950000,
480p13.ts
#EXT-X-ENDLIST



And this is the actual playlist :


#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:5.000000,
480p0.ts
#EXTINF:5.000000,
480p1.ts
#EXT-X-DISCONTINUITY
#EXTINF:5.000000,
480p2.ts
#EXTINF:5.000000,
480p3.ts
#EXTINF:5.000000,
480p4.ts
#EXTINF:5.000000,
480p5.ts
#EXTINF:5.000000,
480p6.ts
#EXTINF:5.733333,
480p7.ts
#EXTINF:5.000000,
480p8.ts
#EXTINF:5.000000,
480p9.ts
#EXTINF:5.000000,
480p10.ts
#EXTINF:5.000000,
480p11.ts
#EXTINF:5.000000,
480p12.ts
#EXTINF:5.000000,
480p13.ts
#EXTINF:5.000000,
480p14.ts
#EXTINF:3.950000,
480p15.ts
#EXT-X-ENDLIST



I've already surmised the
#EXT-X-DISCONTINUITY
tag can't be disabled, which is fine, as I can remove that with post-processing steps. The two extra segments are problematic however, as they break the video at the end of its actual runtime.

To bring this to a point : is there a way to get ffmpeg to resume transcoding from the last segment, such that it does not append the entire video to the last transcoding attempt ?


-
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;
} -
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 ?