
Recherche avancée
Autres articles (47)
-
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 -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (10570)
-
ffmpeg : improving MP4 to webm ogg conversions
14 juillet 2017, par Randy(Edited to include some of the things I’ve tried)
I’m a musician, and occasional web coder. I’ve been using video editing software (old version of Roxio Videowave from 2011) to build promotional videos from clips of some of my performances, and I’d like to put some of them on my own web pages in HTML5 video format. So that currently means I need MP4, WEBM, and OGG conversions. Fortunately the editing software churns out some very nice MP4 (H264) files, and has plenty of options for doing so. I purposely output the output size about 2X the likely display size, in hopes of offering more detail for better conversions. Specifically, the video output was AVC/H.264, 800 x 450, 30fps, variable bit rate, but with 600000 as a base line (that was the default for this setting anyway).
Now I’m nowhere near expert at this stuff, and I probably left out some important data. But bottom line, the resulting MP4 looked very good. Unfortunately, to put it on my own web page means at least converting to WEBM and OGG formats. It would be nice if all browsers just supported MP4, but then there would be licensing fees, so conversions are needed. Sadly, I’ve been wasting days now trying to do this with ffmpeg. Its easy to do, its doing it WELL that is a mystery to me. Just letting ffmpeg work using its defaults (meaning I just specify an input and output file) results in pretty terrible video. But I’ve also tried most of the settings for better quality available, and the resulting conversions are nowhere near as good as youtube’s conversions.
Based on the info about my original MP4 file, can someone suggest some better settings for ffmpeg conversions to WEBM and OGG ? Am I going about this all wrong ? The best I’ve done so far was with a string like this, which specified a high quality and a fairly robust bit rate...
ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
That was much better than the default settings, but still nowhere near the quality of YOUTUBE conversions. In my resulting WEBM video, you can pretty plainly see how the picture degrades, and will snap into focus every few seconds when a "key frame" comes up. These artifacts should not be so obvious. Thanks for any help.
-
Automation for Downloading, Encoding, Renaming and Uploading [on hold]
5 février 2019, par Madara UchihaHow do I automate - downloading anime episodes from Torrent > Encode the videos with ffmpeg or gui > rename (with encoder tag) > upload to Google drive ?
Should work 24/7. Need help ! -
DNN OpenCV Python using RSTP always crash after few minutes
1er juillet 2022, par renaldyksDescription :


I want to create a people counter using DNN. The model I'm using is MobileNetSSD. The camera I use is IPCam from Hikvision. Python communicates with IPCam using the RSTP protocol.


The program that I made is good and there are no bugs, when running the sample video the program does its job well. But when I replaced it with IPcam there was an unknown error.


Error :


Sometimes the error is :


[h264 @ 000001949f7adfc0] error while decoding MB 13 4, bytestream -6
[h264 @ 000001949f825ac0] left block unavailable for requested intra4x4 mode -1
[h264 @ 000001949f825ac0] error while decoding MB 0 17, bytestream 762



Sometimes the error does not appear and the program is killed.



Update Error


After revising the code, I caught the error. The error found is


[h264 @ 0000019289b3fa80] error while decoding MB 4 5, bytestream -25



Now I don't know what to do, because the error is not in Google.


Source Code :


Old Code


This is my very earliest code before getting suggestions from the comments field.


import time
import cv2
import numpy as np
import math
import threading

print("Load MobileNeteSSD model")

prototxt = "MobileNetSSD_deploy.prototxt"
model = "MobileNetSSD_deploy.caffemodel"

CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
 "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
 "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
 "sofa", "train", "tvmonitor"]

net = cv2.dnn.readNetFromCaffe(prototxt, model)

pos_line = 0
offset = 50
car = 0
detected = False
check = 0
prev_frame_time = 0


def detect():
 global check, car, detected
 check = 0
 if(detected == False):
 car += 1
 detected = True


def center_object(x, y, w, h):
 cx = x + int(w / 2)
 cy = y + int(h / 2)
 return cx, cy


def process_frame_MobileNetSSD(next_frame):
 global car, check, detected

 rgb = cv2.cvtColor(next_frame, cv2.COLOR_BGR2RGB)
 (H, W) = next_frame.shape[:2]

 blob = cv2.dnn.blobFromImage(next_frame, size=(300, 300), ddepth=cv2.CV_8U)
 net.setInput(blob, scalefactor=1.0/127.5, mean=[127.5, 127.5, 127.5])
 detections = net.forward()

 for i in np.arange(0, detections.shape[2]):
 confidence = detections[0, 0, i, 2]

 if confidence > 0.5:

 idx = int(detections[0, 0, i, 1])
 if CLASSES[idx] != "person":
 continue

 label = CLASSES[idx]

 box = detections[0, 0, i, 3:7] * np.array([W, H, W, H])
 (startX, startY, endX, endY) = box.astype("int")

 center_ob = center_object(startX, startY, endX-startX, endY-startY)
 cv2.circle(next_frame, center_ob, 4, (0, 0, 255), -1)

 if center_ob[0] < (pos_line+offset) and center_ob[0] > (pos_line-offset):
 # car+=1
 detect()

 else:
 check += 1
 if(check >= 5):
 detected = False

 cv2.putText(next_frame, label+' '+str(round(confidence, 2)),
 (startX, startY-10), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)
 cv2.rectangle(next_frame, (startX, startY),
 (endX, endY), (0, 255, 0), 3)

 return next_frame


def PersonDetection_UsingMobileNetSSD():
 cap = cv2.VideoCapture()
 cap.open("rtsp://admin:Admin12345@192.168.100.20:554/Streaming/channels/2/")

 global car,pos_line,prev_frame_time

 frame_count = 0

 while True:
 try:
 time.sleep(0.1)
 new_frame_time = time.time()
 fps = int(1/(new_frame_time-prev_frame_time))
 prev_frame_time = new_frame_time

 ret, next_frame = cap.read()
 w_video = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
 h_video = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
 pos_line = int(h_video/2)-50

 if ret == False: break

 frame_count += 1
 cv2.line(next_frame, (int(h_video/2), 0),
 (int(h_video/2), int(h_video)), (255, 127, 0), 3)
 next_frame = process_frame_MobileNetSSD(next_frame)

 cv2.rectangle(next_frame, (248,22), (342,8), (0,0,0), -1)
 cv2.putText(next_frame, "Counter : "+str(car), (250, 20),
 cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
 cv2.putText(next_frame, "FPS : "+str(fps), (0, int(h_video)-10),
 cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
 cv2.imshow("Video Original", next_frame)
 # print(car)

 except Exception as e:
 print(str(e))

 if cv2.waitKey(1) & 0xFF == ord('q'): 
 break


 print("/MobileNetSSD Person Detector")


 cap.release()
 cv2.destroyAllWindows()

if __name__ == "__main__":
 t1 = threading.Thread(PersonDetection_UsingMobileNetSSD())
 t1.start()



New Code


I have revised my code and the program still stops taking frames. I just revised the PersonDetection_UsingMobileNetSSD() function. I've also removed the multithreading I was using. The code has been running for about 30 minutes but after a broken frame, the code will never re-execute the program block
if ret == True
.

def PersonDetection_UsingMobileNetSSD():
 cap = cv2.VideoCapture()
 cap.open("rtsp://admin:Admin12345@192.168.100.20:554/Streaming/channels/2/")

 global car,pos_line,prev_frame_time

 frame_count = 0

 while True:
 try:
 if cap.isOpened():
 ret, next_frame = cap.read()
 if ret:
 new_frame_time = time.time()
 fps = int(1/(new_frame_time-prev_frame_time))
 prev_frame_time = new_frame_time
 w_video = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
 h_video = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
 pos_line = int(h_video/2)-50

 # next_frame = cv2.resize(next_frame,(720,480),fx=0,fy=0, interpolation = cv2.INTER_CUBIC)

 if ret == False: break

 frame_count += 1
 cv2.line(next_frame, (int(h_video/2), 0),
 (int(h_video/2), int(h_video)), (255, 127, 0), 3)
 next_frame = process_frame_MobileNetSSD(next_frame)

 cv2.rectangle(next_frame, (248,22), (342,8), (0,0,0), -1)
 cv2.putText(next_frame, "Counter : "+str(car), (250, 20),
 cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
 cv2.putText(next_frame, "FPS : "+str(fps), (0, int(h_video)-10),
 cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
 cv2.imshow("Video Original", next_frame)
 # print(car)
 else:
 print("Crashed Frame")
 else:
 print("Cap is not open")

 except Exception as e:
 print(str(e))

 if cv2.waitKey(1) & 0xFF == ord('q'): 
 break


 print("/MobileNetSSD Person Detector")


 cap.release()
 cv2.destroyAllWindows()



Requirement :


Hardware : Intel i5-1035G1, RAM 8 GB, NVIDIA GeForce MX330


Software : Python 3.6.2 , OpenCV 4.5.1, Numpy 1.16.0


Question :


- 

- What should i do for fixing this error ?
- What causes this to happen ?






Best Regards,



Thanks