
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (91)
-
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. -
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. -
ANNEXE : Les plugins utilisés spécifiquement pour la ferme
5 mars 2010, parLe site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation ; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs ; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3) ; le plugin champs extras v2 nécessité par inscription3 (...)
Sur d’autres sites (3547)
-
Streaming UDP packets to two different ports (for video and audio). Video works fine, but the audio does not show
8 avril 2018, par Winston ChenI am taking a rtsp stream, split the video and audio out, and stream them to two different ports respectively using
gstreamer
so that myffserver
would be able to display the stream on my browser.My gstreamer pipeline :
gst-launch-1.0 -v rtspsrc location=rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov latency=300 timeout=0 drop-on-latency=true rtp-blocksize=4096 name=rtsp_source ! \
queue ! capsfilter caps="application/x-rtp,media=video" ! rtph264depay ! h264parse ! rtph264pay config-interval=1 pt=96 ! udpsink host=127.0.0.1 port=9527 rtsp_source. ! \
queue ! rtpmp4apay pt=97 ! udpsink host=127.0.0.1 port=9327Here comes the sdp and my ffmpeg commnad :
m=video 9527 RTP/AVP 96
a=rtpmap:96 H264/90000
c=IN IP4 127.0.0.1
m=audio 9327 RTP/AVP 97
a=rtpmap:97 mpeg4-generic/48000/6
c=IN IP4 127.0.0.1ffmpeg -protocol_whitelist "file,tcp,rtp,udp" -i ~/test.sdp -max_muxing_queue_size 1024 http://localhost:8090/feed1.ffm
And finally, this is my ffserver config (the important part) :
<feed> # This is the input feed where FFmpeg will send
File ./feed1.ffm # video stream.
FileMaxSize 1GB # Maximum file size for buffering video
ACL allow 127.0.0.1 # Allowed IPs
</feed>
<stream> # Output stream URL definition
Feed feed1.ffm # Feed from which to receive video
Format webm
# NoDefaults
# NoAudio
# Audio settings
AudioCodec vorbis
AudioBitRate 64 # Audio bitrate
# Video settings
VideoCodec libvpx
VideoSize 240x160 # Video resolution
VideoFrameRate 10 # Video FPS
AVOptionVideo flags +global_header # Parameters passed to encoder
# (same as ffmpeg command-line parameters)
PreRoll 0
StartSendOnKey
VideoGopSize 12
VideoBitRate 256
</stream>The thing is that if I take away the audio part and apply
NoAudio
, the video streams fine. However, I could not get the audio to work. Am I doing anything wrong ? -
Image to MPEG on Linux works, same code on Android = green video
5 avril 2018, par JScoobyCedEDIT
I have check the execution and found that the error is not (yet) at the swscale point. My current issue is that the JPG image is not found :
No such file or directory
when doing theavformat_open_input(&pFormatCtx, imageFileName, NULL, NULL);
Before you tell me I need to register anything, I can tell I already did (I updated the code below).
I also added the Android permission to access the external storage (I don’t think it is related to Android since I can already write to the /mnt/sdcard/ where the image is also located)
END EDITI have been through several tutorials (including the few posted from SO, i.e. http://dranger.com/ffmpeg/, how to compile ffmpeg for Android...,been through dolphin-player source code). Here is what I have :
. Compiled ffmpeg for android
. Ran basic tutorials using NDK to create a dummy video on my android device
. been able to generate a MPEG2 video from images on Ubuntu using a modified version of dummy video code above and a lot of Googling
. running the new code on Android device gives a green screen video (duration 1 sec whatever the number of frames I encode)I saw another post about iPhone in a similar situation that mentioned the ARM processor optimization could be the culprit. I tried a few ldextra-flags (-arch armv7-a and similar) to no success.
I include at the end the code that loads the image. Is there something different to do on Android than on linux ? Is my ffmpeg build not correct for Android video encoding ?
void copyFrame(AVCodecContext *destContext, AVFrame* dest,
AVCodecContext *srcContext, AVFrame* source) {
struct SwsContext *swsContext;
swsContext = sws_getContext(srcContext->width, srcContext->height, srcContext->pix_fmt,
destContext->width, destContext->height, destContext->pix_fmt,
SWS_FAST_BILINEAR, NULL, NULL, NULL);
sws_scale(swsContext, source->data, source->linesize, 0, srcContext->height, dest->data, dest->linesize);
sws_freeContext(swsContext);
}
int loadFromFile(const char* imageFileName, AVFrame* realPicture, AVCodecContext* videoContext) {
AVFormatContext *pFormatCtx = NULL;
avcodec_register_all();
av_register_all();
int ret = avformat_open_input(&pFormatCtx, imageFileName, NULL, NULL);
if (ret != 0) {
// ERROR hapening here
// Can't open image file. Use strerror(AVERROR(ret))) for details
return ERR_CANNOT_OPEN_IMAGE;
}
AVCodecContext *pCodecCtx;
pCodecCtx = pFormatCtx->streams[0]->codec;
pCodecCtx->width = W_VIDEO;
pCodecCtx->height = H_VIDEO;
pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
// Find the decoder for the video stream
AVCodec *pCodec = avcodec_find_decoder(pCodecCtx->codec_id);
if (!pCodec) {
// Codec not found
return ERR_CODEC_NOT_FOUND;
}
// Open codec
if (avcodec_open(pCodecCtx, pCodec) < 0) {
// Could not open codec
return ERR_CANNOT_OPEN_CODEC;
}
//
AVFrame *pFrame;
pFrame = avcodec_alloc_frame();
if (!pFrame) {
// Can't allocate memory for AVFrame
return ERR_CANNOT_ALLOC_MEM;
}
int frameFinished;
int numBytes;
// Determine required buffer size and allocate buffer
numBytes = avpicture_get_size(PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
uint8_t *buffer = (uint8_t *) av_malloc(numBytes * sizeof (uint8_t));
avpicture_fill((AVPicture *) pFrame, buffer, PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
AVPacket packet;
int res = 0;
while (av_read_frame(pFormatCtx, &packet) >= 0) {
if (packet.stream_index != 0)
continue;
ret = avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);
if (ret > 0) {
// now, load the useful info into realPicture
copyFrame(videoContext, realPicture, pCodecCtx, pFrame);
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
return 0;
} else {
// Error decoding frame. Use strerror(AVERROR(ret))) for details
res = ERR_DECODE_FRAME;
}
}
av_free(pFrame);
// close codec
avcodec_close(pCodecCtx);
// Close the image file
av_close_input_file(pFormatCtx);
return res;
}Some ./configure options :
--extra-cflags="-O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 -Dipv6mr_interface=ipv6mr_ifindex -fasm -Wno-psabi -fno-short-enums -fno-strict-aliasing -finline-limit=300 -mfloat-abi=softfp -mfpu=vfp -marm -march=armv7-a -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
--extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib -lc -lm -ldl -llog"
--arch=armv7-a --enable-armv5te --enable-armv6 --enable-armvfp --enable-memalign-hack
-
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.