
Recherche avancée
Médias (91)
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
-
USGS Real-time Earthquakes
8 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
SWFUpload Process
6 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (67)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (10375)
-
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 ?


-
ffmpeg live stream to Youtube command line
30 juin 2020, par brainoverflowseWould anyone assist myself with creating the correct ffmpeg command line for an audio and video rtsp camera feed that is 1440 and scale it to 1080 with a max bitrate of 10000 ?


-
Freezing frames and demux errors
23 novembre 2015, par f.rodriguesI’m trying to join some video clips using ffmpeg via python script using subprocess.
Here’s a section of the code :
def join_videos(videos):
# videos is a list of tuples with (file_name, start_point, duration)
path = os.path.dirname(__file__)
# create a new video file containg only the desired bit, it will be named output_N.mov
for out_n, (file_name, start, duration) in enumerate(videos, 1):
video_path = path + "/VIDEOS/" + file_name
## essentialy ffmpeg -i %PATH_TO_VIDEO -ss %STARTING_POINT -c copy -t %DURATION output_%NUMBER.mov
command = ["ffmpeg", "-i",video_path,"-ss", str(start),"-c","copy","-t",str(duration),"output_%i.mov"%out_n]
subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
# get the list of files with this pattern
files = glob.glob("output_*.mov")
# add them to a text file
with open("to_merge_tmp.txt", 'w') as f:
for file_name in files:
f.write("file '{path}/{file_name}'\n".format(**locals()))
# use 'ffmpeg' to concatenate
command = "ffmpeg -f concat -i to_merge_tmp.txt -c copy final.mov"
subprocess.Popen(command.split(" "), stderr=subprocess.PIPE, stdout=subprocess.PIPE)I issue a new video to be made using a list of file names and desired start point and duration.
ex :
videos = [('video1.mov', 15.5, 10), # video1, starting at 15.5 seconds, duration of 10 seconds
('video2.mov', 10.7, 5),
('video3.mov', 0, 20)]
join_videos(videos)this will generate a final.mov file with the parts joined together (one after the other)
The program runs fine. No errors or anything.
But when I try to play it, I have some frames that stay for too long (freezing), the audio plays normaly.
I made a second script to play it programmaticly using the python bindings for VLC
Here’s it :
import vlc
instance = vlc.Instance()
media = instance.media_new("final.mov")
player = instance.media_player_new()
player.set_media(media)
player.play()
while player.is_playing():
pass
instance.vlm_release()
player.release()
instance.release()With this I get a bunch of warning when playing the files.
for instance, this happens and the video doesn’t play (demux error)
[0x7f4e64009528] mp4 demux error: MP4 plugin discarded (no moov,foov,moof box)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f4e64025be0] moov atom not found
[0x7f4e64009528] avformat demux error: Could not open /medi /.../final.mov: Unknown error 1052488119And this happens, the video plays but with the freezing frames.
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Non-reference picture received and no reference available
[h264 @ 0x7fe76c0e5280] decode_slice_header error
[h264 @ 0x7fe76c0e5280] concealing 1080 DC, 1080 AC, 1080 MV errors
Non-reference picture received and no reference available
[h264 @ 0x7fe76c0e5820] decode_slice_header error
[h264 @ 0x7fe76c0e5820] concealing 1080 DC, 1080 AC, 1080 MV errors
[0x7fe740001248] main vout display error: Failed to resize displayor this one, which stops the playback midway and crashes the program.
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Fontconfig warning: FcPattern object size does not accept value "0"
Non-reference picture received and no reference available
[h264 @ 0x7f5c3c0c0000] decode_slice_header error
[h264 @ 0x7f5c3c0c0000] concealing 1080 DC, 1080 AC, 1080 MV errors
Non-reference picture received and no reference available
[h264 @ 0x7f5c3c0c0440] decode_slice_header error
[h264 @ 0x7f5c3c0c0440] concealing 1080 DC, 1080 AC, 1080 MV errors
[h264 @ 0x7f5c3c0c0440] Reinit context to 1280x720, pix_fmt: 12
Non-reference picture received and no reference available
[h264 @ 0x7f5c3c0c09e0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x7f5c3c0befa0] decode_slice_header errorI don’t know whats going on, I’m pretty sure it’s how the ffmpeg joins the files.
EDIT
As I found here, the
moov atom not found
error happens when a video recorder crashes when creating the file. But I find it hard to understand why this happens and doesn’t show any error when creating those files.