
Recherche avancée
Autres articles (45)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)
Sur d’autres sites (8257)
-
ffmpeg issues "501 Not Implemented" while recording an RTSP stream
28 février 2019, par atsushiI have a 4K camera (Sony SNC-VB770) streaming RTSP.
I’m trying to record the stream into files (each has handy length, say, 1hour)
using a simple script to repeatedly launch ffmpeg (ver 4.1) :while : ; do
# (set $url and $outfile, and then)
ffmpeg -rtsp_transport tcp -t 3600 -y -i $url -c copy -map 0:0 -b:v 16000k $outfile
doneIf I run the script on a local PC directly connected to the camera, it works (longer than a week, at least).
However, if I do the same on a server machine located in a data center, it fails randomly with no error message.
Sometimes it runs for a few days, sometimes it dies in one minutes.Typical output looks like the following :
# devname: snc-vb770
# url: rtsp://10.40.35.90/media/video1
# vb: 16000k
# datefmt %d%H
# addtimestamp 0
no timestamp
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
configuration: --prefix=/usr/local/ffmpeg-4.1 --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libx264 --enable-libvorbis --enable-filter=drawtext --enable-libfreetype --enable-libfribidi --enable-fontconfig
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, rtsp, from 'rtsp://10.40.35.90/media/video1':
Metadata:
title : Sony RTSP Server
Duration: N/A, start: 0.066667, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 14.99 fps, 14.99 tbr, 90k tbn, 29.97 tbc
Output #0, mp4, to './2811.mp4':
Metadata:
title : Sony RTSP Server
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 16000 kb/s, 14.99 fps, 14.99 tbr, 90k tbn, 90k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x24e4ec0] 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
[mp4 @ 0x24e4ec0] pts has no value
[mp4 @ 0x24e4ec0] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
frame= 33 fps=0.0 q=-1.0 size= 1792kB time=00:00:02.00 bitrate=7332.9kbits/s speed=3.57x
...
frame= 104 fps=8.4 q=-1.0 Lsize= 6532kB time=00:00:06.74 bitrate=7939.6kbits/s speed=0.548x
video:6531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.023506%I’ve looked into RTSP packet and found an "RTSP/1.0 501 Not Implemented" is sent from ffmpeg to the camera.
After that the camera eventually sent back "RTSP/1.0 505 RTSP Version not supported" and then ffmpeg quits shortly.The "501" packet seems to be generated by libavformat/rtsp.c:ff_rtsp_read_reply(),
when ffmpeg receive a malformed RTSP packet with method=(null), status_code=0.
I don’t know why such packets arrive at random timing and who is wrong (maybe the camera, maybe any of network switches or routers in the middle of the network path from the camera to the server machine).
But anyway, I don’t want the recording to be stopped
due to those malformed packets.Is there any workaround to make ffmpeg ignore invalid RTSP packets and just continue the recording ?
Additional information :
-
I’ve tested the recording with both ffmpeg ver4.1 and 2.8.4 and no difference observed.
-
No difference observed at lower resolution nor at lower bitrate.
-
I have 3 cameras from various manufacturers in the same network environment.
All of the three are working without problem for more than a month.
Only the Sony SNC-VB770 shows the strange behavior.
-
-
Running FFmpeg from AWS
11 mai 2019, par JayThis code works perfectly from my local machine.
import subprocess
p = subprocess.call('ffmpeg -r 1 -loop 1 -i "ep1.png" -i "ep1.mp3" -acodec copy -r 1 -shortest -vf scale=1280:720 ep1.flv',shell=True)I would like to run it from AWS
Lambda code
import boto3
import subprocess
s3 = boto3.client('s3')
def lambda_handler(event, context):
ep1PNG = s3.get_object(Bucket='my-buc',Key='ep1.PNG')
ep1MP3 = s3.get_object(Bucket='my-buc',Key='ep1.mp3')
p = subprocess.call(
'/opt/ffmpeg/ffmpeg -r 1 -loop 1 -i ep1PNG -i ep1MP3 -acodec copy -r 1 -shortest -vf scale=1280:720 /tmp/ep1.flv', shell=True)
# TODO implement
return {
'statusCode': 200,
}Questions
Are these correct inside subprocess.call() ?
/opt/ffmpeg/ffmpeg #<-----Is this correct ?
ep1PNG #<-----Is this correct ?
ep1MP3 #<-----Is this correct ?
/tmp/ep1.flv #<----- Not Sending Output to S3 BucketPlease comment if I’m heading in the right direction been trying this for about a week now
ffmpeg is uploaded as a layer
-
Why does ffmpeg stop recording at midnight ?
22 septembre 2019, par peterI have a shellscript like this under Kubuntu 19.10,
#!/bin/bash
while true
do
FILE=/media/petermc/Security5/Camera2/Camera2_.mp4
FILE=${FILE%.*}`date +%Y-%m-%d_%H-%M-%S-%N`.${FILE#*.}
echo $FILE
ffmpeg -rtsp_transport tcp -t 00:15:00 -i rtsp://*user*:*password*@192.168.1.60:554/ch02/0 -c copy -map 0 $FILE
doneIt records files like this,
Camera2_2019-09-21_23-36-57-874602376.mp4
Camera2_2019-09-21_23-51-57-876639147.mp4Basically recording 15 minutes at a time from the RTSP feed, then starting a new file.
However it stops working at midnight, the last few lines from the log file are this,
frame= 3987 fps= 13 q=-1.0 size= 117760kB time=00:05:06.51 bitrate=3147.3kbits/s speed=1.01x
frame= 3994 fps= 13 q=-1.0 size= 118016kB time=00:05:07.07 bitrate=3148.4kbits/s speed=1.01x
frame= 4001 fps= 13 q=-1.0 size= 118016kB time=00:05:07.59 bitrate=3143.1kbits/s speed=1.01x
frame= 4008 fps= 13 q=-1.0 size= 118272kB time=00:05:08.11 bitrate=3144.6kbits/s speed=1.01xSo there doesn’t seem to be any error, it stops recording at 5 minutes into the last file with no error.
Another piece of information is that I have 6 cameras, and 4 stopped recording, the ones connected to a DVR. I have a couple of IP cameras and they kept recording.
What could be the cause of this ? Plus, what else could I do to work around this or diagnose this ?
UPDATE :
I believe the issue is because the DVR has a maintenance setup to restart once at week at midnight. If this is what happened, is there any way I can configure ffmpeg to restart if it has lost the stream ?