Recherche avancée

Médias (91)

Autres articles (86)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La 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 (...)

  • Encoding and processing into web-friendly formats

    13 avril 2011, par

    MediaSPIP automatically converts uploaded files to internet-compatible formats.
    Video files are encoded in MP4, Ogv and WebM (supported by HTML5) and MP4 (supported by Flash).
    Audio files are encoded in MP3 and Ogg (supported by HTML5) and MP3 (supported by Flash).
    Where possible, text is analyzed in order to retrieve the data needed for search engine detection, and then exported as a series of image files.
    All uploaded files are stored online in their original format, so you can (...)

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

Sur d’autres sites (12147)

  • OpenCV : issues with playing videos created using ffmpeg and concat

    25 mars 2022, par tobiasBora

    I concatenated a few videos using :

    


    $ ffmpeg -f concat -safe 0 -i list_files.txt -c copy total.mp4


    


    where list_files.txt is like :

    


    file 'file1.mp4'
file 'file2.mp4'


    


    Unfortunately, if I play it with opencv :

    


    import cv2
import numpy as np

# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file name
cap = cv2.VideoCapture('../Video_outputs/010_introduction.mp4')

# Check if camera opened successfully
if (cap.isOpened()== False): 
  print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened()):
  # Capture frame-by-frame
  ret, frame = cap.read()
  if ret == True:

    # Display the resulting frame
    cv2.imshow('Frame',frame)

    # Press Q on keyboard to  exit
    if cv2.waitKey(24) & 0xFF == ord('q'):
      break

  # Break the loop
  else: 
    break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


    


    the first video plays fine, but the next concatenated videos are ugly looking :

    


    enter image description here

    


    Am I missing something, or is it a bug to report upstream ?

    


    PS : I'm using this code :

    


    import cv2
import numpy as np

# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file name
cap = cv2.VideoCapture('../Video_outputs/010_introduction.mp4')

# Check if camera opened successfully
if (cap.isOpened()== False): 
  print("Error opening video stream or file")

# Read until video is completed
while(cap.isOpened()):
  # Capture frame-by-frame
  ret, frame = cap.read()
  if ret == True:

    # Display the resulting frame
    cv2.imshow('Frame',frame)

    # Press Q on keyboard to  exit
    if cv2.waitKey(24) & 0xFF == ord('q'):
      break

  # Break the loop
  else: 
    break

# When everything done, release the video capture object
cap.release()

# Closes all the frames
cv2.destroyAllWindows()


    


  • Why am I having issues re-encoding rtsp stream to rtmp via FFMPEG-python ? [closed]

    27 août 2023, par Luke Lopez

    I can see that the python script is not throwing errors however I cant stream the video via VLC player.

    


    
  Metadata:
    title           : Media Server
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, progressive), 640x360, q=2-31, 1 kb/s, 25 fps, 1k tbn
    Metadata:
      encoder         : Lavc60.3.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000 buffer size: 0 vbv_delay: N/A
frame= 1927 fps= 25 q=69.0 size=      92kB time=00:01:17.00 bitrate=   9.7kbits/s dup=13 drop=1 speed=0.98x     



import subprocess

# Input RTSP stream URL
input_stream_url = "rtsp://myStream"

# Wowza RTMP or RTSP URL (replace with your Wowza server's details)
wowza_url = "rtmp://myWowzaServer"

# Resolution 
desired_width = 640
desired_height = 360

# Video bitrate and frame rate settings
video_bitrate = "1240"  # 1240 Kbps
fps = 25

# Start FFmpeg process to pull and push the stream with specified settings
ffmpeg_command = [
    'ffmpeg',
    '-rtsp_transport', 'tcp',  # Use TCP for RTSP transport (optional)
    '-i', input_stream_url,    # Input RTSP stream URL
    '-s', f'{desired_width}x{desired_height}',  # Desired resolution
    '-c:v', 'libx264',        # Video codec: H.264
    '-b:v', video_bitrate,    # Video bitrate
    '-r', str(fps),            # Frame rate
    '-c:a', 'aac',            # Audio codec: AAC
    '-f', 'flv',              # Output format (FLV for RTMP, rtsp for RTSP)
    wowza_url                 # Wowza RTMP or RTSP URL
]

# Start FFmpeg as a subprocess
ffmpeg_process = subprocess.Popen(ffmpeg_command)

# Stop Condition
print("Press Enter to stop...")
input()

# Terminate FFmpeg when done
ffmpeg_process.terminate()



    


    So far I have tried implementing best encoding practices as recommended by Wowza, have been messing with the frame rate, bitrate etc... but with no luck. Hopefully someone experienced with using FFMpeg can give suggestions / solutions ??

    


    Thanks !

    


  • C++ h264 ffmpeg/libav encode/decode(lossless) issues

    1er février 2017, par MrSmith

    Insights to encode/decode video with ffmpeg h264 (lossless)

    So I got something working on the encoding part, encode an avi in 264 however VLC wont play it, however Totem will.
    Decoding the same file proves troublesome. (I want the exact same data/frame going in as going out), I get these ;

    saving frame   5
    Video decoding
    [h264 @ 0x1d19880] decode_slice_header error
    frame :6
    saving frame   6
    Video decoding
    [h264 @ 0x1d19880] error while decoding MB 15 7, bytestream -27
    [h264 @ 0x1d19880] concealing 194 DC, 194 AC, 194 MV errors in I frame
    frame :7
    saving frame   7
    Video decoding
    [h264 @ 0x1d19880] decode_slice_header error

    and ultimatly this

    [H264 Decoder @ 0x7f1320766040] frame :11
    Broken frame packetizing
    [h264 @ 0x1d19880] SPS changed in the middle of the frame
    [h264 @ 0x1d19880] decode_slice_header error
    [h264 @ 0x1d19880] no frame!
    Error while decoding frame 11

    GAME OVER.

    Now I suspect that I have to go back to 1. the encoding part, there is problary a good reason VLC wont play it !

    I encode like this.

    void encode(char *Y,char *U,char *V){
    av_init_packet(&pkt);
    pkt.data = NULL;    // packet data will be allocated by the encoder
    pkt.size = 0;
    fflush(stdout);

    frame->data[0] = (uint8_t*)Y;
    frame->data[1] = (uint8_t*)U;
    frame->data[2] = (uint8_t*)V;
    frame->pts = ++i;

    ret = avcodec_encode_video2(c, &pkt, frame, &got_output);
    if (ret < 0) {
       fprintf(stderr, "Error encoding frame\n");
       exit (EXIT_FAILURE);
    }
    if (got_output) {
       printf("Write frame %3d (size=%5d)\n", i, pkt.size);
       fwrite(pkt.data, 1, pkt.size, f);
       av_free_packet(&pkt);
    }
    }

    And the codec is setup like this :

    AVCodecID dasd = AV_CODEC_ID_H264;
    codec = avcodec_find_encoder(dasd);
    c = avcodec_alloc_context3(codec);
    c->bit_rate = 400000;
    c->width = 320;
    c->height = 240;
    c->time_base= (AVRational){1,25};
    c->gop_size = 10;
    c->max_b_frames=1;
    c->pix_fmt = AV_PIX_FMT_YUV420P;
    av_opt_set(c->priv_data, "preset", "slow", 0);
    avcodec_open2(c, codec, NULL);

    Since I am going for lossless i am not dealing with delayed frames(is this a correct assumption ?)
    I may not actually be encoding lossless, it seems like I may have to go with something like

    AVDictionary *param;
    av_dict_set(&param, "qp", "0", 0);

    And then open...

    So I guess me questions is these :

    • What are the correct codec params for lossless encoding (and advice if h264 is a terrible idea in this regard).
    • Do I need to handle delayed frames when going for lossless ?
    • Why is VLC mad at me ?

    Thanks.