
Recherche avancée
Médias (91)
-
Richard Stallman et le logiciel libre
19 octobre 2011, par
Mis à jour : Mai 2013
Langue : français
Type : Texte
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
#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
Autres articles (78)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (9113)
-
Using libavformat to mux H.264 frames into RTP
22 novembre 2016, par DanielB6I have an encoder that produces a series of H.264 I-frames and P-frames. I’m trying to use libavformat to mux and transmit these frames over RTP, but I’m stuck.
My program sends RTP data, but the RTP timestamp increments by 1 each successive frame, instead of 90000/fps. It also doesn’t look like it’s doing the proper framing for H.264 NAL, since I can’t decode the stream as H.264 in Wireshark.
I suspect that I’m not setting up the codec information properly, but it appears in many places in the output format context, so it’s unclear what exactly needs to be setup. The examples seem to all copy codec context info from encoders, which isn’t my use case.
This is what I’m trying :
int main() {
AVFormatContext context = avformat_alloc_context();
if (!context) {
printf("avformat_alloc_context failed\n");
return;
}
AVOutputFormat *format = av_guess_format("rtp", NULL, NULL);
if (!format) {
printf("av_guess_format failed\n");
return;
}
context->oformat = format;
snprintf(context->filename, sizeof(context->filename), "rtp://%s:%d", "192.168.2.16", 10000);
if (avio_open(&(context->pb), context->filename, AVIO_FLAG_READ_WRITE) < 0) {
printf("avio_open failed\n");
return;
}
stream = avformat_new_stream(context, NULL);
if (!stream) {
printf("avformat_new_stream failed\n");
return;
}
stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
stream->codecpar->codec_id = AV_CODEC_ID_H264;
stream->codecpar->width = 1920;
stream->codecpar->height = 1080;
avformat_write_header(context, NULL);
...
write packets
...
}Example write packet :
int write_packet(uint8_t *data, int size) {
AVPacket p;
av_init_packet(&p);
p.data = buffer;
p.size = size;
p.stream_index = stream->index;
av_interleaved_write_frame(context, &p);
}I’ve even went so far to build in libx264, find the encoder, and copy the codec context info from there into the stream codecpar, with the same result. My goal is to build without libx264, and any other libs that aren’t required, but it isn’t clear whether libx264 is required for defaults such as time base.
How can the libavformat RTP muxer be initialized to properly send H.264 frames over RTCP+RTP ?
-
QSharedMemory in Real-Time process
21 novembre 2016, par Seungsoo KimI’m trying to use QSharedMemory Class to share video data between two processes.
So I tried like following method, but it has problem in simultaneous access of two processes.
Two process crashes when they access sequentially to same memory name(key) "SharedMemory".
I locked them while they’re used, but also it doesn’t work well.
How can i avoid this crash ??
-
Writing to SharedMemory - data type is and this function called by callback.
QBuffer buffer;
buffer.open(QBuffer::ReadWrite);
QDataStream out(&buffer);
QByteArray outArray = QByteArray::fromRawData(reinterpret_cast<const>(data), strlen(reinterpret_cast<const>(data)));
out << width << height << step << cameraId << strlen(reinterpret_cast<const>(data));
out.writeRawData(outArray.data(), outArray.size());
int size = buffer.size();
sharedMemory.setKey("SharedMemory");
if (!sharedMemory.isAttached()) {
printf("Cannot attach to shared memory to update!\n");
}
if (!sharedMemory.create(size))
{
printf("failed to allocate memory\n");
}
sharedMemory.lock();
char *to = (char*)sharedMemory.data();
const char *from = buffer.data().data();
memcpy(to, from,qMin(sharedMemory.size(),size));
sharedMemory.unlock();
</const></const></const> -
Using data in SharedMemory. - this function is called by QThread, interval 100ms
QSharedMemory sharedMemory("SharedMemory");
sharedMemory.lock();
if (!sharedMemory.attach()) {
printf("failed to attach to memory\n");
return;
}
QBuffer buffer;
QDataStream in(&buffer);
sharedMemory.create(1920 * 1080);
buffer.setData((char*)sharedMemory.constData(), sharedMemory.size());
buffer.open(QBuffer::ReadOnly);
sharedMemory.unlock();
sharedMemory.detach();
int r_width = 0;
int r_height = 0;
int r_cameraId = 0;
int r_step = 0;
int r_strlen = 0;
in >> r_width >> r_height >> r_step >> r_cameraId >> r_strlen;
char* receive = new char[r_strlen];
in.readRawData(receive, r_strlen);
//unsigned char* r_receive = new unsigned char[r_strlen];
//r_receive = (unsigned char*)receive;
QPixmap backBuffer = QPixmap::fromImage(QImage((unsigned char*)receive, r_width, r_height, r_step, QImage::Format::Format_RGB888));
ui.label->setPixmap(backBuffer.scaled(ui.label->size(), Qt::KeepAspectRatio));
ui.label->show();
please share your idea ! thank you !
-
-
Facebook Reels Upload always failing
21 juin, par Evrard A.I'm trying to upload Reels through Facebook Graph API. The video is created with the following
ffmpeg
command.

cmd = [
 'ffmpeg',
 '-i', video_path,
 '-i', voice_path,
 '-i', music_path,

 '-filter_complex',
 '[1:a]loudnorm=I=-16:LRA=11:TP=-1.5,adelay=0|0[a1];' +
 '[2:a]volume=0.2,afade=t=in:ss=0:d=0.02,afade=t=out:st=28:d=0.03[a2];' +
 '[a1][a2]amix=inputs=2:duration=first:dropout_transition=0[aout]',

 '-map', '0:v:0',
 '-map', '[aout]',

 '-vf',
 f"subtitles='{str(ass_path)}',format=yuv420p,scale=1080:1920:force_original_aspect_ratio=decrease,pad=1080:1920:(ow-iw)/2:(oh-ih)/2,setsar=1", # Incrustation des sous-titres

 '-r', '30',
 '-g', '60',
 '-keyint_min', '60',
 '-sc_threshold', '0',
 '-x264opts', 'no-scenecut',

 '-c:v', 'libx264',
 '-profile:v', 'baseline',
 '-level', '4.1',
 '-pix_fmt', 'yuv420p',
 '-color_range', 'tv',
 '-colorspace', 'bt709',

 '-b:v', '9500k',
 '-maxrate', '9500k',
 '-bufsize', '19000k',

 '-c:a', 'aac',
 '-b:a', '192k',
 '-ac', '2',
 '-ar', '48000',

 '-movflags', '+faststart',
 '-video_track_timescale', '15360',
 '-max_muxing_queue_size', '9999',

 '-y', self.output_video_path if self.output_video_path else f'{parts[0]}.subtitled.{parts[1]}'
 ]

 subprocess.run(cmd, check=True)



Here is the class method I use to publish :


import requests, os, time
 from datetime import datetime, timedelta
 from moviepy.editor import VideoFileClip
 
 def post_reel(
 self,
 page_id: str,
 page_access_token: str,
 video_file_path: str,
 video_description: str,
 tags: list = None, # type: ignore
 publish_now: bool = True
 ):
 def extract_first_frame(video_path: str, output_image_path: str, time_in_seconds: float = 1):
 """
 Extrait une frame à time_in_seconds et la sauvegarde comme miniature.
 """
 try:
 clip = VideoFileClip(video_path)
 clip.save_frame(output_image_path, t=time_in_seconds)
 print(f"[THUMBNAIL] Frame at {time_in_seconds}s saved to {output_image_path}")
 return output_image_path
 except Exception as e:
 print(f"[ERROR] Could not extract thumbnail: {str(e)}")
 return None

 def wait_for_video_ready(video_id, page_access_token, timeout=300, poll_interval=10):
 """
 Attends que la vidéo soit complètement traitée et publiée.
 """
 status_url = f"{self.BASE_API_URL}/{video_id}"
 params = {
 "access_token": page_access_token,
 "fields": "status"
 }

 start = time.time()
 while time.time() - start < timeout:
 try:
 r = requests.get(url=status_url, params=params)
 r.raise_for_status()
 status = r.json().get("status", {})
 processing = status.get("processing_phase", {}).get("status")
 publishing = status.get("publishing_phase", {}).get("status")
 video_status = status.get("video_status")

 print(f"[WAIT] video_status={video_status}, processing={processing}, publishing={publishing}")

 if processing == "complete" and publishing == "complete":
 print("[READY] Reel processed and published")
 return True
 elif processing == "error":
 print(r.json())

 except Exception as e:
 print(f"[ERROR] during polling: {e}")

 time.sleep(poll_interval)

 print("[TIMEOUT] Video did not finish processing in time.")
 return False

 try:
 # Step 1: Initialize upload
 init_url = f"{self.BASE_API_URL}/{page_id}/video_reels"
 init_params = {"upload_phase": "start"}
 init_payload = {'access_token': page_access_token}

 r = requests.post(url=init_url, data=init_payload, params=init_params)
 r.raise_for_status()
 response = r.json()
 video_id = response["video_id"]
 upload_url = response["upload_url"]
 print(f"[INIT OK] Video ID: {video_id}")

 # Step 2: Upload video
 file_size = os.path.getsize(video_file_path)
 headers = {
 'Authorization': f"OAuth {page_access_token}",
 'offset': "0",
 'file_size': str(file_size),
 }

 with open(video_file_path, 'rb') as f:
 files = {'source': f}
 r = requests.post(url=upload_url, data=files, headers=headers)
 r.raise_for_status()
 upload_response = r.json()

 if not upload_response.get("success"):
 print("[ERROR] Upload failed.")
 return None
 print(f"[UPLOAD OK]")

 # Step 3: Check video status
 status_check_url = f'{self.BASE_API_URL}/{video_id}'
 check_params = {
 "access_token": page_access_token,
 "fields": "status"
 }
 r = requests.get(url=status_check_url, params=check_params)
 r.raise_for_status()
 print(f"[STATUS CHECK] {r.json()}")

 # Step 4: Finalize video
 finalize_params = {
 "video_id": video_id,
 "upload_phase": "finish",
 "published": "true",
 "access_token": page_access_token,
 "video_state": "PUBLISHED" if publish_now else "SCHEDULED",
 "title": video_description,
 "description": video_description
 }

 if not publish_now:
 finalize_params["scheduled_publish_time"] = int((datetime.now() + timedelta(days=1)).timestamp())

 if tags:
 finalize_params["tags"] = ",".join(tags)

 r = requests.post(url=init_url, params=finalize_params, headers=headers)
 r.raise_for_status()
 finalize_response = r.json()
 post_id = finalize_response.get("post_id")
 print(f"[FINALIZE OK] Post ID: {post_id}")
 
 # WAIT UNTIL PUBLISHED
 if not wait_for_video_ready(video_id, page_access_token):
 print("[ERROR] Reel processing timeout or failure")
 return None
 
 # Step 5: Extract and upload thumbnail
 thumbnail_path = f"temp_thumb_{video_id}.jpg"
 if extract_first_frame(video_file_path, thumbnail_path):
 thumb_url = f"{self.BASE_API_URL}/{video_id}/thumbnails"
 with open(thumbnail_path, 'rb') as img:
 files = {'source': img}
 thumb_payload = {'access_token': page_access_token}
 r = requests.post(url=thumb_url, files=files, data=thumb_payload)
 r.raise_for_status()
 print("[THUMBNAIL UPLOADED]")
 # Clean up temp file
 os.remove(thumbnail_path)
 print("[THUMBNAIL CLEANED UP]")

 return post_id

 except Exception as e:
 print(f"[ERROR] {str(e)}")
 return None



Here are the logs I get :


- 

[INIT OK] Video ID: 1020853163558419
[UPLOAD OK]
[STATUS CHECK]








{
 "status": {
 "video_status": "upload_complete",
 "uploading_phase": {
 "status": "complete",
 "bytes_transferred": 37780189
 },
 "processing_phase": {
 "status": "not_started"
 },
 "publishing_phase": {
 "status": "not_started"
 },
 "copyright_check_status": {
 "status": "in_progress"
 }
 },
 "id": "1020853163558419"
}



- 

[FINALIZE OK] Post ID: 122162302376476425
[WAIT] video_status=upload_complete, processing=not_started, publishing=not_started
[WAIT] video_status=error, processing=error, publishing=not_started








{
 "status": {
 "video_status": "error",
 "uploading_phase": {
 "status": "complete",
 "bytes_transferred": 37780189
 },
 "processing_phase": {
 "status": "error",
 "errors": [
 {
 "code": 1363008,
 "message": "Video Creation failed, please try again."
 }
 ]
 },
 "publishing_phase": {
 "status": "not_started"
 },
 "copyright_check_status": {
 "status": "in_progress"
 }
 },
 "id": "1020853163558419"
}



It seems the error code
1363008
is related to the video properties format but even after following Facebook Reels video format recommandations, I can't make it work.

Can you help me with this please ?


I failed getting usefull help with ChatGPT 😅, and thanks in advance for anyone who answers or comments my question.