
Recherche avancée
Autres articles (79)
-
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...) -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
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 (5186)
-
FFmpeg - record from stream terminating unexpectedly using kokorin/Jaffree ffmpeg wrapper for Java
18 avril 2024, par pyrmonI am programming a Spring Boot Application using Maven and Java 21. I am trying to record a stream from a url and save it to a mkv file. I intend to do this with kokorin/Jaffree in version 2023.09.10. The recording seems to work ok, however longer videos are terminating unexpectedly. Sometimes after 5 minutes, other times an hour or even longer. Sometimes with Exit Code 0 and sometimes with 1.


I have implemented the recording like this :


@Override
 public void startRecording(RecordingSchedule recordingSchedule) {
 logger.info("Starting recording for schedule with filename {}", recordingSchedule.getFileName());

 String m3uUrl = recordingSchedule.getM3uUrl();
 LocalDateTime endTime = timeUtils.parseStringToLocalDateTime(recordingSchedule.getEndTime());
 LocalDateTime stopTime = endTime.plusSeconds(20);
 String timeToRecord = timeUtils.calculateTimeToRecord(stopTime);
 Path outputPath = Paths.get("/recordings/" + recordingSchedule.getFileName());

 try {
 FFmpeg.atPath()
 .addInput(UrlInput.fromUrl(m3uUrl))
 .addArgument("-xerror")
 .addArguments("-reconnect", "5")
 .addArguments("-reconnect_streamed", "5")
 .addArguments("-reconnect_delay_max", "20")
 .addArguments("-t", timeToRecord)
 .addArguments("-c", "copy")
 .addOutput(
 UrlOutput.toPath(outputPath))
 .setLogLevel(LogLevel.WARNING)
 .execute();
 logger.info("Recording complete. Output file: {}", outputPath.toAbsolutePath());
 } catch (Exception e) {
 logger.error("Error recording M3U stream {}: {}", recordingSchedule.getFileName(), e.getMessage());
 }
 }



And I am calling the method like this :

executorConfig.executorService().submit(() -> ffmpegService.startRecording(recording));


Any ideas what I am doing wrong ?
Here are the log lines at the beginning and end of recording of the past two attempts :


2024-04-18T00:54:48.689+02:00 INFO 1 --- [pool-2-thread-1] m.s.r.service.impl.FfmpegServiceImpl : Starting recording for schedule with filename Example1.mkv
2024-04-18T00:54:48.697+02:00 WARN 1 --- [pool-2-thread-1] c.github.kokorin.jaffree.ffmpeg.FFmpeg : ProgressListener isn't set, progress won't be reported
2024-04-18T00:54:48.698+02:00 INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler : Command constructed:
ffmpeg -loglevel level+warning -i http://example.stream.url.com -n -xerror -reconnect 5 -reconnect_streamed 5 -reconnect_delay_max 20 -t 10771 -c copy /recordings/Example1.mkv
2024-04-18T00:54:48.698+02:00 INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler : Starting process: ffmpeg
2024-04-18T00:54:48.701+02:00 INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler : Waiting for process to finish
2024-04-18T01:31:02.633+02:00 WARN 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [h264 @ 0x559cd22dd940] [warning] Increasing reorder buffer to 2
2024-04-18T01:31:02.633+02:00 INFO 1 --- [pool-2-thread-1] c.g.k.jaffree.process.ProcessHandler : Process has finished with status: 0
2024-04-18T01:31:02.734+02:00 INFO 1 --- [pool-2-thread-1] m.s.r.service.impl.FfmpegServiceImpl : Recording complete. Output file: /recordings/Example1.mkv

2024-04-18T03:54:48.678+02:00 INFO 1 --- [pool-2-thread-2] m.s.r.service.impl.FfmpegServiceImpl : Starting recording for schedule with filename Example2.mkv
2024-04-18T03:54:48.678+02:00 WARN 1 --- [pool-2-thread-2] c.github.kokorin.jaffree.ffmpeg.FFmpeg : ProgressListener isn't set, progress won't be reported
2024-04-18T03:54:48.678+02:00 INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler : Command constructed:
ffmpeg -loglevel level+warning -i http://example.stream.url.com/ -n -xerror -reconnect 5 -reconnect_streamed 5 -reconnect_delay_max 20 -t 11431 -c copy /recordings/Example2.mkv
2024-04-18T03:54:48.678+02:00 INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler : Starting process: ffmpeg
2024-04-18T03:54:48.679+02:00 INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler : Waiting for process to finish
2024-04-18T04:57:22.256+02:00 WARN 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [h264 @ 0x55707ba988c0] [warning] Increasing reorder buffer to 3
2024-04-18T04:58:47.455+02:00 ERROR 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [NULL @ 0x55707ba988c0] [error] Picture timing SEI payload too large
2024-04-18T04:58:47.456+02:00 ERROR 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [NULL @ 0x55707ba988c0] [error] non-existing PPS 1 referenced
2024-04-18T04:58:47.456+02:00 WARN 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [matroska @ 0x55707ba9a380] [warning] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
2024-04-18T04:58:47.456+02:00 ERROR 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [matroska @ 0x55707ba9a380] [error] Can't write packet with unknown timestamp
2024-04-18T04:58:47.463+02:00 ERROR 1 --- [ StdErr] c.g.k.jaffree.process.BaseStdReader : [error] av_interleaved_write_frame(): Invalid argument
2024-04-18T04:58:47.463+02:00 INFO 1 --- [pool-2-thread-2] c.g.k.jaffree.process.ProcessHandler : Process has finished with status: 1
2024-04-18T04:58:47.564+02:00 ERROR 1 --- [pool-2-thread-2] m.s.r.service.impl.FfmpegServiceImpl : Error recording M3U stream Example2.mkv: Process execution has ended with non-zero status: 1. Check logs for detailed error message.



They were supposed to run nearly 3 hours and the other one over 3 hours. And with the timestamps you can see that they are not running nearly as long.
Thank you for your help !


-
Ffmpeg RTSP stream with size=N/A bitrate=N/A [closed]
6 octobre 2024, par ComycosWhen I try to stream a video it seems to work but bitrate and size are N/A
frame= 277 fps= 26 q=-1.0 size=N/A time=00:00:11.07 bitrate=N/A speed=1.05x


I run the following command to stream a video to a RTSP server :

ffmpeg -re -stream_loop -1 -i idurre-2024-09-17-12h33m19s.mp4 -c copy -f rtsp -rtsp_transport tcp rtsp://localhost:8554/test


The output ffmpeg is like this :


ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
 built with Apple clang version 15.0.0 (clang-1500.1.0.2.5)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
 libavutil 59. 39.100 / 59. 39.100
 libavcodec 61. 19.100 / 61. 19.100
 libavformat 61. 7.100 / 61. 7.100
 libavdevice 61. 3.100 / 61. 3.100
 libavfilter 10. 4.100 / 10. 4.100
 libswscale 8. 3.100 / 8. 3.100
 libswresample 5. 3.100 / 5. 3.100
 libpostproc 58. 3.100 / 58. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x127704880] st: 0 edit list: 1 Missing key frame while searching for timestamp: 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x127704880] st: 0 edit list 1 Cannot find an index entry before timestamp: 0.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'idurre-2024-09-17-12h33m19s.mp4':
 Metadata:
 major_brand : isom
 minor_version : 0
 compatible_brands: mp41avc1
 creation_time : 2024-09-17T10:34:16.000000Z
 encoder : vlc 3.0.21 stream output
 encoder-eng : vlc 3.0.21 stream output
 Duration: 00:00:55.68, start: 0.000000, bitrate: 16205 kb/s
 Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, 16203 kb/s, 25 fps, 25 tbr, 1000k tbn (default)
 Metadata:
 creation_time : 2024-09-17T10:34:16.000000Z
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
Output #0, rtsp, to 'rtsp://localhost:8554/test':
 Metadata:
 major_brand : isom
 minor_version : 0
 compatible_brands: mp41avc1
 encoder : Lavf61.7.100
 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 16203 kb/s, 25 fps, 25 tbr, 90k tbn (default)
 Metadata:
 creation_time : 2024-09-17T10:34:16.000000Z
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]
Press [q] to stop, [?] for help
frame= 516 fps= 26 q=-1.0 size=N/A time=00:00:20.63 bitrate=N/A speed=1.03x 

[q] command received. Exiting.

[out#0/rtsp @ 0x6000008e0240] video:40672KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
frame= 528 fps= 26 q=-1.0 Lsize=N/A time=00:00:21.11 bitrate=N/A speed=1.02x 



The server I'm streaming to is a MediaMTX which is supposed to receive the stream. It seems to be connected as it logs it :


mediamtx-rtsp | 2024/10/06 10:35:13 INF MediaMTX v1.9.0
mediamtx-rtsp | 2024/10/06 10:35:13 INF configuration loaded from /mediamtx.yml
mediamtx-rtsp | 2024/10/06 10:35:13 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
mediamtx-rtsp | 2024/10/06 10:35:13 INF [SRT] listener opened on :8890 (UDP)
mediamtx-rtsp | 2024/10/06 10:35:16 INF [RTSP] [conn 192.168.65.1:17069] opened
mediamtx-rtsp | 2024/10/06 10:35:16 INF [RTSP] [session b3bb2623] created by 192.168.65.1:17069
mediamtx-rtsp | 2024/10/06 10:35:16 INF [RTSP] [session b3bb2623] is publishing to path 'test', 1 track (H264)



But when I try to read it with ffplay nothing is showing...


-
Lambda/ffmpeg timelapse generation - output zero bytes, can't debug ffmpeg
25 août 2021, par GoOutsideI am attempting to use an AWS Lambda FFMPEG layer to build a timelapse of static images in an S3 bucket. To begin, I am basing my project off of the tutorial located here.


I can replicate the steps in the tutorial, so I know the FFMPEG layer is working in Lambda. I have replicated the FFMPEG commands on a standalone server, so I know they are correct.


Here is my setup : I have two S3 buckets,
lambda-source-bucket
andlambda-destination-bucket
. The contents oflambda-source-bucket
are :

1.jpg
2.jpg
3.jpg
4.jpg
5.jpg
6.jpg
7.jpg
files.txt



The
files.txt
contains this :

file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/1.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/2.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/3.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/4.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/5.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/6.jpg'
file 'https://lambda-source-bucket.s3.us-west-2.amazonaws.com/7.jpg'



This is my Lambda function code (in Python) :


import json
import os
import subprocess
import shlex
import boto3

S3_DESTINATION_BUCKET = "lambda-destination-bucket"
SIGNED_URL_TIMEOUT = 60

def lambda_handler(event, context):

 s3_source_bucket = event['Records'][0]['s3']['bucket']['name']
 s3_source_key = event['Records'][0]['s3']['object']['key']

 s3_source_basename = os.path.splitext(os.path.basename(s3_source_key))[0]
 s3_destination_filename = "timelapse.mp4"

 s3_client = boto3.client('s3')
 s3_source_signed_url = s3_client.generate_presigned_url('get_object',
 Params={'Bucket': s3_source_bucket, 'Key': s3_source_key},
 ExpiresIn=SIGNED_URL_TIMEOUT)

 ffmpeg_cmd = "/opt/bin/ffmpeg -y -r 24 -f concat -safe 0 -protocol_whitelist file,http,tcp,https,tls -I ""https://lambda-source-bucket.s3.us-west-2.amazonaws.com/files.txt"" -c copy -s 1024x576 -vcodec libx264 -" 
command1 = shlex.split(ffmpeg_cmd)
 p1 = subprocess.run(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

 resp = s3_client.put_object(Body=p1.stdout, Bucket=S3_DESTINATION_BUCKET, Key=s3_destination_filename)

 return {
 'statusCode': 200,
 'body': json.dumps('Processing complete successfully')
 }



The trigger for the Lambda function is when a new
files.txt
file is added tolambda-source-bucket
.

So far I have been able to get the trigger to fire, the function supposedly runs without errors (in Cloudwatch), and the function creates a new
timelapse.mp4
in thelambda-destination-bucket
. But this file is0 bytes
. I see no FFMPEG errors in the Cloudwatch console, though I am not sure I know how to configure my Lambda function code to log FFMPEG errors.

Also : if I'm going about this in a totally wrong way, I'd love to hear feedback. I'm guessing that the
concat
andfiles.txt
method of looping throughhttps://
is not the most efficient way to do this, but it's the only way I can figure this out so far.

Any help is most sincerely and humbly appreciated.