
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 (41)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Multilang : améliorer l’interface pour les blocs multilingues
18 février 2011, parMultilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.
Sur d’autres sites (5602)
-
How to apply dynamic watermarking for users watching video in real-time ? [closed]
3 janvier, par Barun BhattacharjeeI am working on a video streaming project where I need to apply a dynamic watermarking (e.g., username and email) in real-time for security purposes. The video is being streamed in DASH format, and the segment files are in .m4s format generated via FFmpeg.


Challenges :
Is it possible to directly apply dynamic watermarking to .m4s segment files ?


Video segments are generated using FFmpeg with the following command :


ffmpeg
 .input(video_path)
 .output(mpd_path,
 format='dash',
 map='0',
 video_bitrate='2400k',
 video_size='1920x1080',
 vcodec='libx264',
 seg_duration='4', # Sets segment duration to 4 seconds
 acodec='copy')
 .run()




What I tried :
I attempted to use FFmpeg to apply a watermark dynamically to the .m4s files using the drawtext filter, but .m4s files are not always recognized as valid input for FFmpeg operations.


# FFmpeg command to add watermark to m4s file
try:
 # FFmpeg processing
 out, err = (
 ffmpeg
 .input(m4s_file_path) # Input the segment file
 .filter(
 "drawtext",
 text=user_info,
 fontfile="font/dejavu-sans/DejaVuSans-Bold.ttf",
 fontsize=24,
 fontcolor="white",
 x=10,
 y=10
 )
 .output(
 "pipe:", # Stream output as a byte stream
 format="mp4", # Output format as MP4 (compatible with MPEG-DASH)
 vcodec="libx264",
 acodec="copy",
 movflags="frag_keyframe+empty_moov"
 )
 .run(capture_stdout=True, capture_stderr=True)
 )

 logger.info(f"FFmpeg process completed. stdout length: {len(out)}, stderr: {err.decode('utf-8')}")
 logger.error(f"FFmpeg stderr: {err.decode('utf-8')}")
 return out # Return the processed video stream data


except ffmpeg.Error as e:
 stderr_output = e.stderr.decode('utf-8') if e.stderr else "No stderr available"
 logger.error(f"FFmpeg error: {stderr_output}")

 raise RuntimeError(f"Error processing video: {stderr_output}")




Error I faced :


video-streaming-backend | [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f1bf99cc640] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1012): unspecified pixel format
video-streaming-backend | Consider increasing the value for the 'analyzeduration' (10000000) and 'probesize' (5000000) options
video-streaming-backend | Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://web:8000/media/stream_video/chunks/ec1db006-b488-47ad-8220-79a05bcaae39/segments/init-stream0.m4s':
video-streaming-backend | Metadata:
video-streaming-backend | major_brand : iso5
video-streaming-backend | minor_version : 512
video-streaming-backend | compatible_brands: iso5iso6mp41
video-streaming-backend | encoder : Lavf60.16.100
video-streaming-backend | Duration: N/A, bitrate: N/A
video-streaming-backend | Stream #0:0[0x1](und): Video: h264 (avc1 / 0x31637661), none(tv, bt709), 1920x1012, SAR 1:1 DAR 480:253, 12288 tbr, 12288 tbn (default)
video-streaming-backend | Metadata:
video-streaming-backend | handler_name : VideoHandler
video-streaming-backend | vendor_id : [0][0][0][0]
video-streaming-backend | Stream mapping:
video-streaming-backend | Stream #0:0 (h264) -> drawtext:default
video-streaming-backend | drawtext:default -> Stream #0:0 (libx264)
video-streaming-backend | Press [q] to stop, [?] for help
video-streaming-backend | Cannot determine format of input stream 0:0 after EOF
video-streaming-backend | Error marking filters as finished
video-streaming-backend | Error while filtering: Invalid data found when processing input
video-streaming-backend | [out#0/mp4 @ 0x7f1bf8e73100] Nothing was written into output file, because at least one of its streams received no packets.
video-streaming-backend | frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=N/A bitrate=N/A speed=N/A 
video-streaming-backend | Conversion failed!




These errors have left me wondering if .m4s is a viable format for dynamic watermarking. If it's not, what would be the correct approach ?


-
Real time audio streaming from ffmpeg to browser (am I missing something ?)
19 septembre 2022, par Яктенс ТидI have tried a couple of solutions already, but nothing works for me.
I want to stream audio from my PC to another computer with almost zero latency. Things are working fine so far in a sense of lagging and everything, sound is clear and not choppy at all, but there is something like a delay between the moment when audio starts playing on my PC and remote PC. For example when I click on Youtube 'play' button audio starts playing only after 3-4 seconds on the remote machine. The same when I click 'Pause', the sound on the remote PC stops after a couple of seconds.


I've tried to use websockets\plain audio tag, but no luck so far.


For example this is my solution by using websockets and pipes :


def create_pipe():
 return win32pipe.CreateNamedPipe(r'\\.\pipe\__audio_ffmpeg', win32pipe.PIPE_ACCESS_INBOUND,
 win32pipe.PIPE_TYPE_MESSAGE |
 win32pipe.PIPE_READMODE_MESSAGE |
 win32pipe.PIPE_WAIT, 1, 1024 * 8, 1024 * 8, 0, None)


async def echo(websocket):
 pipe = create_pipe()
 win32pipe.ConnectNamedPipe(pipe, None)
 while True:
 data = win32file.ReadFile(pipe, 1024 * 2)
 await websocket.send(data[1])


async def main():
 async with websockets.serve(echo, "0.0.0.0", 7777):
 await asyncio.Future() # run forever


if __name__ == '__main__':
 asyncio.run(main())



The way I start ffmpeg


.\ffmpeg.exe -f dshow -i audio="Stereo Mix (Realtek High Definition Audio)" -acodec libmp3lame -ab 320k -f mp3 -probesize 32 -muxdelay 0.01 -y \\.\pipe\__audio_ffmpeg



On the JS side the code is a little bit long, but essentially I am just reading a web socket and appending to buffer


this.buffer = this.mediaSource.addSourceBuffer('audio/mpeg')



Also as you see I tried to use -probesize 32 -muxdelay 0.01 flags, but no luck as well


I tried to use plain tag as well, but still - this couple-of-seconds delay exists


What can I do ? Am I missing something ? Maybe I have to disable buffering somewhere ?


-
ffmpeg trim video works on emulator but fails on arm (real device)
21 octobre 2017, par fthopkinsI’m trimming the videos with
ffmpeg
that is bigger than 10 seconds. On myJNI
edit
function i usecommands
to trim video. I try to debug but as you all know debugging onJNI
function is not like native androidJAVA
function. Maybe it is.. but not for my knowledge. Also i used coffecatch library to catch exception but didn’t succeeded. I did go for error step by step and reached the this line offfmpeg
main
function.EDIT
current_time = ti = getutime(); // edited : lastly can print message on here.
if (transcode() < 0) // transcode() < 0 => true and run exit_program(1).
exit_program(1);
ti = getutime() - ti;On emulator everything is working good and fast. But on real device it gives some kind of error but i couldn’t catch it. When i check the
Android Monitor
ofAndroid Studio
my JNIedit
function’s logs appear but disappear in a second. It is weird. Also when i check the output path on device, ffmpeg gives an trimmed video output (but very slow). So it is working on background and gives a trimmed video. It is very weird too because app crashes whilemain
method is working. I need help to figure it out. I stucked.My video edit JNI function
JNIEXPORT jint JNICALL
Java_com_farukest_app_library_AppVideoEditer_natives_VideoEditer_edit
(JNIEnv *env,jclass someclass, jstring inputFile, jstring outFile, jint
startTime,jint endTime, jstring fileSize, jboolean mustCompress) {
log_message("Starting to cut");
int numberOfArgs = 19;
char** $commands = calloc(numberOfArgs, sizeof(char*));
char start[5], end[5];
const char *in, *out, *fileSz;
itoa(startTime, start);
itoa(endTime, end);
in = (*env)->GetStringUTFChars(env, inputFile, 0);
out = (*env)->GetStringUTFChars(env, outFile, 0);
fileSz = (*env)->GetStringUTFChars(env, fileSize, 0);
$commands[0] = "ffmpeg";
$commands[1] = "-ss";
$commands[2] = start;
$commands[3] = "-y";
$commands[4] = "-i";
$commands[5] = in;
$commands[6] = "-t";
$commands[7] = end;
$commands[8] = "-vcodec";
$commands[9] = "mpeg4";
$commands[10] = "-b:v";
if(mustCompress){
$commands[11] = "3072000"; // 3mb
}else{
$commands[11] = fileSz;
}
$commands[12] = "-b:a";
$commands[13] = "48000";
$commands[14] = "-ac";
$commands[15] = "2";
$commands[16] = "-ar";
$commands[17] = "22050";
$commands[18] = out;
int i;
for (i = 0; i < numberOfArgs; i++) {
log_message($commands[i]);
}
log_message("Printed all"); // lastly prints on here
main(numberOfArgs, $commands); // stuck on here
log_message("Finished cutting"); // not reach here
free($commands);
(*env)->ReleaseStringUTFChars(env, inputFile, in);
(*env)->ReleaseStringUTFChars(env, outFile, out);
return 0;
}FFMPEG main function
int main(int argc, char **argv)
{
int i, ret;
int64_t ti;
init_dynload();
register_exit(ffmpeg_cleanup);
setvbuf(stderr,NULL,_IONBF,0); /* win32 runtime needs this */
av_log_set_flags(AV_LOG_SKIP_REPEATED);
parse_loglevel(argc, argv, options);
if(argc>1 && !strcmp(argv[1], "-d")){
run_as_daemon=1;
av_log_set_callback(log_callback_null);
argc--;
argv++;
}
avcodec_register_all();
# if CONFIG_AVDEVICE
avdevice_register_all();
#endif
avfilter_register_all();
av_register_all();
avformat_network_init();
show_banner(argc, argv, options);
/* parse options and open all input/output files */
ret = ffmpeg_parse_options(argc, argv);
if (ret < 0)
exit_program(1);
if (nb_output_files <= 0 && nb_input_files == 0) {
show_usage();
av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name);
exit_program(1);
}
/* file converter / grab */
if (nb_output_files <= 0) {
av_log(NULL, AV_LOG_FATAL, "At least one output file must be specified\n");
exit_program(1);
}
// if (nb_input_files == 0) {
// av_log(NULL, AV_LOG_FATAL, "At least one input file must be specified\n");
// exit_program(1);
// }
for (i = 0; i < nb_output_files; i++) {
if (strcmp(output_files[i]->ctx->oformat->name, "rtp"))
want_sdp = 0;
}
current_time = ti = getutime();
if (transcode() < 0)
exit_program(1);
ti = getutime() - ti;
if (do_benchmark) {
av_log(NULL, AV_LOG_INFO, "bench: utime=%0.3fs\n", ti / 1000000.0);
}
av_log(NULL, AV_LOG_DEBUG, "%"PRIu64" frames successfully decoded, %"PRIu64" decoding errors\n",
decode_error_stat[0], decode_error_stat[1]);
if ((decode_error_stat[0] + decode_error_stat[1]) * max_error_rate < decode_error_stat[1])
exit_program(69);
exit_program(received_nb_signals ? 255 : main_return_code);
return main_return_code;
}EDIT
I debugged and found which line exiting me from the app. It is
transcode() < 0
line But couldn’t find why ? Is there anyone to help me. I really need help. Can discuss and share more code.