
Recherche avancée
Médias (1)
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
Autres articles (71)
-
Demande de création d’un canal
12 mars 2010, parEn fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...) -
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 ;
-
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation"
Sur d’autres sites (9030)
-
OCPA, FDBR and TDPSA – What you need to know about the US’s new privacy laws
22 juillet 2024, par Daniel Crough -
(C_UDP Socket Programming) How can I convert binary file to video format ?
30 avril 2024, par user24723398I am practicing UDP socket programming. My code's functions are below.


- 

- Connect Server-Client and send "hello" message each other (it is working).
- Then Server is sending video file to client (problem).






Transfer video file to client is working. But it is written in binary so I can't open the video.


So I try to use ffmpeg to convert the video, but it doesn't work.


Is there something wrong in my code ? How can I transfer a received file to a video file ?


My environment is MacOs.


Server.c (Server Code) :


#include 
#include 
#include 
#include <arpa></arpa>inet.h>
#include 
#include <sys></sys>socket.h>

#define PORT 8888
#define BUF_SIZE 256

int main(){
 int serv_sock;
 char message[BUF_SIZE];
 char buf[BUF_SIZE];
 int str_len;
 socklen_t clnt_adr_sz;

 struct sockaddr_in serv_adr, clnt_adr;
 
 //create socket
 serv_sock=socket(PF_INET, SOCK_DGRAM, 0);
 if(serv_sock == -1){
 perror("socket() error");
 exit(1);
 }
 
 //socket address
 memset(&serv_adr, 0, sizeof(serv_adr));
 serv_adr.sin_family=AF_INET;
 serv_adr.sin_addr.s_addr=htonl(INADDR_ANY);
 serv_adr.sin_port=htons(PORT);
 //binding socket
 if(bind(serv_sock, (struct sockaddr*)&serv_adr, sizeof(serv_adr)) == -1){
 perror("bind() error");
 exit(1);
 }
 
 while(1){
 clnt_adr_sz=sizeof(clnt_adr);
 str_len=recvfrom(serv_sock, message, BUF_SIZE, 0, (struct sockaddr *)&clnt_adr, &clnt_adr_sz);
 if (str_len < 0) {
 perror("recvfrom error");
 exit(1);
 }
 
 char hello_message[] = "hello i am server";
 if (sendto(serv_sock, hello_message, strlen(hello_message), 0, (struct sockaddr *)&clnt_adr, clnt_adr_sz) < 0) {
 perror("sendto error");
 exit(1);
 }
 
 //print message
 message[str_len] = '\0';
 printf("client say: %s\n", message);
 
 char buf[BUF_SIZE];
 ssize_t bytes_read;
 // sending viedo file
 printf("sending video file...\n");
 size_t fsize;
 
 //video file
 FILE *file;
 char *filename = "video.mp4";
 // open video file
 file = fopen(filename, "rb");
 if (file == NULL) {
 perror("File opening failed");
 exit(EXIT_FAILURE);
 }
 //calculate video file memory
 fseek(file, 0, SEEK_END);
 fsize = ftell(file);
 fseek(file,0,SEEK_SET);
 
 size_t size = htonl(fsize);
 int nsize =0;
 
 while(nsize!=fsize){
 int fpsize = fread(buf,1, BUF_SIZE, file);
 nsize += fpsize;
 if (sendto(serv_sock, &size, sizeof(size), 0, (struct sockaddr *)&clnt_adr, clnt_adr_sz) < 0) {
 perror("sendto");
 exit(EXIT_FAILURE); 
 }
 fclose(file);
 /*
 while ((bytes_read = fread(buf, 1, BUF_SIZE, file)) > 0) {
 if (sendto(serv_sock, buf, bytes_read, 0,
 (struct sockaddr *)&clnt_adr, clnt_adr_sz) < 0) {
 perror("sendto");
 exit(EXIT_FAILURE);
 } 
 }
 */
 } 
 }
 close(serv_sock);
 return 0;
}



Client.c (Client code)


#include 
#include 
#include 
#include <arpa></arpa>inet.h>
#include 
#include <sys></sys>socket.h>

#define BUFSIZE 256
#define PORT 8888

int main(){
 int sock;
 char message[BUFSIZE];
 int str_len;
 socklen_t adr_sz;

 struct sockaddr_in serv_addr, client_addr; 
 
 sock = socket(PF_INET, SOCK_DGRAM, 0);
 if(sock == -1){
 printf("socket() error\n");
 exit(1);
 }

 memset(&serv_addr, 0, sizeof(serv_addr));
 serv_addr.sin_family = AF_INET;
 serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
 serv_addr.sin_port = htons(PORT);

 char hello_message[] = "hello i am client";
 sendto(sock, hello_message, strlen(hello_message), 0, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
 adr_sz = sizeof(client_addr);
 str_len=recvfrom(sock,message,BUFSIZE,0,(struct sockaddr*)&client_addr,&adr_sz);
 
 message[str_len] = '\0';
 printf("client say: %s\n", message);
 
 /*
 char buf[BUFSIZE];
 ssize_t bytes_received;
 socklen_t serv_len = sizeof(serv_addr);
 while ((bytes_received = recvfrom(sock, buf, BUFSIZE, 0,
 (struct sockaddr *)&serv_addr, &serv_len)) > 0) {
 fwrite(buf, 1, bytes_received, file);
 }
 */
 
 FILE *file = fopen("received_test.mp4", "wb");

 int nbyte = BUFSIZE;
 while(nbyte>= BUFSIZE){
 nbyte = recvfrom(sock, message, BUFSIZE, 0, (struct sockaddr*)&serv_addr, &adr_sz);
 fwrite(message, sizeof(char), nbyte, file);
 }

 if (file == NULL) {
 perror("File opening failed");
 exit(EXIT_FAILURE);
 }

 fclose(file);
 close(sock);
 printf("File received successfully\n");
 
 return 0;
}



I try to convert the binary file to an
.mp4
file using ffmpeg
but it doesn't work :

ffmpeg -i received_test.mp4 output.mp4
ffmpeg version 7.0 Copyright (c) 2000-2024 the FFmpeg developers
 built with Apple clang version 15.0.0 (clang-1500.3.9.4)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/7.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags='-Wl,-ld_classic' --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libharfbuzz --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenvino --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
 libavutil 59. 8.100 / 59. 8.100
 libavcodec 61. 3.100 / 61. 3.100
 libavformat 61. 1.100 / 61. 1.100
 libavdevice 61. 1.100 / 61. 1.100
 libavfilter 10. 1.100 / 10. 1.100
 libswscale 8. 1.100 / 8. 1.100
 libswresample 5. 1.100 / 5. 1.100
 libpostproc 58. 1.100 / 58. 1.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12a62bdb0] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x12a62bdb0] moov atom not found
[in#0 @ 0x12b0043c0] Error opening input: Invalid data found when processing input
Error opening input file received_test.mp4.
Error opening input files: Invalid data found when processing input



-
Flutter ffmpeg_kit_flutter_new can't build Android app in any version
13 mai, par user31929I can't build my project on Android ( on Ios it works and the project itself without ffmpeg_kit_flutter_new builds without problems )
This is the error i obtain :


/GeneratedPluginRegistrant.java:51: error: cannot find symbol
 com.antonkarpenko.ffmpegkit.MainActivity.registerWith(shimPluginRegistry.registrarFor("com.antonkarpenko.ffmpegkit.MainActivity"));
 ^
 symbol: class MainActivity
 location: package com.antonkarpenko.ffmpegkit



This is my flutter doctor :


[✓] Flutter (Channel stable, 3.19.4, on macOS 15.4.1 24E263 darwin-x64, locale it-IT)
 • Flutter version 3.19.4 on channel stable at ….
 • Upstream repository https://github.com/flutter/flutter.git
 • Framework revision 68bfaea224 (1 year, 2 months ago), 2024-03-20 15:36:31 -0700
 • Engine revision a5c24f538d
 • Dart version 3.3.2
 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
 • Android SDK at …..
 • Platform android-35, build-tools 34.0.0
 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
 • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
 • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3)
 • Xcode at /Applications/Xcode.app/Contents/Developer
 • Build 16E140
 • CocoaPods version 1.16.2

[✓] Chrome - develop for the web
 • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
 • Android Studio at /Applications/Android Studio.app/Contents
 • Flutter plugin can be installed from:
 🔨 https://plugins.jetbrains.com/plugin/9212-flutter
 • Dart plugin can be installed from:
 🔨 https://plugins.jetbrains.com/plugin/6351-dart
 • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.99.3)
 • VS Code at /Applications/Visual Studio Code.app/Contents
 • Flutter extension version 3.110.0

[✓] Connected device (5 available)
 • SM A135F (mobile) • RF8T40TMS6Z • android-arm • Android 12 (API 31)
 • cri SE 128 (mobile) • 00008030-001268303E38402E • ios • iOS 18.4.1 22E252
 • iPhone di WacMini (mobile) • 00008030-00121D543CE8802E • ios • iOS 18.4.1 22E252
 • macOS (desktop) • macos • darwin-x64 • macOS 15.4.1 24E263 darwin-x64
 • Chrome (web) • chrome • web-javascript • Google Chrome 136.0.7103.93

[✓] Network resources
 • All expected network resources are available.



My android/app/build.gradle


def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
 localPropertiesFile.withReader('UTF-8') { reader ->
 localProperties.load(reader)
 }
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
 throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
 flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
 flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'org.jetbrains.kotlin.android'


android {

 compileSdkVersion 35

 namespace = "com.app.app"
 sourceSets {
 main.java.srcDirs += 'src/main/kotlin'
 }

 defaultConfig {
 applicationId "com.appid.appid"
 minSdkVersion 24
 targetSdkVersion 35
 versionCode flutterVersionCode.toInteger()
 versionName flutterVersionName
 
 // insert this line of code in order to manage correct build abi configuration only on supported devices not supported tablet device emulator
 /* ndk {
 abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86_64'
 }*/
 }

 signingConfigs {
 release {
 keyAlias keystoreProperties['keyAlias']
 keyPassword keystoreProperties['keyPassword']
 storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
 storePassword keystoreProperties['storePassword']
 }
 }

 buildTypes {
 debug {
 debuggable true
 }

 release {
 signingConfig signingConfigs.release
 debuggable false
 shrinkResources true
 minifyEnabled true
 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
 }
 }

}

flutter {
 source '../..'
}

dependencies {
 implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.24"
}



My android/build.gradle


buildscript {
 ext.kotlin_version = '1.9.24'
 repositories {
 google()
 mavenCentral()
 jcenter()
 }

 dependencies {
 classpath 'com.android.tools.build:gradle:8.4.0'
 classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
 classpath 'com.google.gms:google-services:4.3.14'
 classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
 }
}

allprojects {
 repositories {
 google()
 mavenCentral()
 jcenter()
 }

 
 subprojects {
 tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
 kotlinOptions.jvmTarget = "1.8"
 }
 afterEvaluate { project ->
 if (project.hasProperty('android')) {
 project.android {
 if (namespace == null) {
 namespace project.group
 }
 }
 }
 }
 }
 
}


ext {
 flutterFFmpegPackage = "min-gpl-lts"
}


rootProject.buildDir = '../build'
subprojects {
 project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
 project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
 delete rootProject.buildDir
}



My gradle.wrapper.properties


distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip



What i have already tried :


- 

- flutter clean/flutter pub get
- remove .gradle folder/flutter clean/flutter pub get
- remove GeneratedPluginRegistrant.java file then remove .gradle/flutter clean/flutter pub get








I have this issue in every version of the plugin. There is something wrong in my configurations or maybe this is a plugin issue ?