
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 (35)
-
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Soumettre bugs et patchs
10 avril 2011Un logiciel n’est malheureusement jamais parfait...
Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
Si vous pensez avoir résolu vous même le bug (...)
Sur d’autres sites (4978)
-
Writing only video (no audio) file using ffmpeg. av_write_header fails
19 janvier 2018, par KamalI have RTP packets with VP8 encoded data. I want to write it to a mkv file or webm file. I tried a bit, but I have not been successful yet. My code is as below
#include
#include
#include
#include
#include
#include <libavutil></libavutil>avassert.h>
#include <libavutil></libavutil>channel_layout.h>
#include <libavutil></libavutil>opt.h>
#include <libavutil></libavutil>mathematics.h>
#include <libavutil></libavutil>timestamp.h>
#include <libavformat></libavformat>avformat.h>
#include <libswscale></libswscale>swscale.h>
#include <libswresample></libswresample>swresample.h>
bool mfmedia_init_ffmpeg();
void mfmedia_ffprint(void *handle, int cnt, const char *format, va_list valist);
int main()
{
mfmedia_init_ffmpeg();
return 0;
}
bool mfmedia_init_ffmpeg()
{
bool ret = false;
AVCodecContext* context;
AVCodec* codec;
AVFormatContext* format;
AVStream* stream;
unsigned fps = 24;
unsigned width = 768;
unsigned height = 608;
av_register_all();
int err = 0;
char errorLog[128] = { 0 };
av_log_set_level(AV_LOG_TRACE);
av_log_set_callback(mfmedia_ffprint);
err = avformat_alloc_output_context2(&format, NULL, NULL, "o.webm");
if (err < 0)
{
printf("Cannot allocate output context: %s\n", av_make_error_string(errorLog, 128, err));
goto last;
}
codec = avcodec_find_encoder(AV_CODEC_ID_VP8);
if (!codec)
{
printf("Cannot find an encoder\n");
goto last;
}
context = avcodec_alloc_context3(codec);
if (!context)
{
printf("Cannot allocate a codec context\n");
goto last;
}
context->pix_fmt = AV_PIX_FMT_YUV420P;
context->width = width;
context->height = height;
context->time_base = (AVRational){1, fps};
err = avcodec_open2(context, codec, NULL);
if(err < 0)
{
printf("Cannot open codec: %s\n", av_make_error_string(errorLog, 128, err));
goto last;
}
stream = avformat_new_stream(format, codec);
if (!stream)
{
printf("Cannot create a new stream\n");
goto last;
}
//av_dump_format(format, 0, "o.webm", 1);
err = avio_open(&format->pb, "o.webm", AVIO_FLAG_WRITE);
if(err < 0)
{
printf("Cannot open output: %s\n", av_make_error_string(errorLog, 128, err));
goto last;
}
err = avformat_write_header(format, NULL);
if(err < 0)
{
printf("Cannot write header to stream: %s\n", av_make_error_string(errorLog, 128, err));
goto last;
}
ret = true;
last:
return ret;
}
void mfmedia_ffprint(void *handle, int cnt, const char *format, va_list valist)
{
char *log_buf = (char *)malloc(38192);
int length;
if(log_buf)
{
time_t rawtime;
time ( &rawtime );
length = vsprintf(log_buf ,format, valist);
length += sprintf((log_buf + length), " : %s ", ctime (&rawtime));
*(log_buf + length) = 0x0;
printf("%s", log_buf);
fflush(stdout);
free(log_buf);
}
}It is failing when I call avformat_write_header.
From trace log (towards end) I see
Setting default whitelist ’file,crypto’
: Fri Jan 19 16:58:57 2018
Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
: Fri Jan 19 16:58:57 2018
dimensions not set
: Fri Jan 19 16:58:57 2018
Cannot write header to stream : Invalid argumentPlease let me know why avformat_write_header is failing.
-
FFMPEG libx264 on Ubuntu 16
20 décembre 2019, par KanzaI have FFMPEG installed on my Ubuntu 16 but I want to use libx264 codec which I am unable to use. My current FFMPEG version is
ffmpeg -version
ffmpeg version N-90418-g74c6a6d Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
configuration: --prefix= --enable-pic --disable-yasm --enable-shared
libavutil 56. 11.100 / 56. 11.100
libavcodec 58. 15.100 / 58. 15.100
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 13.100 / 7. 13.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101 -
FFMPEG NVENC encoding with Windows10
1er mars 2021, par Daniel BartleyI had to reinstall windows 10 because windows. I have this exact same code working prior to the reinstall, however after I cant get it to work.



I am using the latest nvidia drivers 416.16
I have VisualStudio and Cuda Toolkit installed
2x 1080TIs



Using ffmpeg 4.0.2 :



T:\ffmpeg\bin\4.0.2\ffmpeg.exe -c:v h264_cuvid -i "T:\Streams\01-ready\2018-10-10 21-19-21.mp4" -i "T:\Streams\10-source\kpg-logo.png" -filter_complex "overlay=10:10" -b:v 24000k -c:v h264_nvenc -c:a copy "T:\Streams\02-encoded\2018-10-10 21-19-21_watermarked.mp4"




Output :



ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 7.3.1 (GCC) 20180722
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
 libavutil 56. 14.100 / 56. 14.100
 libavcodec 58. 18.100 / 58. 18.100
 libavformat 58. 12.100 / 58. 12.100
 libavdevice 58. 3.100 / 58. 3.100
 libavfilter 7. 16.100 / 7. 16.100
 libswscale 5. 1.100 / 5. 1.100
 libswresample 3. 1.100 / 3. 1.100
 libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'T:\Streams\01-ready\2018-10-10 21-19-21.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf57.84.100
 Duration: 00:28:41.71, start: 0.000000, bitrate: 24422 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown), 2560x1440, 24130 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 286 kb/s (default)
 Metadata:
 handler_name : SoundHandler
Input #1, png_pipe, from 'T:\Streams\10-source\kpg-logo.png':
 Duration: N/A, bitrate: N/A
 Stream #1:0: Video: png, rgba(pc), 2560x1440 [SAR 2834:2834 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
 Stream #0:0 (h264_cuvid) -> overlay:main
 Stream #1:0 (png) -> overlay:overlay
 overlay -> Stream #0:0 (h264_nvenc)
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264_nvenc @ 000002851a001940] CreateInputBuffer failed: out of memory (10)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Press any key to continue . . .




Error Message



[h264_nvenc @ 000002851a001940] CreateInputBuffer failed: out of memory (10)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Press any key to continue . . .




Any ideas ?



EDIT :
Still having issues, now even with the simple commands :



ffmpeg.exe -y -hwaccel cuvid -c:v h264_cuvid -i "input" -c:v h264_nvenc -preset slow "output.mp4"
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 7.3.1 (GCC) 20180722
 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
 libavutil 56. 14.100 / 56. 14.100
 libavcodec 58. 18.100 / 58. 18.100
 libavformat 58. 12.100 / 58. 12.100
 libavdevice 58. 3.100 / 58. 3.100
 libavfilter 7. 16.100 / 7. 16.100
 libswscale 5. 1.100 / 5. 1.100
 libswresample 3. 1.100 / 3. 1.100
 libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'T:\Streams\01-ready\2018-10-15 20-49-44.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf57.84.100
 Duration: 00:00:10.64, start: 0.000000, bitrate: 22978 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown), 2560x1440, 24216 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 156 kb/s (default)
 Metadata:
 handler_name : SoundHandler
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> h264 (h264_nvenc))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'T:\Streams\02-encoded\2018-10-15 20-49-44.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.12.100
 Stream #0:0(und): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), cuda, 2560x1440 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 60 fps, 15360 tbn, 60 tbc (default)
 Metadata:
 handler_name : VideoHandler
 encoder : Lavc58.18.100 h264_nvenc
 Side data:
 cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : SoundHandler
 encoder : Lavc58.18.100 aac
[h264_cuvid @ 000001a99033b600] ctx->cvdl->cuvidMapVideoFrame(ctx->cudecoder, parsed_frame.dispinfo.picture_index, &mapped_frame, &pitch, &params) failed -> CUDA_ERROR_UNKNOWN: unknown error
Error while decoding stream #0:0: Generic error in an external library
/* repeated many many times */
[h264_nvenc @ 000001a98fcfc100] Failed locking bitstream buffer: invalid param (8)
video encoding failed: Invalid argument
[aac @ 000001a98fdcd380] Qavg: 64894.355
[aac @ 000001a98fdcd380] 2 frames left in the queue on closing
Conversion failed!
Press any key to continue . . .




Full windows batch file :



@echo off

set ffmpegversion=20181015-c27c7b4-win64-static

set sourcedir=T:\Streams\01-ready
set outputdir=T:\Streams\02-encoded
set finaldir=T:\ffmpeg\mp4-upload

set libdir=T:\ffmpeg\bin\%ffmpegversion%

set introvid=T:\Streams\10-source\kpg-intro-10pec-audio.mp4
set watermark=T:\Streams\10-source\kpg-logo.png
set introvidlen=3.00
set outputbitrate=24000

cd /d %libdir%

if not exist %outputdir% (
 mkdir %outputdir%
)

if not exist %finaldir% (
 mkdir %finaldir%
)

setlocal enabledelayedexpansion
@echo Checking %sourcedir%\*.mp4
for %%f in (%sourcedir%\*.mp4) do ( 
 if not exist "%outputdir%\%%~nf_watermarked.mp4" (
 %libdir%\ffmpeg.exe -i "%%f" -i "%watermark%" -filter_complex "overlay=0:0" -b:v %outputbitrate%k -s 2560x1440 -pix_fmt yuv420p -c:a copy "%outputdir%\%%~nf_watermarked.mp4"
 TIMEOUT 2
 )

 if not exist "%outputdir%\%%~nf_watermarked_ready.mp4" (
 %libdir%\ffmpeg.exe -i "%introvid%" -i "%outputdir%\%%~nf_watermarked.mp4" -an -filter_complex " [0:v]trim=start=0:end=%introvidlen%,setpts=PTS-STARTPTS[firstclip]; [1:v]trim=start=1,setpts=PTS-STARTPTS[secondclip]; [0:v]trim=start=%introvidlen%,setpts=PTS-STARTPTS[fadeoutsrc]; [1:v]trim=start=0:end=1,setpts=PTS-STARTPTS[fadeinsrc]; [fadeinsrc]format=pix_fmts=yuva420p, fade=t=in:st=0:d=1:alpha=1[fadein]; [fadeoutsrc]format=pix_fmts=yuva420p, fade=t=out:st=0:d=1:alpha=1[fadeout]; [fadein]fifo[fadeinfifo]; [fadeout]fifo[fadeoutfifo];[fadeoutfifo][fadeinfifo]overlay[crossfade]; [firstclip][crossfade][secondclip]concat=n=3[output]; [0:a][1:a] acrossfade=d=1 [audio]" -map "[output]" -map "[audio]" -c:v libx264 -c:a aac -b:v %outputbitrate%k -ar 44100 -ab 96k -sn "%outputdir%\%%~nf_watermarked_ready.mp4"
 TIMEOUT 2
 )

 if not exist "%finaldir%\%%~nf.mp4" (
 COPY "%outputdir%\%%~nf_watermarked_ready.mp4" "%finaldir%\%%~nf.mp4"
 TIMEOUT 2
 )
)

PAUSE