
Recherche avancée
Autres articles (68)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (10505)
-
how to decode wmp3 video using libavcodec ? (ffmpeg)
13 mars 2012, par Renan EliasI'm developing an application that reads a live tv stream from the internet and I need to play it on my ipad application.
I've compiled the ffmpeg into my ipad application to use the libavcodec lib, but I've not been able to use it in this lib...
I know how to get the stream packets, read if it is an audio or video packet, but I don't know how to use the lib to convert the original packet codecs to h264 and mp3 codec...
I need to convert an stream packet wmv3 to h264 and save it on a file.
My code is below...
AVFormatContext* pFormatCtx = avformat_alloc_context();
int i, videoStream, audioStream;
AVCodecContext *pCodecCtx;
AVCodecContext *aCodecCtx;
AVCodec *pCodec;
AVCodec *aCodec;
AVFrame *pFrame;
AVFrame *pFrameRGB;
AVPacket packet;
int frameFinished;
int numBytes;
uint8_t *buffer;
static struct SwsContext *img_convert_ctx;
// Register all formats and codecs
av_register_all();
avcodec_register_all();
avformat_network_init();
// Open video file
if(avformat_open_input(&pFormatCtx, [objURL cStringUsingEncoding:NSASCIIStringEncoding] ,NULL,NULL) != 0){
return -1;
}
// Retrieve stream information
if(avformat_find_stream_info(pFormatCtx, NULL)<0)
return -1; // Couldn't find stream information
// Dump information about file onto standard error
av_dump_format(pFormatCtx, 0, [objURL cStringUsingEncoding:NSASCIIStringEncoding], 0);
// Find the first video stream
videoStream=-1;
audioStream=-1;
for(i=0; i < pFormatCtx->nb_streams; i++) {
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_VIDEO && videoStream < 0) {
videoStream=i;
}
if(pFormatCtx->streams[i]->codec->codec_type==AVMEDIA_TYPE_AUDIO && audioStream < 0) {
audioStream=i;
}
}
if(videoStream==-1)
return -1; // Didn't find a video stream
if(audioStream==-1)
return -1;
// Get a pointer to the codec context for the video stream
pCodecCtx=pFormatCtx->streams[videoStream]->codec;
// Find the decoder for the video stream
pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
if(pCodec==NULL) {
fprintf(stderr, "Unsupported codec!\n");
return -1; // Codec not found
}
// Open codec
if(avcodec_open2(pCodecCtx, pCodec, NULL)<0)
return -1; // Could not open codec
// Get a pointer to the codec context for the audio stream
aCodecCtx=pFormatCtx->streams[audioStream]->codec;
// Find the decoder for the audio stream
aCodec = avcodec_find_decoder(aCodecCtx->codec_id);
if(!aCodec) {
fprintf(stderr, "Unsupported codec!\n");
return -1; // Codec not found
}
// Open codec
if(avcodec_open2(aCodecCtx, aCodec, NULL)<0)
return -1; // Could not open codec
// Allocate video frame
pFrame=avcodec_alloc_frame();
// Allocate an AVFrame structure
pFrameRGB=avcodec_alloc_frame();
if(pFrameRGB==NULL)
return -1;
// Determine required buffer size and allocate buffer
numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
pCodecCtx->height);
buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
// Assign appropriate parts of buffer to image planes in pFrameRGB
// Note that pFrameRGB is an AVFrame, but AVFrame is a superset
// of AVPicture
avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
pCodecCtx->width, pCodecCtx->height);
// Read frames and save first five frames to disk
i=0;
while(av_read_frame(pFormatCtx, &packet)>=0) {
// Is this a packet from the video stream?
if(packet.stream_index==audioStream) {
NSLog(@"Audio.. i'll solve the video first...");
} else if(packet.stream_index==videoStream) {
/// HOW CONVERT THIS VIDEO PACKET TO H264 and save on a file? :(
}
// Free the packet that was allocated by av_read_frame
av_free_packet(&packet);
}
// Free the RGB image
av_free(buffer);
av_free(pFrameRGB);
// Free the YUV frame
av_free(pFrame);
// Close the codec
avcodec_close(pCodecCtx);
// Close the video file
avformat_close_input(&pFormatCtx);
return 0; -
the ffmpeg recording does not stop after the test case is successfully executed,
21 mai 2024, par ghufranI am new to selenium, I want to add screen recording in my test cases, and I am using ffmpeg. The issue i am facing is the recording successfully starts, but it does not stop after the test case is successfully executed.


Below is how my code is strcutured :


package utilities;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ScreenRecording {

 private Process ffmpeg;
 private String outputFilePath;
 private boolean isRecording;

 public ScreenRecording(String outputFilePath) {
 this.isRecording = false;
 this.outputFilePath = outputFilePath;
 }

 public void startRecording() throws IOException {
 String command = String.format(
 "ffmpeg -y -f gdigrab -framerate 30 -probesize 100M -analyzeduration 10M -i desktop -vf \"crop=1920:1080:0:0\" -c:v libx264 -preset ultrafast -qp 0 -pix_fmt yuv420p %s",
 outputFilePath
 );
 System.out.println("Executing command: " + command); // Print command for debugging
 try {
 ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", command);
 builder.redirectErrorStream(true); // Combine error and output streams
 ffmpeg = builder.start();
 isRecording = true;

 // Log output and errors
 new Thread(() -> {
 try (BufferedReader reader = new BufferedReader(new InputStreamReader(ffmpeg.getInputStream()))) {
 String line;
 while ((line = reader.readLine()) != null) {
 System.out.println(line);
 }
 } catch (IOException e) {
 e.printStackTrace();
 }
 }).start();
 } catch (IOException e) {
 e.printStackTrace(); // Print exception for debugging
 throw e; // Rethrow exception to propagate it to the caller
 }
 }

 public void stopRecording() {
 if (ffmpeg != null) {
 ffmpeg.destroy();
 System.out.println("Recording stopped.");
 isRecording = false;
 }
 }

 public boolean isRecording() {
 return isRecording;
 }
}




public class AccountFeatures extends BaseTest {

 @Test(testName = "Register User")
 public void testRegisterUserScenario() throws InterruptedException {
 HomePage homePage = new HomePage(driver);
 LoginPage loginPage = new LoginPage(driver);
 SignUpPage signUpPage = new SignUpPage(driver);
 homePage.clickOnLogin();
 Assert.assertEquals(loginPage.getSingupText(), "New User Signup!");
 loginPage.enterUserName(randomName);
 loginPage.enterUserEmail(randomEmail);
 loginPage.clickOnSignUpButton();
 signUpPage.clickOnTitle();
 signUpPage.enterPassword(randomPassword);
 signUpPage.selectDate(birthDay);
 signUpPage.selectMonth("December");
 signUpPage.selectYear();
 signUpPage.selectFromCountryDropDown("Canada");
 }
}



import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import utilities.ScreenRecording;
import webdrivers.DriverManager;

import java.io.IOException;

public class BaseTest {

 protected WebDriver driver;
 private ScreenRecording recorder;

 @BeforeMethod
 public void setUp() throws IOException {
 // Initialize WebDriver (you can choose Chrome, Firefox, etc.)
 String outputFilePath = "D:\\Projects\\screen_recordings\\screen_recording.mp4";
 recorder = new ScreenRecording(outputFilePath);
 recorder.startRecording();
 driver = DriverManager.getDriver();
 driver.get(DataConfig.baseUrl);
 driver.manage().window().maximize();
 }

 @AfterMethod
 public void tearDown() {
 if (driver != null) {
 driver.quit();
 }
 if (recorder != null && recorder.isRecording()) {
 recorder.stopRecording();
 }
 }
}



I tried different solutions but it does not work at all. Before that i was using @AfterTest annotations but it was giving stack overflow exception.


-
Calling ffmpeg.c's main twice causes app crash
21 octobre 2018, par user924Using FFmpeg 4.0.2 and call its
ffmpeg.c's main
function twice causes Android app crash (using FFmpeg shared libs and JNI)A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 20153
Though it works ok for FFmpeg 3.2.5
FFmpeg 4.0.2 main
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++;
}
#if CONFIG_AVDEVICE
avdevice_register_all();
#endif
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);
ffmpeg_cleanup(received_nb_signals ? 255 : main_return_code);
return main_return_code;
}FFmpeg 3.2.5 main
int main(int argc, char **argv) {
av_log(NULL, AV_LOG_WARNING, " Command start");
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();
av_log(NULL, AV_LOG_WARNING, " Register to complete the codec");
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);
nb_filtergraphs = 0;
nb_input_streams = 0;
nb_input_files = 0;
progress_avio = NULL;
input_streams = NULL;
nb_input_streams = 0;
input_files = NULL;
nb_input_files = 0;
output_streams = NULL;
nb_output_streams = 0;
output_files = NULL;
nb_output_files = 0;
return main_return_code;
}So what could be issue ? It seems FFmpeg 4.0.2 doesn’t release something (resources or its static variables to initial values after the first command)