
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (8)
-
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
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 (4151)
-
How to hold the mpegts stream for few seconds ?
8 août 2024, par AvenHow to hold the mpegts stream for 5 seconds without changing frams's PTS ?


I tried the tsduck command as below :


aven.cheng@tgcusers-MacBook-Pro ~ % tsp -I ip 235.35.3.5:3535 -P timeshift --time 5000 -O ip 235.35.3.5:3536

* Warning: timeshift: unknown initial bitrate, discarding packets until a valid bitrate can set the buffer size



the stream of 235.35.3.5:3536 did come out 5 seconds later after i executed the above command..
But the frames' PTS of 235.35.3.5:3536 are not the same anymore. For exsample, the PTS of my target frame is 10935000 from 235.35.3.5:3535, but the PTS of my target frame has changed to 10830542 from 235.35.3.5:3536.


Is that possible to hold the stream for few seconds and also keep the PTS unchanged ? I don't necessarily have to use tsduck ; I am open to using other tools.


-
FFmpeg "Non-monotonous DTS in output stream" error when processing video from Safari's MediaRecorder
17 juillet 2024, par HackermonI'm recording a video stream in Safari with
MediaRecorder
, then sending it to a remote server which then uses ffmpeg to reencode the video. When reencoding with FFmpeg, I get a lot of warnings and the final video is broken, frame are glitching and out of sync but the audio sounds fine.

Here's my MediaRecorder script :


const camera = await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
const recorder = new MediaRecorder(camera, {
 mimeType: 'video/mp4', // Safari only supports MP4
 bitsPerSecond: 1_000_000,
});

recorder.ondataavailable = async ({ data: blob }) => {
 // open contents in new tab
 var fileURL = URL.createObjectURL(file);
 window.open(fileURL, '_blank');
};

recorder.start();
setTimeout(() => recorder.stop(), 5000);



I download the video blob from Safari and use this command to reencode it :


ffmpeg -i ./blob.mp4 -preset ultrafast -strict -2 -threads 10 -c copy ./output.mp4



Logs :


ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
 configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x559826616000] DTS 29 < 313 out of order
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './chunk1.mp4':
 Metadata:
 major_brand : iso5
 minor_version : 1
 compatible_brands: isomiso5hlsf
 creation_time : 2024-07-17T14:30:47.000000Z
 Duration: 00:00:01.00, start: 0.000000, bitrate: 3937 kb/s
 Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], 6218 kb/s, 33.36 fps, 600 tbr, 600 tbn, 1200 tbc (default)
 Metadata:
 creation_time : 2024-07-17T14:30:47.000000Z
 handler_name : Core Media Video
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 420 kb/s (default)
 Metadata:
 creation_time : 2024-07-17T14:30:47.000000Z
 handler_name : Core Media Audio
File './safari3.mp4' already exists. Overwrite ? [y/N] Output #0, mp4, to './safari3.mp4':
 Metadata:
 major_brand : iso5
 minor_version : 1
 compatible_brands: isomiso5hlsf
 encoder : Lavf58.29.100
 Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(progressive), 640x480 [SAR 1:1 DAR 4:3], q=2-31, 6218 kb/s, 33.36 fps, 600 tbr, 19200 tbn, 600 tbc (default)
 Metadata:
 creation_time : 2024-07-17T14:30:47.000000Z
 handler_name : Core Media Video
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 420 kb/s (default)
 Metadata:
 creation_time : 2024-07-17T14:30:47.000000Z
 handler_name : Core Media Audio
Stream mapping:
 Stream #0:0 -> #0:0 (copy)
 Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10016, current: 928; changing to 10017. This may result in incorrect timestamps in the output file.
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10017, current: 1568; changing to 10018. This may result in incorrect timestamps in the output file.
[mp4 @ 0x559826644340] Non-monotonous DTS in output stream 0:0; previous: 10018, current: 2208; changing to 10019. This may result in incorrect timestamps in the output file.
...x100
frame= 126 fps=0.0 q=-1.0 Lsize= 479kB time=00:00:00.97 bitrate=4026.2kbits/s speed= 130x 
video:425kB audio:51kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.652696%



Not sure what's happening or how to fix it. This issue only happens in Safari, videos from Chrome are perfectly fine.


I've tried various flags :


-fflags +igndts
-bsf:a aac_adtstoasc
-c:v libvpx-vp9 -c:a libopus
etc



None of them seem to fix the issue.


-
FFMPEG eating up ram in railway deployment [flask app]
23 juin 2024, par Eshan DasI created a flask app , meme generator, hosting it in railway using gunicorn, i am suspecting ffmpeg is eating the most ram.....
so what i am doing is , generating a tts, and a text adding into one of the parts of the video , and then finally combining all together


from flask import Flask, request, jsonify, send_file, url_for
from moviepy.editor import VideoFileClip, ImageClip, CompositeVideoClip, AudioFileClip, concatenate_videoclips
from pydub import AudioSegment
from PIL import Image, ImageDraw, ImageFont
from gtts import gTTS
from flask_cors import CORS
import os

app = Flask(__name__)
CORS(app)
app.config['UPLOAD_FOLDER'] = 'uploads'

def generate_video(name, profile_image_path, song_path, start_time):
 first_video = VideoFileClip("first.mp4")
 second_video = VideoFileClip("second.mp4")
 third_video = VideoFileClip("third.mp4")

 #font_path = os.path.join("fonts", "arial.ttf") # Updated font path
 font_size = 70
 font = ImageFont.load_default()
 text = name
 image_size = (second_video.w, second_video.h)
 text_image = Image.new('RGBA', image_size, (0, 0, 0, 0))
 draw = ImageDraw.Draw(text_image)
 text_width, text_height = draw.textsize(text, font=font)
 text_position = ((image_size[0] - text_width) // 2, (image_size[1] - text_height) // 2)
 draw.text(text_position, text, font=font, fill="black")

 text_image_path = os.path.join(app.config['UPLOAD_FOLDER'], f"text_{name}.png")
 text_image.save(text_image_path)

 txt_clip = ImageClip(text_image_path, duration=second_video.duration)

 tts = gTTS(text=name, lang='en')
 audio_path = os.path.join(app.config['UPLOAD_FOLDER'], f"audio_{name}.wav")
 tts.save(audio_path)

 sound = AudioSegment.from_file(audio_path)
 chipmunk_sound = sound._spawn(sound.raw_data, overrides={
 "frame_rate": int(sound.frame_rate * 1.5)
 }).set_frame_rate(sound.frame_rate)

 chipmunk_audio_path = os.path.join(app.config['UPLOAD_FOLDER'], f"chipmunk_audio_{name}.wav")
 chipmunk_sound.export(chipmunk_audio_path, format="wav")

 audio_clip_second = AudioFileClip(chipmunk_audio_path)

 second_video = CompositeVideoClip([second_video, txt_clip.set_position((45, 170))])
 second_video = second_video.set_audio(audio_clip_second)

 song = AudioSegment.from_file(song_path)
 start_ms = start_time * 1000
 cropped_song = song[start_ms:start_ms + 20000]

 chipmunk_song = cropped_song._spawn(cropped_song.raw_data, overrides={
 "frame_rate": int(cropped_song.frame_rate * 1.5)
 }).set_frame_rate(cropped_song.frame_rate)

 chipmunk_song_path = os.path.join(app.config['UPLOAD_FOLDER'], f"chipmunk_song_{name}.wav")
 chipmunk_song.export(chipmunk_song_path, format="wav")

 audio_clip_third = AudioFileClip(chipmunk_song_path)
 third_video = third_video.set_audio(audio_clip_third)

 profile_image = ImageClip(profile_image_path).set_duration(first_video.duration).resize(height=first_video.h / 8).set_position((950, 500))
 first_video = CompositeVideoClip([first_video, profile_image])
 
 profile_image = ImageClip(profile_image_path).set_duration(second_video.duration).resize(height=second_video.h / 8).set_position((950, 500))
 second_video = CompositeVideoClip([second_video, profile_image])
 
 profile_image = ImageClip(profile_image_path).set_duration(third_video.duration).resize(height=third_video.h / 8).set_position((950, 500))
 third_video = CompositeVideoClip([third_video, profile_image])

 final_video = concatenate_videoclips([first_video, second_video, third_video])
 final_video = final_video.subclip(0, 10)

 output_path = os.path.join(app.config['UPLOAD_FOLDER'], f"output_{name}.mp4")
 final_video.write_videofile(output_path, codec="libx264", audio_codec='aac')

 final_video.close()
 first_video.close()
 second_video.close()
 third_video.close()
 audio_clip_second.close()
 audio_clip_third.close()

 os.remove(audio_path)
 os.remove(text_image_path)
 os.remove(chipmunk_song_path)
 os.remove(chipmunk_audio_path)
 
 return output_path

@app.route('/generate', methods=['POST'])
async def generate():
 if not os.path.exists(app.config['UPLOAD_FOLDER']):
 os.makedirs(app.config['UPLOAD_FOLDER'])

 name = request.form['name']
 start_time = float(request.form['start_time'])

 profile_image = request.files['profile_image']
 profile_image_path = os.path.join(app.config['UPLOAD_FOLDER'], profile_image.filename)
 profile_image.save(profile_image_path)

 song = request.files['song']
 song_path = os.path.join(app.config['UPLOAD_FOLDER'], song.filename)
 song.save(song_path)

 video_path = generate_video(name, profile_image_path, song_path, start_time)
 return jsonify({"video_url": url_for('uploaded_file', filename=os.path.basename(video_path))})

@app.route('/uploads/<filename>')
def uploaded_file(filename):
 path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
 return send_file(path, as_attachment=True)

if __name__ == "__main__":
 if not os.path.exists(app.config['UPLOAD_FOLDER']):
 os.makedirs(app.config['UPLOAD_FOLDER'])
 app.run(host='0.0.0.0', port=5000)
</filename>


I am trying to solve this issue, any way to optimize my code , or any other alternative of ffmpeg which i can use , to reduce the ram consumption