
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (29)
-
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 (...) -
De l’upload à la vidéo finale [version standalone]
31 janvier 2010, parLe chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
Upload et récupération d’informations de la vidéo source
Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (3870)
-
How to record a livestream in ffmpeg or gstreamer and split the files without skipping or duplicating frames
15 décembre 2020, par Blake CochraneCan somone please recommend a solution for safely recording a live stream to a file that would not produce a corrupted file if the system was unsavely shut down.


I am starting on a project using a battery powered Raspberry Pi 4B.
I am using GStreamer to use the ASIC for Raw Pi camera to h.264 compression to create a RTSP/HLS/RTMP stream.
I need to continuosly record the livestream to a file on the Pi without any duplicate & missing frames or transcoding - eg using -vcodec copy.
As the Pi is battery powered, it can be unsafely shut down randomly when the battery is out of energy.
I know that if a mp4 container isn't 'finalised' with the moov atom before the file finishes writing which would leave the file corrupted/unrepairable and unplayable.
So if I have an mp4 recording of 6 hours that is corrupted and unfixable that is a problem.
My idea was to split the recording to a new file after x amount of minutes or frames or bytes as losing the last few minutes is not so bad as to lose hours of recordings.
I would need to set the last frame in the old file as the previous frame to the next I frame (starting frame) in the new file as a h.264 stream can only start on an I frame.


So it would go like this.
file 1
| Frame |0001|I|
| --- | --- | --- |
|Frame|0002|P|
|Frame|0003|B|
...
| Frame |1524|B|
| --- | --- | --- |
| Frame |1525|P|


file 2
| Frame |1526|I|
| --- | --- | --- |
| Frame |1527|B|


Then all of the split files can be appended to each other without transcoding in ffmpeg.
I don't need to record the live stream directly to an mp4, whatever container it is in can be converted to an mp4 when appending the split files.


There is a python script of the Raspberry pi that accomplishes all of this but it can not be used for a live stream multicast as the Pi camera can not be accessed by more than one process at a time.
Unless there is a way to live stream the latest frames in an mp4 file that is continiously being recorded to, I am stuck.


-
How to record depth stream from realsense L515
22 avril 2022, par BilalI have a depth camera (Intel Realsense L515) and I do like to record a video of the depth.


I have seen this answer which is using FFMPEG, but I didn't know how to replicate it in my case !


I'm using this code :


import cv2
import numpy as np
import pyrealsense2 as rs
import time

pipeline = rs.pipeline()
config = rs.config()

"""
# Depth Mode
"""
# Resolution
res = [(1024, 768), (640, 480), (320, 240)]
resolution = res[0]
print("RealSense Resolution:{}\n".format(resolution))

# # initialize video writer
fourcc = cv2.VideoWriter_fourcc('F','F','V','1')
fps = 30
video_filename = 'output.avi'
out = cv2.VideoWriter(video_filename, fourcc, fps, resolution, False)


config.enable_stream(rs.stream.depth, resolution[0], resolution[1], rs.format.z16, 30)
profile = config.resolve(pipeline)
# Start streaming
pipeline.start(config)

# Declare sensor object and set options
depth_sensor = profile.get_device().first_depth_sensor()
depth_sensor.set_option(rs.option.visual_preset, 5) # 5 is short range, 3 is low ambient light
depth_sensor.set_option(rs.option.receiver_gain, 8)
depth_sensor.set_option(rs.option.pre_processing_sharpening, 0.0)
depth_sensor.set_option(rs.option.post_processing_sharpening, 3.0)
depth_sensor.set_option(rs.option.laser_power, 100)
depth_sensor.set_option(rs.option.confidence_threshold, 2)
# Get the sensor once at the beginning. (Sensor index: 1)

# # Filters
threshold_filter = rs.threshold_filter(min_dist=1.2, max_dist=1.4)
temporal_filter = rs.temporal_filter(smooth_alpha=0.1, smooth_delta = 9.0,persistence_control=7)

try:
 # # Filters
 threshold_filter = rs.threshold_filter(min_dist=1.2, max_dist=1.4)
 temporal_filter = rs.temporal_filter(smooth_alpha=0.1, smooth_delta = 75.0,persistence_control=0)

 tic = time.time()

 while True:
 # Wait for depth frames:
 frames = pipeline.wait_for_frames()
 depth_frame = frames.get_depth_frame()
 if not depth_frame:
 continue

 #------------
 # # FILTERS |
 #------------

 depth_frame = threshold_filter.process(depth_frame)
 depth_frame = temporal_filter.process(depth_frame)

 # Convert images to numpy arrays
 depth_array = np.asanyarray(depth_frame.get_data())
 # depth_array = np.asanyarray(colorizer.colorize(depth_frame).get_data())

 out.write(depth_array)
 toc = time.time()
 if(round(toc - tic) > 30):
 break

finally:
 out.release()
 pipeline.stop()



And getting this error :




out.write(depth_array)
cv2.error : OpenCV(4.5.4) /tmp/pip-req-build-kneyjnox/opencv/modules/videoio/src/cap_ffmpeg.cpp:186 : error : (-215:Assertion failed) image.depth() == CV_8U in function 'write'




Can you please tell me how can I record the depth from my camera ? thanks in advance.


-
FFmpeg unable to save file on Android : Output file #0 does not contain any stream
16 mai 2022, par John M.I'm having difficulty when saving a RTSP stream into internal storage using
ffmpeg-kit -i rtsp://192.168.100.60:554/stream1 -c:v copy -c:a copy -t 5 /data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4
. The command is called usingFFmpegKit.executeAsync(command, ...)
. There're issues with thecircular_buffer_size
option, but I read that the warnings could be ignored. The command runs fine on desktop usingffmpeg
. Please find below the log.

Any advice would be appreciated.


ffmpeg started on 2022-05-16 at 15:27:54
Report written to "/data/user/0/com.arthenica.ffmpegkit.test/cache/ffreport.txt"
Log level: 48
Command line:
ffmpeg-kit -i rtsp://192.168.100.60:554/stream1 -c:v copy -c:a copy -t 5 /data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4
ffmpeg version v4.5-dev-3393-g30322ebe3c Copyright (c) 2000-2021 the FFmpeg developers
 built with Android (7155654, based on r399163b1) clang version 11.0.5 (https://android.googlesource.com/toolchain/llvm-project 87f1315dfbea7c137aa2e6d362dbb457e388158d)
 configuration: --cross-prefix=i686-linux-android- --sysroot=/files/android-sdk/ndk/22.1.7171670/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/storage/light/projects/ffmpeg-kit/prebuilt/android-x86-lts/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=i686 --cpu=i686 --target-os=android --disable-neon --disable-asm --disable-inline-asm --ar=i686-linux-android-ar --cc=i686-linux-android16-clang --cxx=i686-linux-android16-clang++ --ranlib=i686-linux-android-ranlib --strip=i686-linux-android-strip --nm=i686-linux-android-nm --extra-libs='-L/storage/light/projects/ffmpeg-kit/prebuilt/android-x86-lts/cpu-features/lib -lndk_compat' --disable-autodetect --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --disable-static --enable-shared --enable-pthreads --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --enable-small --disable-xmm-clobber-test --disable-debug --enable-lto --disable-neon-clobber-test --disable-programs --disable-postproc -- libavutil 57. 13.100 / 57. 13.100
 libavcodec 59. 15.102 / 59. 15.102
 libavformat 59. 10.100 / 59. 10.100
 libavdevice 59. 1.100 / 59. 1.100
 libavfilter 8. 21.100 / 8. 21.100
 libswscale 6. 1.102 / 6. 1.102
 libswresample 4. 0.100 / 4. 0.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'rtsp://192.168.100.60:554/stream1'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '5'.
Reading option '/data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://192.168.100.60:554/stream1.
Successfully parsed a group of options.
Opening an input file: rtsp://192.168.100.60:554/stream1.
[tcp @ 0xa21d3a80] No default whitelist set
[tcp @ 0xa21d3a80] Original list of addresses:
[tcp @ 0xa21d3a80] Address 192.168.100.60 port 554
[tcp @ 0xa21d3a80] Interleaved list of addresses:
[tcp @ 0xa21d3a80] Address 192.168.100.60 port 554
[tcp @ 0xa21d3a80] Starting connection attempt to 192.168.100.60 port 554
[tcp @ 0xa21d3a80] Successfully connected to 192.168.100.60 port 554
[rtsp @ 0xb25b5a00] SDP:
v=0
o=- 14665860 31787219 1 IN IP4 192.168.100.60
s=Session streamed by "MERCURY RTSP Server"
t=0 0
a=smart_encoder:virtualIFrame=1
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:4096
a=range:npt=0-
a=control:track1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=4D4020; sprop-parameter-sets=Z01AIJWgFAF34maIAAADAAgAAAMBlCA=,aO48gA==

Failed to parse interval end specification ''
[rtsp @ 0xb25b5a00] video codec set to: h264
[rtsp @ 0xb25b5a00] RTP Packetization Mode: 1
[rtsp @ 0xb25b5a00] RTP Profile IDC: 4d Profile IOP: 40 Level: 20
[rtsp @ 0xb25b5a00] Extradata set to 0xb25abdf0 (size: 35)
[rtp @ 0xb25abe60] No default whitelist set
[udp @ 0xb25abed0] No default whitelist set
[udp @ 0xb25abed0] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0xb25abed0] end receive buffer size reported is 524288
[udp @ 0xb25abf40] No default whitelist set
[udp @ 0xb25abf40] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0xb25abf40] end receive buffer size reported is 524288
[rtsp @ 0xb25b5a00] setting jitter buffer size to 500
[rtsp @ 0xb25b5a00] hello state=0
Failed to parse interval end specification ''
[h264 @ 0x907e5b00] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x907e5b00] nal_unit_type: 8(PPS), nal_ref_idc: 3
[h264 @ 0x907e5b00] nal_unit_type: 7(SPS), nal_ref_idc: 3
[h264 @ 0x907e5b00] nal_unit_type: 8(PPS), nal_ref_idc: 3
[rtsp @ 0xb25b5a00] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, rtsp, from 'rtsp://192.168.100.60:554/stream1':
 Metadata:
 title : Session streamed by "MERCURY RTSP Server"
 Duration: N/A, start: 0.000000, bitrate: N/A
 Stream #0:0, 0, 1/90000: Video: h264, none, 90k tbr, 90k tbn
Successfully opened the file.
Parsing a group of options: output url /data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 5.
Successfully parsed a group of options.
Opening an output file: /data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4.
Output #0, mp4, to '/data/user/0/com.arthenica.ffmpegkit.test/files/test.mp4':
Output file #0 does not contain any stream