
Recherche avancée
Médias (3)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Collections - Formulaire de création rapide
19 février 2013, par
Mis à jour : Février 2013
Langue : français
Type : Image
Autres articles (50)
-
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. -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...) -
MediaSPIP Player : les contrôles
26 mai 2010, parLes contrôles à la souris du lecteur
En plus des actions au click sur les boutons visibles de l’interface du lecteur, il est également possible d’effectuer d’autres actions grâce à la souris : Click : en cliquant sur la vidéo ou sur le logo du son, celui ci se mettra en lecture ou en pause en fonction de son état actuel ; Molette (roulement) : en plaçant la souris sur l’espace utilisé par le média (hover), la molette de la souris n’exerce plus l’effet habituel de scroll de la page, mais diminue ou (...)
Sur d’autres sites (8197)
-
Problem opening xvid264 with avcodec_alloc_context(NULL)
12 juillet 2024, par user3763774I want to multiplex audio and video together using the ffmpeg encoding library with xvid264rgb codec. I can open the codec when I create the context specifying that codec, but not if I use NULL for the argument with allocate context. My understanding is I need to use NULL so I can open the audio codec as well.


In the example, the first open works with codec indicated in the allocate context. The second doesn't.


#include 
#include 
#include 
#include <libavcodec></libavcodec>avcodec.h>
#include <libavutil></libavutil>opt.h>
#define WIDTH 400
#define HEIGHT 300

const AVCodec *videocodec;

bool init_video_encoder(AVCodecContext *c, int width, int height) {
 int ret;
 
 const AVRational tb_rat = {1, 30};
 const AVRational fr_rat = {30, 1};

 fprintf(stderr, "init video encoder\n");
 // video
 //fprintf(stderr, "speed= %d \n", videocodec->speed);
 c->bit_rate = 400000;
 c->width = width;
 c->height = height;
 c->time_base = tb_rat;
 c->framerate = fr_rat;
 c->gop_size = 10;
 c->max_b_frames = 1;
 c->pix_fmt = AV_PIX_FMT_RGB24;
 if( videocodec->id == AV_CODEC_ID_H264 ) 
 av_opt_set(c->priv_data, "preset", "slow", 0);
 
 ret = avcodec_open2(c, videocodec, NULL);
 if( ret < 0 ) {
 fprintf(stderr, "failure to open codec: %s\n", av_err2str(ret));
 return false;
 }
 //avcodec_free_context(&c);
 return true;
}

int main(int argc, char **argv) {

 AVCodecContext *context = NULL;

 videocodec = avcodec_find_encoder_by_name("libx264rgb");
 if( videocodec == NULL ) {
 fprintf(stderr, "video encoder 'libx264rgb' not found");
 exit;
 }

 context = avcodec_alloc_context3(videocodec);
 if( context == NULL ) {
 fprintf(stderr, "could not allocate context with codec");
 return false;
 }
 if( init_video_encoder( context, WIDTH, HEIGHT ) ) 
 fprintf(stderr, " success initializing video encoder case one\n");
 else
 fprintf(stderr, " failure to initialize video encoder case one\n");
 avcodec_close( context );

 context = avcodec_alloc_context3(NULL);
 if( context == NULL ) {
 fprintf(stderr, "could not allocate context without codec");
 return false;
 }
 if( init_video_encoder( context, WIDTH, HEIGHT ) ) 
 fprintf(stderr, " success initializing video encoder case two\n");
 else
 fprintf(stderr, " failure to initialize video encoder case two\n");
 avcodec_close( context );
}



Here is the error message :


broken ffmpeg default settings detected
use an encoding preset (e.g. -vpre medium)
preset usage: -vpre <speed> -vpre <profile>
speed presets are listed in x264 --help
profile is optional; x264 defaults to high
failure to open codec: Generic error in an external library
failure to initialize video encoder case two
</profile></speed>


Is this the right approach to use ? How do I set the encoding preset ? The code appears already to do that.


-
Transcoding Videos Using FastAPI and ffmpeg
15 janvier 2024, par Sanji VinsmokeI created an API using Fast API where I upload one or more videos, may specify the resolution of transcoding, and the output is transcoded video from 240p upto the resolution I specified. Available resolutions are - 240p, 360p, 480p, 720p, 1080p. I used ffmpeg for the transcoding job.


The problem that is bugging me since yesterday is that, after deploying to the s3 bucket and adding the url for the index.m3u8 file in any hls player, the video is blank. Only the audio and streaming are working. I have tried tweaking with the parameters in the ffmpeg parameters, the error is still there. I tried manually transcoding a video file locally, even that video's index.m3u8 file is blank in live version. I added the relevant codes for this project. I implemented each feature one by one, but I simply cannot find the reason why the video is totally blank on live.


def transcode_video(input_path, output_folder, res, video_id, video_resolution, progress_bar=None):
 # Transcode the video into .m3u8 format with segment format
 output_path = os.path.join(output_folder, f"{res}_{video_id}.m3u8")

 # Use subprocess for command execution
 chunk_size = 1 # Specify the desired chunk size in seconds

 transcode_command = [
 "ffmpeg", "-i", input_path, "-vf", f"scale={res}:'trunc(ow/a/2)*2'", "-c:a", "aac", "-strict", "-2",
 "-f", "segment", "-segment_time", str(chunk_size), "-segment_list", output_path, "-segment_format", "ts",
 f"{output_path.replace('.m3u8', '_%03d.ts')}"
 ]

 try:
 subprocess.run(transcode_command, check=True, capture_output=True)
 except subprocess.CalledProcessError as e:
 print(f"Error during transcoding: {e}")
 print(f"FFmpeg error output: {e.stderr}")
 # Continue with the next video even if an error occurs
 return False

 # Update the progress bar
 if progress_bar:
 progress_bar.update(1)
 return True


def get_bandwidth(resolution):
 # Define a simple function to calculate bandwidth based on resolution
 resolutions_and_bandwidths = {
 240: 400000,
 360: 850000,
 480: 1400000,
 720: 2500000,
 1080: 4500000,
 }
 
 return resolutions_and_bandwidths.get(resolution, 0)
def create_index_m3u8(video_id, resolutions_to_transcode):
 # Write the index.m3u8 file
 index_m3u8_path = os.path.join(OUTPUT_FOLDER, f"index_{video_id}.m3u8")
 with open(index_m3u8_path, "w") as index_file:
 index_file.write("#EXTM3U\n")
 index_file.write("#EXT-X-VERSION:3\n")

 for res in resolutions_to_transcode:
 aspect_ratio = 16 / 9
 folder_name = f"{res}p_{video_id}"
 resolution_file_name = f"{res}_{video_id}.m3u8"
 index_file.write(
 f"#EXT-X-STREAM-INF:BANDWIDTH={get_bandwidth(res)},RESOLUTION={int(res * aspect_ratio)}x{res}\n{folder_name}/{resolution_file_name}\n"
 )



I tried reducing or increasing chunk size, adding codecs, setting up dimensions. Where am I doing wrong ?


My python version is 3.8.18, ffmpeg version-4.4.4, ffmpeg-python version-0.2.0


-
ffmpeg doesn't generate a ISO/IEC 14496-17 (MPEG-4 text) track when ingesting WebVTT subtitles to produce MPEGTS
10 avril 2024, par Daniel Andres Pelaez LopezWe are trying to create a mpegts with an ISO/IEC 14496-17 (MPEG-4 text) subtitles track, using WebVTT, but seems like ffmpeg creates a ISO 13818-1 PES private data instead.


The following is the ffmpeg command :


ffmpeg -i subtitle.vtt -c:s mov_text -f mpegts output3GPP.ts


This is using the following subtitle.vtt file :


WEBVTT

00:00.000 --> 00:01.000
Subtitle 1

00:01.000 --> 00:02.000
Subtitle 2

00:02.000 --> 00:03.000
Subtitle 3

00:03.000 --> 00:04.000
Subtitle 4



And the following is the output of the ffprobe for that file :


Input #0, mpegts, from 'output3GPP.ts':
 Duration: 00:00:19.00, start: 1.400000, bitrate: 1 kb/s
 Program 1
 Metadata:
 service_name : Service01
 service_provider: FFmpeg
 Stream #0:0[0x100]: Data: bin_data ([6][0][0][0] / 0x0006)
Unsupported codec with id 98314 for input stream 0



However, if we generate an mp4, it works, the following is the command :


ffmpeg -i subtitle.vtt -c:s mov_text -f mp4 output3GPP.ts


And the following is the output of the ffprobe for that file :


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output3GPP.ts':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf57.83.100
 Duration: 00:00:20.00, start: 0.000000, bitrate: 0 kb/s
 Stream #0:0[0x1](und): Subtitle: mov_text (tx3g / 0x67337874), 0
kb/s (default)
 Metadata:
 handler_name : SubtitleHandler



Any reason why both commands behave differently ? is mpegts not supporting ISO/IEC 14496-17 (MPEG-4 text) ?