
Recherche avancée
Médias (3)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Podcasting Legal guide
16 mai 2011, par
Mis à jour : Mai 2011
Langue : English
Type : Texte
-
Creativecommons informational flyer
16 mai 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (70)
-
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 -
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (9442)
-
How to combine many m3u8 hls playlists into one using python
16 juillet 2024, par Дмитрий КравчукI have several videos of mp4 formats. I created HLS (playlists and segments) from them using this code


import ffmpeg

input_file_path = "D:/Projects/test2.mp4"
output_playlist = "'D:/Projects/playlist.m3u8"
segment_time = 5
file_name = "test"

ffmpeg.input(input_file_path).output(
 output_playlist,
 format='hls',
 hls_time=segment_time, 
 hls_list_size=0, 
 hls_playlist_type='vod',
 hls_segment_type='mpegts',
 hls_segment_filename=f'D:/Projects/{file_name}_%03d.ts', 
 force_key_frames=f'expr:gte(t,n_forced*{segment_time})'
).run()



Then I put segments to s3 storage and save m3u8 playlist structure for each video in database.


Now I need on some request combine some video that appropriate user's criteria as one full video and return it. I suppose that I could just combine one common playlist using the videos playlists but it failed. I used this code for this


from m3u8 import loads, 

video_one_m3u8 = """
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:10.166667,
test1_000.ts
#EXTINF:6.166667,
test1_001.ts
#EXTINF:6.433333,
test1_002.ts
#EXT-X-ENDLIST
"""

video_two_m3u8 = """
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:8
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:8.000000,
test2_000.ts
#EXTINF:8.333333,
test2_001.ts
#EXTINF:5.533333,
test2_002.ts
#EXT-X-ENDLIST
"""

playlist1 = loads(video_one_m3u8)
playlist2 = loads(video_two_m3u8)

combinedPlaylist = M3U8()
combinedPlaylist.segments.extend(playlist2.segments)
combinedPlaylist.segments.extend(playlist1.segments)

combinedPlaylist.version = playlist1.version
combinedPlaylist.target_duration = max(playlist1.target_duration, playlist2.target_duration)
combinedPlaylist.is_endlist = True

with open(r"D:\Projects\playlist_test.m3u8", "w") as f:
 f.writelines(combinedPlaylist.dumps())



The result of combined m3u8 playlist is below


#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:10.166667,
test1_000.ts
#EXTINF:6.166667,
test1_001.ts
#EXTINF:6.433333,
test1_002.ts
#EXTINF:8.000000,
test2_000.ts
#EXTINF:8.333333,
test2_001.ts
#EXTINF:5.533333,
test2_002.ts
#EXT-X-ENDLIST



When launch this playlist in VLS it works until the edge of another video then it crashes. The VLS log shows this errors


main error: Timestamp conversion failed for 5433334: no reference clock
main error: Could not convert timestamp 0 for FFmpeg
ts error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 5) for PID 17
ts error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 5) for PID 0
ts error: libdvbpsi error (PSI decoder): TS discontinuity (received 0, expected 5) for PID 4096
direct3d11 error: SetThumbNailClip failed: 0x800706f4



I trying to solve this problem of timestamps while preparing initial video playlists using ffmpeg.output argumets (start_at_zero=True and reset_timestamps) but it doesn't help.

Also I was trying to add tag EXT-X-DISCONTINUITY, it works but the video plays as separate (each starts from the beggining) not as common.

-
Why is the last frame not showing in an MP4 generated by libav ?
31 octobre 2023, par BenNote : I have a working example of the problem here.


I'm using the libav/ffmpeg API to generate an MP4 with the h264 codec. In my specific situation I'm generating the files with a max number of 2 "B" frames. I'm able to generate an Mp4 with the right number of frames so that a single, lone "B" frame is the very last frame being written. When this happens, the encoder sets that frame's packet to be discarded (I've verified this with ffprobe). The net result is that some players (say, when dropping the MP4 into Edge or Chrome) will display only n-1 total frames (ignoring the discarded packet). Other players, such as VLC, will play the full n frames (not ignoring the discarded packet). So, the result is inconsistent.


ffmpeg.exe itself doesn't appear to have this problem. Instead, it will set what would be the lone "B" frame to a "P" frame. This means the file will play the same regardless of what player is used.


The problem is : I don't know how to mimic ffmpeg's behavior using the SDK so the last frame will play regardless of the player. As far as I can tell I'm closing out the file properly by flushing out the encoder buffers. I must be doing something wrong somewhere.


I provided a link to the full source above, but at a high level I'm initializing the codec context and stream like this :


newStream->codecpar->codec_id = AV_CODEC_ID_H264;
newStream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
newStream->codecpar->width = Width;
newStream->codecpar->height = Height;
newStream->codecpar->format = AV_PIX_FMT_YUV420P;
newStream->time_base = { 1, 75 };
avcodec_parameters_to_context(codecContext, newStream->codecpar);


codecContext->time_base = { 1, 75 };
codecContext->gop_size = 30;



I then sit in a loop and use OpenCV to generate frames (each frame has its frame number drawn on it) :


auto matrix = cv::Mat(Height, Width, CV_8UC3, cv::Scalar(0, 0, 0));

std::stringstream ss;
ss << f; 

cv::putText(matrix, ss.str().c_str(), textOrg, fontFace, fontScale, cv::Scalar(255, 255, 255), thickness, 8);



I then write out the frame like this (looping if more data is needed) :


if ((ret = avcodec_send_frame(codecContext, frame)) == 0) {

 ret = avcodec_receive_packet(codecContext, &pkt); 

 if (ret == AVERROR(EAGAIN))
 {
 continue; 
 }
 else
 {
 av_interleaved_write_frame(pFormat, &pkt);
 }
 av_packet_unref(&pkt);
}



And finally I flush out the file at the end like this :


if ((ret = avcodec_send_frame(codecContext, NULL)) == 0)
{
 for (;;)
 {
 if ((ret = avcodec_receive_packet(codecContext, &pkt)) == AVERROR_EOF)
 {
 break;
 }
 else
 {
 ret = av_interleaved_write_frame(pFormat, &pkt);
 av_packet_unref(&pkt);
 }
 }

 av_write_trailer(pFormat);
 avio_close(pFormat->pb);
}



Yet when I play in Chrome, the player ends on frame 6758,




And in VLC, the player ends on frame 6759.




What am I doing wrong ?


-
VLC RTSP HTML5 transcoding
30 mai 2022, par PierogiI'm trying to get audio streaming on an HTML page from an RTSP server.


The RTSP server is the rtsp-simple-server running a command line below.

./rtsp-simple-server rtsp-simple-server.yml
.

The configure file is the default.

The stream player is FFmpeg running a command line below.

ffmpeg -re -stream_loop -1 -i myaudio.mp3 -c copy -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream


The console log at the time the rtsp-simple-server and the ffmpeg are started is below.


2022/05/29 19:06:38 INF rtsp-simple-server v0.18.4
2022/05/29 19:06:38 INF [RTSP] listener opened on :8554 (TCP), :8000 (UDP/RTP), :8001 (UDP/RTCP)
2022/05/29 19:06:38 INF [RTMP] listener opened on :1935
2022/05/29 19:06:38 INF [HLS] listener opened on :8888
2022/05/29 19:09:16 INF [RTSP] [conn [::1]:62737] opened
2022/05/29 19:09:16 INF [RTSP] [session 271690815] created by [::1]:62737
2022/05/29 19:09:16 INF [RTSP] [session 271690815] is publishing to path 'mystream', 1 track with TCP



And the time the rtsp path(rtsp ://localhost:8554/mystream) is opened by VLC, the contents can be played properly. The additional console log at the time is below.


2022/05/29 19:13:19 INF [RTSP] [conn 127.0.0.1:62780] opened
2022/05/29 19:13:19 INF [RTSP] [session 734209460] created by 127.0.0.1:62780
2022/05/29 19:13:19 INF [RTSP] [session 734209460] is reading from path 'mystream', 1 track with UDP
2022/05/29 19:13:29 INF [RTSP] [session 734209460] destroyed (teared down by 127.0.0.1:62780)
2022/05/29 19:13:29 INF [RTSP] [conn 127.0.0.1:62780] closed (EOF)
2022/05/29 19:13:29 INF [RTSP] [conn 127.0.0.1:62781] opened
2022/05/29 19:13:29 INF [RTSP] [session 445756113] created by 127.0.0.1:62781
2022/05/29 19:13:29 INF [RTSP] [session 445756113] is reading from path 'mystream', 1 track with TCP



However, I open the rtsp streaming from the VLC's "Network" tab like below,



and configure the "Stream output" like below,



and I tried to get this streaming from an HTML page like below,




 
 
 
 
 
 <h1>transcode test</h1>
 <audio src="http://localhost:9999/mystream" autoplay="autoplay"></audio>
 




the browser console displays
Failed to load resource: the server responded with a status of 404 (Not found)
. I've already tried other ports(etc. 8080).

So, how can I get the rtsp stream from the RTSP server on an HTML page.
Any idea ?


My environment.


- 

- Browser : Microsoft edge
- OS : MacOS 11.6.5
- rtsp-simple-server : 0.18.4
- FFmpeg : 5.0.1
- VLC : 3.0.17.3