
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 (30)
-
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 -
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.
Sur d’autres sites (6916)
-
ffmpeg not converting entire video in java application
12 décembre 2017, par Urvashi SoniMy code converts a video into different formats (160p to 2160p). The codec of video with rotate tag 90 needs to be changed. below id the code for the same which works fine for all videos till date.
log_wfm.debug("Changing the codec video for file [" + orgFileName + "] and name of source file ["
+ srcFileName + "]");
String codecFlipCommand = "ffmpeg -i " + orgFileName + " -c:v libx264 -preset ultrafast " + srcFileName;
log_wfm.info("Executing command to change the codec of video!");
fp = Runtime.getRuntime().exec(codecFlipCommand);
inputStream = new BufferedReader(new InputStreamReader(fp.getInputStream()));
outputStream = new BufferedReader(new InputStreamReader(fp.getErrorStream()));
StringBuffer output = new StringBuffer();
String line;
while ((line = inputStream.readLine()) != null) {
output.append(line).append('\n');
}
log_wfm.debug("stdInputForCodecChange: " + output);
output = new StringBuffer();
while ((line = outputStream.readLine()) != null) {
output.append(line).append('\n');
}
log_wfm.debug("stdErrorForCodecChange: " + output);now have a file of size 1.5Gb. The video does not create the file with changed codec. The file till size 848.5 MB is created and then the program hangs (with no exception or error logs)
Please suggest some way to finish this codec change process.
The ffmpeg command converts the video, but via java application, the process hangs
Logs While converting via commandLine :ffmpeg version N-83433-ge87a4a8 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.3.1 (GCC) 20161221 (Red Hat 6.3.1-1)
configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags='-L/root/ffmpeg_build/lib -ldl' --bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
libavutil 55. 46.100 / 55. 46.100
libavcodec 57. 75.100 / 57. 75.100
libavformat 57. 66.101 / 57. 66.101
libavdevice 57. 2.100 / 57. 2.100
libavfilter 6. 73.100 / 6. 73.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/urvashi/test/SachinSagaGameLaunchEvent.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-12-07T06:26:23.000000Z
com.android.version: 7.1.1
Duration: 00:14:16.02, start: 0.000000, bitrate: 14231 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 13971 kb/s, SAR 1:1 DAR 16:9, 29.94 fps, 29.92 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2017-12-07T06:26:23.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2017-12-07T06:26:23.000000Z
handler_name : SoundHandle
[libx264 @ 0x4601a20] using SAR=1/1
[libx264 @ 0x4601a20] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x4601a20] profile Constrained Baseline, level 4.0
[libx264 @ 0x4601a20] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to '/home/urvashi/test/Manual_SachinSagaGameLaunchEvent.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
com.android.version: 7.1.1
encoder : Lavf57.66.101
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1080x1920 [SAR 1:1 DAR 9:16], q=-1--1, 29.92 fps, 11488 tbn, 29.92 tbc (default)
Metadata:
handler_name : VideoHandle
creation_time : 2017-12-07T06:26:23.000000Z
encoder : Lavc57.75.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2017-12-07T06:26:23.000000Z
handler_name : SoundHandle
encoder : Lavc57.75.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help Past duration 0.600212 too large 48193kB time=00:00:27.26 bitrate=14479.2kbits/s speed=2.07x
Past duration 0.998863 too large
frame=25611 fps= 55 q=-1.0 Lsize= 1721466kB time=00:14:16.04 bitrate=16473.7kbits/s dup=0 drop=17 speed=1.85x
video:1707295kB audio:13453kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.041757%
[libx264 @ 0x4601a20] frame I:103 Avg QP:22.16 size:242916
[libx264 @ 0x4601a20] frame P:25508 Avg QP:25.17 size: 67557Thanks in Advance.
-
How to stop FFMPEG without stop application in Golang ?
23 juillet 2022, par TammamI'm making a WEB-based screen record application (if the link is accessed then the record will run) using FFMPEG, but I still haven't found a way to stop the record without stopping the web application (Now still pressing Ctrl+C to stop the recording process and the application will stop too). How do I do that when I click a link (eg host/record/stop) the record will stop without stopping the application


here my code


//Handler to create room/start record
func RoomCreate(c *fiber.Ctx) error {
 fileName := "out.mp4"
 fmt.Println(fileName)
 if len(os.Args) > 1 {
 fileName = os.Args[1]
 }

 

 errCh := make(chan error, 2)
 ctx, cancelFn := context.WithCancel(context.Background())
 // Record
 go func() { errCh <- recordToVideo(ctx, fileName) }()

 go func() {
 errCh <- nil
 }()
 err := <-errCh
 cancelFn()
 if err != nil && err != context.Canceled {
 log.Fatalf("Execution failed: %v", err)
 }
 
 return c.Redirect(fmt.Sprintf("/room/%s", guuid.New().String()))
}

func recordToVideo(ctx context.Context, fileName string) error {
 ctx, cancelFn := context.WithCancel(ctx)
 defer cancelFn()
 // Build ffmpeg
 ffmpeg := exec.Command("ffmpeg",
 "-f", "gdigrab",
 "-framerate", "30",
 "-i", "desktop",
 fileName,
 )
 // Stdin for sending data
 stdin, err := ffmpeg.StdinPipe()
 if err != nil {
 return err
 }
 //var buf bytes.Buffer
 defer stdin.Close()
 // Run it in the background
 errCh := make(chan error, 1)

 go func() {
 fmt.Printf("Executing: %v\n", strings.Join(ffmpeg.Args, " "))
 //Here if
 out, err := ffmpeg.CombinedOutput()
 fmt.Printf("FFMPEG output:\n%v\n", string(out))
 errCh <- err
 }()
 // Just start sending a bunch of frames
 for {
 // Check if we're done, otherwise go again
 select {
 case <-ctx.Done():
 return ctx.Err()
 case err := <-errCh:
 return err
 default:
 }
 }
}

//Function to run command FFMPEG
func recordToVideo(ctx context.Context, fileName string) error {
 ctx, cancelFn := context.WithCancel(ctx)
 defer cancelFn()
 // Build ffmpeg
 ffmpeg := exec.Command("ffmpeg",
 "-f", "gdigrab",
 "-framerate", "30",
 "-i", "desktop",
 "-f", "mp4",
 fileName,
 )
 // Stdin for sending data
 stdin, err := ffmpeg.StdinPipe()
 if err != nil {
 return err
 }
 //var buf bytes.Buffer
 defer stdin.Close()
 // Run it in the background
 errCh := make(chan error, 1)

 go func() {
 fmt.Printf("Executing: %v\n", strings.Join(ffmpeg.Args, " "))
 
 if err := ffmpeg.Run(); err != nil {
 return
 }
 //fmt.Printf("FFMPEG output:\n%v\n", string(out))
 errCh <- err
 }()
 // Just start sending a bunch of frames
 for {
 
 // Check if we're done, otherwise go again
 select {
 case <-ctx.Done():
 return ctx.Err()
 case err := <-errCh:
 return err
 default:
 }
 }
}



Thanks for advance


-
Opencv VideoCapture not streaming RTSP link and returns "no frame !"
6 septembre 2023, par Asadullah NaeemI am trying to stream my HikVision IP camera throough python. I am using
cv2.VideoCapture("rtsp_link")
which works fine on my Laptop but when I try to run the same python script with same Opencv and FFmpeg version it gives me following error :

Error :


[h264 @ 000002124c7f9a40] missing picture in access unit with size 47
[h264 @ 000002124c7f9a40] no frame!



I have so far tried to run this script on 5 computer devices but it gives the same error. I am using the following python script and my Opencv version is
4.6.0.66
and ffmpeg version2022-06-20-git-56419428a8-essentials_build-www.gyan.dev
:

Python Script :


import cv2

# RTSP stream URL
rtsp_url = "rtsp://username:password@ip_address:port/Streaming/Channels/501"

# Open the RTSP stream
cap = cv2.VideoCapture(rtsp_url)

# Check if the stream was successfully opened
if not cap.isOpened():
 print("Failed to open RTSP stream.")
 exit()

# Read and display frames from the stream
while True:
 # Read a frame from the stream
 ret, frame = cap.read()

 # Check if the frame was successfully read
 if not ret:
 print("Failed to read frame from RTSP stream.")
 break

 # Display the frame
 cv2.imshow("RTSP Stream", frame)

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

# Release the resources
cap.release()
cv2.destroyAllWindows()




Update :


Code runs on a laptop on both wifi and mobile internet (4G) but on other devices rtsp link is accessible only with mobile internet (4G).