
Recherche avancée
Autres articles (69)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa 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 (...) -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs
Sur d’autres sites (10561)
-
How to adjust mpeg 2 ts start time with ffmpeg ?
29 juin 2015, par Maxim KornienkoI’m writing simple HLS (Http Live Streaming) java server to live cast (really live, not on demand) screenshow + voice. I constantly get chunks of image frames and audio samples as input to my service and produce mpeg 2 ts files + m3u8 playlist web page as output. The workflow is the following :
- Collect (buffer) source video frames and audio for certain period of time
- Convert series of video frames to h.264 encoded video file
- Convert audio samples to mp3 audio file
-
Merge them to
.ts
file with ffmpeg commandffmpeg -i audio.mp3 -i video.mp4 -f mpegts -c:a copy -c:v copy -vprofile main -level:v 4.0 -vbsf h264_mp4toannexb -flags -global_header segment.ts
-
Publish several
.ts
files on m3u8 playlist.
The problem is resulting playlist interrupts after first segment is played. VLC logs following error :
freetype error: Breaking unbreakable line
ts error: libdvbpsi (PSI decoder): TS discontinuity (received 0, expected 4) for PID 17
ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4096
core error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 1000 ms)
core error: ES_OUT_RESET_PCR called
core error: Could not convert timestamp 185529572000
ts error: libdvbpsi (PSI decoder): TS discontinuity (received 0, expected 4) for PID 17
ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 0
ts error: libdvbpsi (PSI decoder): TS duplicate (received 0, expected 1) for PID 4096
core error: ES_OUT_SET_(GROUP_)PCR is called too late (jitter of 8653 ms ignored)
core error: Could not get display date for timestamp 0
core error: Could not convert timestamp 185538017000
core error: Could not convert timestamp 185538267000
core error: Could not convert timestamp 185539295977
...I guess the reason is that start time of segments do not belong to one stream, but it’s impossible to concat and resegment (with
ffmepg -f segment
) whole stream once new chunk is added. Tried adding#EXT-X-DISCONTINUITY
tag to playlist as suggested here but it didn’t help. When Iffprobe
them I get :Input #0, mpegts, from '26.ts':
Duration: 00:00:10.02, start: 1.876978, bitrate: 105 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x640, 4 fps, 4 tbr, 90k tbn, 8 tbc
Stream #0:1[0x101]: Audio: mp3 ([3][0][0][0] / 0x0003), 48000 Hz, mono, s16p, 64 kb/sWhere start value in line
Duration: 00:00:10.02, start: 1.876978, bitrate: 105 kb/s
is more or less equal for all segments.
When I check segments from available proven-to-work playlists (like http://vevoplaylist-live.hls.adaptive.level3.net/vevo/ch1/appleman.m3u8) they all have diffrenet start values for each segment, for example :Input #0, mpegts, from 'segm150518140104572-424570.ts':
Duration: 00:00:06.17, start: 65884.808689, bitrate: 479 kb/s
Program 257
Stream #0:0[0x20]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 30 fps, 29.97 tbr, 90k tbn, 60 tbc
Stream #0:1[0x21]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 115 kb/s
Stream #0:2[0x22]: Data: timed_id3 (ID3 / 0x20334449)and the next after it
Input #0, mpegts, from 'segm150518140104572-424571.ts':
Duration: 00:00:06.22, start: 65890.814689, bitrate: 468 kb/s
Program 257
Stream #0:0[0x20]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 30 fps, 29.97 tbr, 90k tbn, 60 tbc
Stream #0:1[0x21]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 124 kb/s
Stream #0:2[0x22]: Data: timed_id3 (ID3 / 0x20334449)differ in the way that start time of
segm150518140104572-424571.ts
is equal to start time + duration ofsegm150518140104572-424570.ts
.How could this start value be adjusted with
ffmpeg
? Or maybe my whole aproach is wrong ? Unfortunately I couldn’t find on the internet working example of live (not on demand) video service implemented with ffmepg. -
subprocess Task fail after 8min when run inside Flask or BaseHTTPServer
6 août 2015, par jthemovieI’m doing live HLS encoding with ffmpeg, and i usually run it via a python program as follow (i made some shortcuts...) :
import subprocess
def main():
subprocess.Popen("ffmpeg -i .... (live hls encoding)", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if __name__ == '__main__':
main()And everything works like a charm, but when i use Flask or BaseHTTPServer, the very same weird behaviour occurs.
After around 8min (more or less few seconds), the program stop responding and the encoding stop.
import subprocess
from flask import Flask, url_for, request, json, Response
@app.route('/api/v2/livetv', methods = ['POST'])
def api_live():
subprocess.Popen("ffmpeg -i .... (live hls encoding)", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
return "-"
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5001,debug=True)I tried using BaseHTTPServer, the very same behaviour occurs, it usually stop encoding after the segment number 46, or 47, which correspond at those 8 min.
I have no idea why this behavior occurs. For example, the first script, once terminated, the ffmpeg will continue in background, while if i terminate the script with the web server, the ffmpeg program will exit as well.
So if anyone could help me out with that, i would be more than glad.
Thanks a lot for your help.
Regards
ps : if interested , my ffmpeg line look like this :
/usr/bin/ffmpeg -user-agent "A User Agent" -headers "X-Forwarded-For:x.x.x.x"$’\r\n’ -re -i "http://..../index_2000_av-p.m3u8" -c:v libx264 -profile:v baseline -preset medium -x264opts level=41 -b:v 500k -s 600x340 -g 90 -bf 2 -c:a copy -f hls -hls_list_size 20 -hls_time 10 -hls_flags delete_segments -hls_segment_filename /var/www/livestream/"segment%03d.ts" /var/www/livestream/playlist.m3u8
-
ffmpeg generate m3u8 and segments manually
26 juin 2015, par Darshan BhandariWe are developing an application where the m3u8 file should be generated on the fly for a given mp4 video. Can someone please let us know how can we generate the mp4 file on the fly with the exact duration as the segmenter. In our case ffmpeg segmenter is created variable length segments and are of decimal size. For eg :
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-PLAYLIST-TYPE:VOD#EXTINF:5.005,
test.mp4.ts?start=0.000&end=5.005
#EXTINF:6.715,
test.mp4.ts?start=5.005&end=11.720
#EXTINF:6.548,Can someone help us to create such m3u8 file without creating any segments. We will manually create the segments on request.
Also when we create the segments manually there is a small stuttering (flicker) when the video goes to the next segment. When I read it online, it says it might be due to continuity counter. Can someone please help us fix that too
Thanks.