
Recherche avancée
Médias (91)
-
Head down (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Echoplex (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Discipline (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
Letting you (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
1 000 000 (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
-
999 999 (wav version)
26 septembre 2011, par
Mis à jour : Avril 2013
Langue : English
Type : Audio
Autres articles (35)
-
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 ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (6437)
-
FFMPEG C Library : Encoding h264 stream into Matroska .mkv container creates corrupt files
16 mars 2024, par Marvin KillingI want to use the FFMPEG C Library to create a Matroska Video .mkv file with only an h264 stream, but the resulting .mkv file comes out corrupt.


The file cannot be played back with Windows Media Player, ffplay, or VLC, and when I try to
ffprobe
the resulting file, these are the error messages :

[h264 @ 0000015060d8f5c0] No start code is found.
 Last message repeated 1 times
[h264 @ 0000015060d8f5c0] non-existing PPS 0 referenced
 Last message repeated 1 times
[h264 @ 0000015060d8f5c0] decode_slice_header error
[h264 @ 0000015060d8f5c0] no frame!
[h264 @ 0000015060d8f5c0] non-existing PPS 0 referenced
 Last message repeated 1 times
[h264 @ 0000015060d8f5c0] decode_slice_header error
[h264 @ 0000015060d8f5c0] no frame!
[h264 @ 0000015060d8f5c0] non-existing PPS 0 referenced
 Last message repeated 1 times
# [...]
# this continues for a long time



I have followed the other troubleshooting steps for encoding h264 into Matroska, but none of them seemed to have done the trick for me :


- 

- Setting
AV_CODEC_FLAG_GLOBAL_HEADER
: Invalid data when creating mkv container with h264 stream because extradata is null - Allocating some space for extradata : Initializing an output file for muxing mkv with FFmpeg






This is my C code :


#include 
#include <libavutil></libavutil>opt.h>
#include <libavutil></libavutil>imgutils.h>
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>

int main(void) {
 char *out_file_path = "./video.mkv";
 AVFormatContext *format_context;
 AVStream *video_stream;
 AVCodecContext *codec_context;

 avformat_alloc_output_context2(&format_context, NULL, NULL, out_file_path);

 const AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);
 video_stream = avformat_new_stream(format_context, NULL);

 codec_context = avcodec_alloc_context3(codec);
 av_opt_set(codec_context->priv_data, "preset", "superfast", 0);
 av_opt_set(codec_context->priv_data, "crf", "22", 0);

 codec_context->width = 1920;
 codec_context->height = 1080;
 codec_context->time_base = av_make_q(1, 30);
 codec_context->pix_fmt = AV_PIX_FMT_YUV420P;

 if (strncmp("./video.mkv", out_file_path, 11) == 0) {
 printf("Writing .mkv...\n");
 codec_context->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
 codec_context->extradata = (uint8_t*)av_mallocz(1024 * 1024);
 codec_context->extradata_size = 1024 * 1024;
 } else {
 printf("Writing .mp4...\n");
 }

 // XXX avcodec_parameters_from_context is potentially superfluous (?)
 int ret = avcodec_parameters_from_context(video_stream->codecpar, codec_context);

 ret = avcodec_open2(codec_context, codec, NULL);

 avio_open(&format_context->pb, out_file_path, AVIO_FLAG_WRITE);

 ret = avformat_write_header(format_context, NULL);

 // create a black input frame
 AVFrame *input_frame = av_frame_alloc();
 input_frame->width = 1920;
 input_frame->height = 1080;
 input_frame->format = AV_PIX_FMT_YUV420P;
 ret = av_image_alloc(input_frame->data, input_frame->linesize, input_frame->width, input_frame->height, input_frame->format, 32);
 ptrdiff_t linesize[4] = { input_frame->linesize[0], input_frame->linesize[1], input_frame->linesize[2], input_frame->linesize[3] };
 ret = av_image_fill_black(input_frame->data, linesize, input_frame->format, 0, 1920, 1080);

 // write 2 seconds of video, all black
 for (size_t current_pts = 0; current_pts < 60; current_pts++) {
 input_frame->pts = av_rescale_q(current_pts, av_make_q(1, 30), codec_context->time_base);;

 ret = avcodec_send_frame(codec_context, input_frame);

 AVPacket* packet = av_packet_alloc();

 while (1) {
 ret = avcodec_receive_packet(codec_context, packet);
 if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
 break;
 } else if (ret < 0) {
 printf("avcodec_receive_packet failed");
 } else {
 av_packet_rescale_ts(packet, codec_context->time_base, video_stream->time_base);
 ret = av_interleaved_write_frame(format_context, packet);
 }
 }

 av_packet_free(&packet);
 }

 av_frame_free(&input_frame);

 // flush encoder
 avcodec_send_frame(codec_context, NULL);
 AVPacket *flush_packet = av_packet_alloc();
 while (avcodec_receive_packet(codec_context, flush_packet) != AVERROR_EOF) {
 //int ret = av_interleaved_write_frame(format_context_, packet);
 av_packet_rescale_ts(flush_packet, codec_context->time_base, video_stream->time_base);
 ret = av_write_frame(format_context, flush_packet);
 }
 av_packet_free(&flush_packet);

 ret = av_write_trailer(format_context);
 ret = avio_close(format_context->pb);

 return 0;
}



The error handling is stripped out, but it does not raise any errors.


This code works when I write into an mp4 file, but creates a corrupt file when writing into .mkv. You can change the output container format to mp4 by setting

char *out_file_path = "./video.mp4";


You can compile this by running


clang -I$(FFMPEG_DIR)/include -L$(FFMPEG_DIR)/lib -lavformat -lavcodec -lavutil main.c -o makemkv



The output I’m getting while the above code is running :


Writing .mkv...
[libx264 @ 0x139804c40] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x139804c40] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x139804c40] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x3 me=dia subme=1 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=1:1.00



When I use the ffmpeg CLI, I can create a working .mkv from my working .mp4 like this :


ffmpeg -i video.mp4 -c:v copy created-with-ffmpeg-cli.mkv



I have uploaded the resulting video files here : https://drive.google.com/drive/folders/1FS-0fBAwKBbO-tyxC0VrFqcCyyqd0BR_?usp=sharing


- Setting
-
Issue with ffprobe execution within Docker Environment
7 mars 2024, par Khải Hồ QuangHere is my Dockerfile :


FROM node:18-slim as builder

WORKDIR /usr/src/ai_api_builder/

COPY package*.json tsconfig.json /usr/src/ai_api_builder/

RUN apt-get update && \
 apt-get install mariadb-client -y && \
 npm install && npm cache clean --force

RUN apt install ffmpeg -y && \
 ffmpeg -version && \
 ffprobe -version
COPY ${REPO_DIR}/ ./

RUN npm run build && mv audio_store node_modules dist/

FROM node:18-slim

# Create and cd into app directory
WORKDIR /usr/src/dwt_api_app/dist

# Copy the artifact to the new image
COPY --from=builder /usr/src/dwt_api_builder/dist ./

EXPOSE 3001

ENTRYPOINT ["node", "app.js"]



When I build Dockerfile, the step check ffmpeg and ffprobe version worked :


ffmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
...
ffprobe version 5.1.4-0+deb12u1 Copyright (c) 2007-2023 the FFmpeg developers



But when I run container, my TypeScript code not work (the metadata return
undefined
) :

import { ffprobe } from "fluent-ffmpeg";
ffprobe(latestFilePath, async function(err: any, metadata: any) {
 console.log("metadata", metadata);
})



When I exec to container and check
ffmpeg -version
andffprobe -version
, I got :bash: ffmpeg: command not found
. And when I check in bin folder, also couldn't findffmpeg
.

I tried it locally (Centos7), not in container, it worked (metadata return an object), and here is ffprobe version

ffprobe version 6.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2007-2023 the FFmpeg developers <b>

</b>


What step did I do wrong when running the container or is there any difference between debian (in container) and centos 7 (local) that I need to pay attention to ? Thanks


-
Unable to choose an output [closed]
17 février 2024, par XdanginI try to change the time for subtitle and every time this pop up on my face




Unable to choose an output format for 'output-subfamily' ; use a standard extension for the filename or specify the format manually




srry guys cuz I don't get it but I'm new at this


here's the full log im case I wrote something wrong


/sdcard $ ffmpeg -itsoffset 2 -i Family.Guy.S04E23.srt -c:v copy output-sub family guy.srt

ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers

 built with Android (10552028, +pgo, +bolt, +lto, -mlgo, based on r487747d) clang version 17.0.2 (https://android.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362)

 configuration: --arch=aarch64 --as=aarch64-linux-android-clang --cc=aarch64-linux-android-clang --cxx=aarch64-linux-android-clang++ --nm=llvm-nm --pkg-config=/home/builder/.termux-build/_cache/android-r26b-api-24-v1/bin/pkg-config --strip=llvm-strip --cross-prefix=aarch64-linux-android- --disable-indevs --disable-outdevs --enable-indev=lavfi --disable-static --disable-symver --enable-cross-compile --enable-gnutls --enable-gpl --enable-version3 --enable-jni --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgme --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenmpt --enable-libopus --enable-librav1e --enable-libsoxr --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mediacodec --enable-opencl --enable-shared --prefix=/data/data/com.termux/files/usr --target-os=android --extra-libs=-landroid-glob --disable-vulkan --enable-neon --disable-libfdk-aac

 libavutil 58. 29.100 / 58. 29.100

 libavcodec 60. 31.102 / 60. 31.102

 libavformat 60. 16.100 / 60. 16.100

 libavdevice 60. 3.100 / 60. 3.100

 libavfilter 9. 12.100 / 9. 12.100

 libswscale 7. 5.100 / 7. 5.100

 libswresample 4. 12.100 / 4. 12.100

 libpostproc 57. 3.100 / 57. 3.100

Input #0, srt, from 'Family.Guy.S04E23.srt':

 Duration: N/A, bitrate: N/A

 Stream #0:0: Subtitle: subrip

[AVFormatContext @ 0x75b7eb2500] Unable to choose an output format for 'output-sub'; use a standard extension for the filename or specify the format manually.

[out#0 @ 0x75b7e3e840] Error initializing the muxer for output-sub: Invalid argument

Error opening output file output-sub.

Error opening output files: Invalid argument

/sdcard $ ffmpeg -itsoffset 2 -i Family.Guy.S04E23.srt -c copy output-sub family guy.srt



I searched YouTube but didn't find anything