
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 (99)
-
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Creating farms of unique websites
13 avril 2011, parMediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)
Sur d’autres sites (8749)
-
FFMPEG : Youtube streaming quality and speed issues
25 février 2020, par Alex ParamonovI am trying to make a reliable stream from my Icecast/Shoutcast servers to Youtube live. The command that I use is :
ffmpeg -v verbose -framerate 30 -loop 1 -i /var/image.jpg -re -i http://127.0.0.1:4700/radio -c:v libx264 -preset ultrafast -b:v 2250k -maxrate 6000k -bufsize 6000k -c:a copy -ab 128k -s 1920x1080 -framerate 30 -g 60 -keyint_min 60 -f flv rtmp://a.rtmp.youtube.com/live2/xxx
As you can see I am using recommended bitrate for Youtube, insert keyframes every 2 seconds and streaming at 30 frames per second.
The stream is working but after running for some time two thing are happening :- FFMPEG
speed
falls from 1x to something like0.998x
- Youtube starts complaining that video stream speed is slow, markes the quality as bad and sometimes video starts buffering.
Why is this happening ? CPU load is normal, connectivity is ok (the stream is running on a 1Gg/s dedicated server).
Since in my example above I am streaming a single image as a logo of the stream I also tried to generate a short 30 seconds video with that image and broadcast that video instead of an image, but that did not help as well.
The command I used for conversion :
ffmpeg -framerate 30 -loop 1 -i /var/image.jpg -c:v libx264 -preset ultrafast -tune stillimage -b:v 2250k -minrate 2250k -maxrate 6000k -bufsize 6000k -framerate 30 -g 60 -keyint_min 60 -t 30 out4.mp4
And broadcast with
ffmpeg -stream_loop -1 -i out4.mp4 -re -i http://127.0.0.1:4700/radio -c:v copy -c:a copy -framerate 30 -g 60 -keyint_min 60 -f flv rtmp://a.rtmp.youtube.com/live2/xxx
ffmpeg version is
4.1.1
- FFMPEG
-
Using FFmpeg change the video speed of different parts in python, I uses opencv and subprocess, but it's slow, is there another quicker way ?
27 septembre 2020, par Jackal ZhaoThere is a video file, need to process like that : [0, 13, 2] means the 0th to 13th frames need 2x speed, according to the list below, change the speed of different video parts, and write the result to an output file using H264 compression.


[0, 13, 2]
[13, 20, 1]
[20, 25, 2]
[25, 135, 1]
[135, 164, 2]
[164, 250, 1]
[250, 254, 2]
[254, 309, 1]
[309, 354, 2]
[354, 438, 1]
[438, 465, 2]
[465, 540, 1]
[540, 625, 2]



Hopefully I wish the whole process could be done by FFmpeg and python(the only language I know).


Now I implementd this way :


Fitsr using
subprocess.Popen(cmd, stdin=subprocess.PIPI)
to create a FFmpeg thread, receiving input data form stdin, the using opencv to read the frames, and if the frame number suits, then write the frame data to subprocess PIPE.

Here is the code :


inputCapture = cv2.VideoCapture(inputFile) # get the input Capture
inputFrameCount = int(inputCapture.get(cv2.CAP_PROP_FRAME_COUNT))
inputHeight = int(inputCapture.get(cv2.CAP_PROP_FRAME_HEIGHT))
inputWidth = int(inputCapture.get(cv2.CAP_PROP_FRAME_WIDTH))
inputFrameRate = int(inputCapture.get(cv2.CAP_PROP_FPS))
ffmpeg_command = 'ffmpeg -y -vsync 0 -f rawvideo -pix_fmt bgr24 -s %sx%s -i - -an -r %s -vf "setpts=N/(%s*TB)" %s "%s/FinalVideo.mp4"' % (inputWidth, inputHeight, inputFrameRate, inputFrameRate, ffmpegOutputOption, tempFolderPath)
FNULL = open(os.devnull, 'w')
process = subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE, stdout=FNULL, stderr=FNULL) # Open a ffmpeg thread
inputFrameNumber = 0
inputEquivalentNumber = 0
outputEquivalentNumber = 0
startTime = time.time()
for chunk in chunks: # get the [0, 13, 2] from the chunks list
 while inputFrameNumber < chunk[1]:
 successGettingFrame, inputFrameData = inputCapture.read() # read one frame from inputCapture
 inputFrameNumber += 1
 inputEquivalentNumber += (1 / chunk[2])
 print(successGettingFrame)
 if not successGettingFrame:
 break
 while inputEquivalentNumber > outputEquivalentNumber: # check if the frame should be writen to ffmpeg-input
 process.stdin.write(inputFrameData) # write the frame data to ffmpeg stdin
 outputEquivalentNumber += 1
inputCapture.release()
cv2.destroyAllWindows()
process.stdin.close()
process.wait()




But for each frame, it need to read the frame data using opencv, the write the data to ffmpeg stdin using subprocess, so the speed is really slow, it's about 0.5x speed comparing to ffmpeg libx264 compression.


So I wish there could be a faster way to alter the speed of the specified parts in video.


Could you guys provide some help ?


-
FFMPEG Implement RTSP Client, high speed playback
11 juillet 2021, par TTGroupI am writing software to play videos that have been recorded from NVR. I have completed most of the work, but there is one more feature that allows the user to change the play speed such as 0.5x, 2x, 4x, 8x ...


I searched the internet all day and still couldn't find any suggestions. Here is my summary code below.


auto pFormatCtx = avformat_alloc_context();

av_dict_set_int(&opts, "rw_timeout", 5000000, 0);
av_dict_set_int(&opts, "tcp_nodelay", 1, 0);
av_dict_set_int(&opts, "stimeout", 10000000, 0);
av_dict_set(&opts, "user_agent", "Mozilla/5.0", 0);
av_dict_set(&opts, "rtsp_transport", "tcp", 0);
av_dict_set(&opts, "rtsp_flags", "prefer_tcp", 0);
av_dict_set_int(&opts, "buffer_size", BUFSIZE, 0);

int err = avformat_open_input(&pFormatCtx, fullRtspUri, NULL, &opts);
if(err < 0)
 return;
 
err = avformat_find_stream_info(pFormatCtx, NULL);
if (err < 0)
 return;
pFormatCtx->flags |= AVFMT_FLAG_NONBLOCK;
pFormatCtx->flags |= AVFMT_FLAG_DISCARD_CORRUPT;
pFormatCtx->flags |= AVFMT_FLAG_NOBUFFER; 
av_dump_format(pFormatCtx, 0, fullRtspUri, 0);
 
int videoStreamInd = -1;
for (int i = 0; i < pFormatCtx->nb_streams; i++)
{
 AVStream* stream = pFormatCtx->streams[i];
 if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
 {
 if (videoStreamInd == -1)
 {
 videoStreamInd = i;
 break;
 }
 } 
}

if (videoStreamInd == -1)
 return; 
auto videoStream = pFormatCtx->streams[videoStreamInd];

isRunning = true;
while(isRunning)
{
 ret = av_read_frame(pFormatCtx, avPacket);
 if (ret < 0)
 return; 

 if (avPacket->stream_index != videoStreamInd)
 continue;
 
 //Code for render process here............
}



I have read through this NVR API documentation and see support for 2x, 4x speed play as below


Play in 2× Speed:
PLAY rtsp://10.17.133.46:554/ISAPI/streaming/tracks/101?starttime=20170313T230652Z&endtime=20170314T025706Z RTSP/1.0
CSeq:6
Authorization: Digest username="admin", 
realm="4419b66d2485", 
nonce="a0ecd9b1586ff9461f02f910035d0486", 
uri="rtsp://10.17.133.46:554/ISAPI/streaming/tracks/101?starttime=20170313T230652Z&endtime=20170314T025706Z", 
response="fb986d385a7d839052ec4f0b2b70c631"
Session:2049381566;timeout=60
Scale:2.000
User-Agent:NKPlayer-1.00.00.081112

RTSP/1.0 200 OK
CSeq: 6
Session: 2049381566
Scale: 2.000
RTP-Info: url=trackID=1;seq=1,url=trackID=2;seq=1
Date: Tue, Mar 14 2017 10:57:24 GMT



How to play RTSP video with speeds of 0.5x, 2x, 4x ...?
Everyone who can assist me in this case, I am very grateful.