
Recherche avancée
Médias (16)
-
#7 Ambience
16 octobre 2011, par
Mis à jour : Juin 2015
Langue : English
Type : Audio
-
#6 Teaser Music
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#5 End Title
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
Autres articles (20)
-
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 -
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...) -
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)
Sur d’autres sites (5698)
-
Merge multiple VP9 WEBM files with FFMPEG
14 juillet 2020, par Mathix420I'm trying desperately to merge multiple VP9 WEBM files which has been transcoded separately.


I used this command to merge them all


# Generate the playlist
find efs/output -name '*-1080.webm' | sort | xargs -I{} echo "file '{}'" > plist.txt

# Concat files
ffmpeg -v error -f concat -reset_timestamps 1 -safe 0 -i plist.txt -c copy 1080.webm



But when I
ffprobe
the output file it shows me only the duration of the first file.
Same when playing it with VLC or ffplay.

I have seen and try the different StackOverflow threads about this issue but no one works for me.


-
x264 output video is blank when threading is enabled
15 juillet 2020, par NewbieCoderI am using libx264 compiled from source. It was configured to get both .dll and .lib by this command


./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def`


I am using the libx264 API in my screen-sharing program with the preset - "veryfast", tune - "zerolatency", profile - "high" and also the following settings.


param.i_csp = X264_CSP_BGRA;
 param.i_threads = 1;
 param.i_width = width;
 param.i_height = height;
 param.i_fps_num = fps;
 param.i_fps_den = 1;
 param.rc.i_bitrate = bitrate;
 param.rc.i_rc_method = X264_RC_ABR;
 param.rc.b_filler = true;
 param.rc.f_rf_constant = (float)0;
 param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
 param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
 param.b_repeat_headers = 0;
 param.b_annexb = 1;



For these settings the program works fine. I specified it as single threaded by setting
param.i_threads = 1
.
If this is removed, x264 defaults to using multiple threads and setsparam.i_threads
as 1.5x of number of cores in the CPU automatically. This will give faster performance than running in single thread.

But when I remove the
param.i_threads = 1
to make it multi-threaded, the generated output is fully grey. I cannot see any output when I view the live stream with VLC or some times I can view a weird output.

I am using this bitmap image as an example (https://imgur.com/a/l8LCd1l). Only this same image is being encoded multiple times. When it is saved into .h264 video, it is viewable clearly. But when the encoded payload is sent through rtmp, the live stream produces very bad and weird output (or sometimes no output). This is the weird output which im seeing most of the time for this image : https://imgur.com/a/VdyX1Zm


This is the full example code in which I am both streaming and writing video file of the same picture. This is using the srs librtmp library. There is no error but the stream has weird output.


In this code if you set add
param.i_threads = 1;
then only the output stream will be viewable. The problem is that it should be viewable in both single-threaded and multi-threaded encoding.

#include <iostream>
#include 
#include <sstream>
#include 
#include "srs_librtmp.h"

#pragma comment(lib, "C:/Softwares/x264/libx264.lib")

using namespace std;

int check_ret(int ret);

int main()
{
 int dts = 0;

 x264_param_t param;
 x264_t* h;
 x264_nal_t* nals;
 int i_nal;
 int pts = 0;
 int i_frame_size;
 x264_picture_t picIn;
 x264_picture_t picOut;

 x264_param_default_preset(&param, "veryfast", "zerolatency");

 //x264 settings
 param.i_csp = X264_CSP_BGRA;
 param.i_width = 1920;
 param.i_height = 1080;
 param.i_fps_num = 30;
 param.i_fps_den = 1;
 param.rc.i_bitrate = 2500;
 param.rc.i_rc_method = X264_RC_ABR;
 param.rc.b_filler = true;
 param.rc.f_rf_constant = (float)0;
 param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
 param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
 param.b_repeat_headers = 0;
 param.b_annexb = 1;

 x264_param_apply_profile(&param, "high");
 h = x264_encoder_open(&param);

 //allocate picture
 x264_picture_alloc(&picIn, param.i_csp, param.i_width, param.i_height);

 //picture settings
 picIn.img.i_plane = 1;
 picIn.img.i_stride[0] = 4 * param.i_width;
 picIn.i_type = X264_TYPE_AUTO;

 int header_size = x264_encoder_headers(h, &nals, &i_nal);
 FILE* fptr;
 fopen_s(&fptr, "example1.h264", "wb");
 // write sps and pps in the video file
 fwrite(nals->p_payload, header_size, 1, fptr);

 int size = 1920 * 1080 * 4;
 char* bmp = new char[size];
 FILE* bitptr;
 errno_t err = fopen_s(&bitptr, "flower.bmp", "rb");
 fseek(bitptr, 54, SEEK_SET);
 fread(bmp, size, 1, bitptr);
 fclose(bitptr);

 srs_rtmp_t rtmp = srs_rtmp_create("127.0.0.1:1935/live/test");

 if (srs_rtmp_handshake(rtmp) != 0)
 {
 std::cout << "Simple handshake failed.";
 return -1;
 }

 std::cout << "Handshake completed successfully.\n";

 if (srs_rtmp_connect_app(rtmp) != 0) {
 std::cout << "Connecting to host failed.";
 return -1;
 }

 std::cout << "Connected to host successfully.\n";

 if (srs_rtmp_publish_stream(rtmp) != 0) {
 std::cout << "Publish signal failed.";
 }

 std::cout << "Publish signal success\n";

 // write sps and pps in the live stream
 int ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nals->p_payload), header_size, 0, 0);
 ret = check_ret(ret);
 if (!ret)
 return -1;
 std::cout << "SPS and PPS sent.\n";

 // main loop
 std::cout << "Now streaming and encoding\n";
 int i = 1800;
 while (i--)
 {

 picIn.img.plane[0] = reinterpret_cast(bmp);
 picIn.i_pts = pts++;
 i_frame_size = x264_encoder_encode(h, &nals, &i_nal, &picIn, &picOut);
 if (i_frame_size)
 {
 for (int j = 0; j < i_nal; j++)
 {

 x264_nal_t* nal = nals + j;
 // write data in the video file
 fwrite(nal->p_payload, nal->i_payload, 1, fptr);
 // write data in the live stream
 ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nal->p_payload), nal->i_payload, dts, dts);
 ret = check_ret(ret);
 if (!ret)
 {
 return -1;
 }
 }
 }
 else
 {
 std::cout << "i_frame_size = 0 (encoder failed)\n";
 }
 dts += 33;
 }

 while (x264_encoder_delayed_frames(h))
 {
 i_frame_size = x264_encoder_encode(h, &nals, &i_nal, NULL, &picOut);
 if (i_frame_size)
 {
 fwrite(nals->p_payload, i_frame_size, 1, fptr);
 }
 }

 std::cout << "\nAll done\n";
 std::cout << "Output video is example1.h264 and it is viewable in VLC";

 return 0;
}

int check_ret(int ret)
{
 if (ret != 0) {
 if (srs_h264_is_dvbsp_error(ret)) {
 srs_human_trace("ignoring drop video error, code=%d", ret);
 }
 else if (srs_h264_is_duplicated_sps_error(ret)) {
 srs_human_trace("ignoring duplicated sps, code=%d", ret);
 }
 else if (srs_h264_is_duplicated_pps_error(ret)) {
 srs_human_trace("ignoring duplicated pps, code=%d", ret);
 }
 else {
 srs_human_trace("sending h264 raw data failed. ret=%d", ret);
 return 0;
 }
 }
 return 1;
}
</sstream></iostream>


If you would like to download the original flower.bmp file, here is the link : https://gofile.io/d/w2kX56
This error can be reproduced in any other bmp file also.


Please tell me what is causing this problem when multi-threading is enabled. Am I setting wrong values ? Is the code in which I am streaming the encoded data wrong ?


-
x264 output video is blank when threading is enabled
15 juillet 2020, par NewbieCoderI am using libx264 compiled from source. It was configured to get both .dll and .lib by this command


./configure --disable-cli --enable-shared --extra-ldflags=-Wl,--output-def=libx264.def`


I am using the libx264 API in my screen-sharing program with the preset - "veryfast", tune - "zerolatency", profile - "high" and also the following settings.


param.i_csp = X264_CSP_BGRA;
 param.i_threads = 1;
 param.i_width = width;
 param.i_height = height;
 param.i_fps_num = fps;
 param.i_fps_den = 1;
 param.rc.i_bitrate = bitrate;
 param.rc.i_rc_method = X264_RC_ABR;
 param.rc.b_filler = true;
 param.rc.f_rf_constant = (float)0;
 param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
 param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
 param.b_repeat_headers = 0;
 param.b_annexb = 1;



For these settings the program works fine. I specified it as single threaded by setting
param.i_threads = 1
.
If this is removed, x264 defaults to using multiple threads and setsparam.i_threads
as 1.5x of number of cores in the CPU automatically. This will give faster performance than running in single thread.

But when I remove the
param.i_threads = 1
to make it multi-threaded, the generated output is fully grey. I cannot see any output when I view the live stream with VLC or some times I can view a weird output.

I am using this bitmap image as an example (https://imgur.com/a/l8LCd1l). Only this same image is being encoded multiple times. When it is saved into .h264 video, it is viewable clearly. But when the encoded payload is sent through rtmp, the live stream produces very bad and weird output (or sometimes no output). This is the weird output which im seeing most of the time for this image : https://imgur.com/a/VdyX1Zm


This is the full example code in which I am both streaming and writing video file of the same picture. This is using the srs librtmp library. There is no error but the stream has weird output.


In this code if you set add
param.i_threads = 1;
then only the output stream will be viewable. The problem is that it should be viewable in both single-threaded and multi-threaded encoding.

#include <iostream>
#include 
#include <sstream>
#include 
#include "srs_librtmp.h"

#pragma comment(lib, "C:/Softwares/x264/libx264.lib")

using namespace std;

int check_ret(int ret);

int main()
{
 int dts = 0;

 x264_param_t param;
 x264_t* h;
 x264_nal_t* nals;
 int i_nal;
 int pts = 0;
 int i_frame_size;
 x264_picture_t picIn;
 x264_picture_t picOut;

 x264_param_default_preset(&param, "veryfast", "zerolatency");

 //x264 settings
 param.i_csp = X264_CSP_BGRA;
 param.i_width = 1920;
 param.i_height = 1080;
 param.i_fps_num = 30;
 param.i_fps_den = 1;
 param.rc.i_bitrate = 2500;
 param.rc.i_rc_method = X264_RC_ABR;
 param.rc.b_filler = true;
 param.rc.f_rf_constant = (float)0;
 param.rc.i_vbv_max_bitrate = param.rc.i_bitrate;
 param.rc.i_vbv_buffer_size = param.rc.i_bitrate;
 param.b_repeat_headers = 0;
 param.b_annexb = 1;

 x264_param_apply_profile(&param, "high");
 h = x264_encoder_open(&param);

 //allocate picture
 x264_picture_alloc(&picIn, param.i_csp, param.i_width, param.i_height);

 //picture settings
 picIn.img.i_plane = 1;
 picIn.img.i_stride[0] = 4 * param.i_width;
 picIn.i_type = X264_TYPE_AUTO;

 int header_size = x264_encoder_headers(h, &nals, &i_nal);
 FILE* fptr;
 fopen_s(&fptr, "example1.h264", "wb");
 // write sps and pps in the video file
 fwrite(nals->p_payload, header_size, 1, fptr);

 int size = 1920 * 1080 * 4;
 char* bmp = new char[size];
 FILE* bitptr;
 errno_t err = fopen_s(&bitptr, "flower.bmp", "rb");
 fseek(bitptr, 54, SEEK_SET);
 fread(bmp, size, 1, bitptr);
 fclose(bitptr);

 srs_rtmp_t rtmp = srs_rtmp_create("127.0.0.1:1935/live/test");

 if (srs_rtmp_handshake(rtmp) != 0)
 {
 std::cout << "Simple handshake failed.";
 return -1;
 }

 std::cout << "Handshake completed successfully.\n";

 if (srs_rtmp_connect_app(rtmp) != 0) {
 std::cout << "Connecting to host failed.";
 return -1;
 }

 std::cout << "Connected to host successfully.\n";

 if (srs_rtmp_publish_stream(rtmp) != 0) {
 std::cout << "Publish signal failed.";
 }

 std::cout << "Publish signal success\n";

 // write sps and pps in the live stream
 int ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nals->p_payload), header_size, 0, 0);
 ret = check_ret(ret);
 if (!ret)
 return -1;
 std::cout << "SPS and PPS sent.\n";

 // main loop
 std::cout << "Now streaming and encoding\n";
 int i = 1800;
 while (i--)
 {

 picIn.img.plane[0] = reinterpret_cast(bmp);
 picIn.i_pts = pts++;
 i_frame_size = x264_encoder_encode(h, &nals, &i_nal, &picIn, &picOut);
 if (i_frame_size)
 {
 for (int j = 0; j < i_nal; j++)
 {

 x264_nal_t* nal = nals + j;
 // write data in the video file
 fwrite(nal->p_payload, nal->i_payload, 1, fptr);
 // write data in the live stream
 ret = srs_h264_write_raw_frames(rtmp, reinterpret_cast(nal->p_payload), nal->i_payload, dts, dts);
 ret = check_ret(ret);
 if (!ret)
 {
 return -1;
 }
 }
 }
 else
 {
 std::cout << "i_frame_size = 0 (encoder failed)\n";
 }
 dts += 33;
 }

 while (x264_encoder_delayed_frames(h))
 {
 i_frame_size = x264_encoder_encode(h, &nals, &i_nal, NULL, &picOut);
 if (i_frame_size)
 {
 fwrite(nals->p_payload, i_frame_size, 1, fptr);
 }
 }

 std::cout << "\nAll done\n";
 std::cout << "Output video is example1.h264 and it is viewable in VLC";

 return 0;
}

int check_ret(int ret)
{
 if (ret != 0) {
 if (srs_h264_is_dvbsp_error(ret)) {
 srs_human_trace("ignoring drop video error, code=%d", ret);
 }
 else if (srs_h264_is_duplicated_sps_error(ret)) {
 srs_human_trace("ignoring duplicated sps, code=%d", ret);
 }
 else if (srs_h264_is_duplicated_pps_error(ret)) {
 srs_human_trace("ignoring duplicated pps, code=%d", ret);
 }
 else {
 srs_human_trace("sending h264 raw data failed. ret=%d", ret);
 return 0;
 }
 }
 return 1;
}
</sstream></iostream>


If you would like to download the original flower.bmp file, here is the link : https://gofile.io/d/w2kX56
This error can be reproduced in any other bmp file also.


Please tell me what is causing this problem when multi-threading is enabled. Am I setting wrong values ? Is the code in which I am streaming the encoded data wrong ?