
Recherche avancée
Médias (39)
-
Stereo master soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
1,000,000
27 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Demon Seed
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
The Four of Us are Dying
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (33)
-
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Participer à sa documentation
10 avril 2011La documentation est un des travaux les plus importants et les plus contraignants lors de la réalisation d’un outil technique.
Tout apport extérieur à ce sujet est primordial : la critique de l’existant ; la participation à la rédaction d’articles orientés : utilisateur (administrateur de MediaSPIP ou simplement producteur de contenu) ; développeur ; la création de screencasts d’explication ; la traduction de la documentation dans une nouvelle langue ;
Pour ce faire, vous pouvez vous inscrire sur (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (5689)
-
ffmpeg concat work in one order but not the other
11 octobre 2023, par user3083171So I took a video and cut it two ways, one with reencoding and one without reencoding, call them R and C (cut). Im trying to do concatenation without reencoding, and I'm able to concat the video in all orders , , , , but the sound disappears for and I have no idea why.


I know I can concatenate with reencoding, but my question is specifically if someone knows why the sound drops in and maybe how to fix it. Here is some code in python


import os
import json
import subprocess

video_file = 'yourpath/vid.mp4'
# get the time between frames

ffprobe_command = f"ffprobe -v error -select_streams v:0 -show_entries stream=width,height,r_frame_rate,duration,nb_frames,codec_name -of json {video_file}"
result = subprocess.run(ffprobe_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)

# Parse the JSON output from ffprobe
json_data = json.loads(result.stdout)

# Extract video information from the JSON data
video_info = {
 'length': int(json_data['streams'][0]['nb_frames']),
 'frames': int(json_data['streams'][0]['nb_frames']),
 'duration_seconds': float(json_data['streams'][0]['duration']),
 'fps': eval(json_data['streams'][0]['r_frame_rate']),
 'codec': json_data['streams'][0]['codec_name'],
 'time_between_frames': 1 / eval(json_data['streams'][0]['r_frame_rate'])
}
# get the time between frames
delta = video_info['time_between_frames']

directory, filename_with_extension = os.path.split(video_file)
filename, extension = os.path.splitext(filename_with_extension)
tag = "_reencode"
new_filename = f"{filename}{tag}{extension}"
reencode_file = directory + "/" + new_filename

tag = "_justcut"
new_filename = f"{filename}{tag}{extension}"
justcut_file = directory + "/" + new_filename

tag = "_concat"
new_filename = f"{filename}{tag}{extension}"
concat_file = directory + "/" + new_filename

start_time = 0.0 + 108 * delta
end_time = start_time + 180 * delta
end_frame = round(end_time / delta)
start_frame = round(start_time / delta)

# Reencode
cmd = [
 "ffmpeg",
 "-i", video_file,
 "-ss", str(start_time),
 "-to", str(end_time),
 # "-c:a", "copy",
 "-c:v", "libx264",
 "-bf", str(0), # no B frames
 "-crf", str(18), # new
 "-preset", "slow", # new
 # "-g", str(60), #forces key_frames
 # "-force_key_frames expr:gte(t, n_forced * GOP_LEN_IN_SECONDS)"
 # "-c:v", "mpeg4", #"copy", #"mpeg4"
 # "-q:v", "2",
 "-c:a", "copy",
 # "video_track_timescale", str(90)+"K",
 reencode_file
]
subprocess.run(cmd, check=True)

# Just Cut
cmd = [
 'ffmpeg',
 '-i', video_file,
 '-c', 'copy',
 '-ss', str(start_time),
 '-to', str(end_time),
 justcut_file
]
subprocess.run(cmd, check=True)

# Concat without reencoding
def concatenate_videos_without_reencoding(video1, video2, output_file):
 try:
 # Create a text file listing the videos to concatenate
 with open('input.txt', 'w') as f:
 f.write(f"file '{video1}'\n")
 f.write(f"file '{video2}'\n")

 # Run ffmpeg command to concatenate videos without re-encoding
 # subprocess.run(['ffmpeg', '-f', 'concat', '-safe', '0', '-i', 'input.txt', '-c', 'copy', output_file])

 subprocess.run(
 ['ffmpeg', '-f', 'concat', '-safe', '0', '-i', 'input.txt', '-vcodec', 'copy',
 '-acodec', 'copy', "-strict", "experimental", output_file])

 print(f"Videos concatenated successfully without re-encoding. Output saved to {output_file}")
 except Exception as e:
 print(f"An error occurred: {e}")
 finally:
 # Remove the temporary input file
 if os.path.exists('input.txt'):
 os.remove('input.txt')
# Has sound
concatenate_videos_without_reencoding(justcut_file, justcut_file, concat_file)
os.remove(concat_file)
# Has sound
concatenate_videos_without_reencoding(reencode_file, reencode_file, concat_file)
os.remove(concat_file)
# Has sound
concatenate_videos_without_reencoding(justcut_file, reencode_file, concat_file)
os.remove(concat_file)
# Has NO sound
concatenate_videos_without_reencoding(reencode_file, justcut_file, concat_file)
os.remove(concat_file)



As you can see I tried a bunch of stuff but I have no clue why the audio is not working. I've tried to force the two input videos to be as similar as possible in term of specs and keyframes and fps etc. Nothing seems to work, kinda frustrating.


I've also tried this with both mpeg4 and h264 and different framerates, but still get this behavior.


-
The Ultimate Guide to HeatMap Software
-
How to save an SDL bitmap to memory and load it back ?
19 novembre 2012, par NavI have a bunch of RWops functions :
static int myseekfunc(SDL_RWops *context, int offset, int whence) { SDL_SetError("Can't seek in this kind of RWops"); return(-1); }
static int myreadfunc(SDL_RWops *context, void *ptr, int size, int maxnum) { memset(ptr,0,size*maxnum); return(maxnum); }
static int mywritefunc(SDL_RWops *context, const void *ptr, int size, int num) { return(num); }
static int myclosefunc(SDL_RWops *context)
{
if(context->type != 0xdeadbeef) { SDL_SetError("Wrong kind of RWops for myclosefunc()"); return(-1); }
free(context->hidden.unknown.data1);
SDL_FreeRW(context);
return(0);
}
// Note that this function is NOT static -- we want it directly callable from other source files
SDL_RWops *MyCustomRWop()
{
SDL_RWops *c=SDL_AllocRW();
if(c==NULL) return(NULL);
c->seek =myseekfunc;
c->read =myreadfunc;
c->write=mywritefunc;
c->close=myclosefunc;
c->type =0xdeadbeef;
printf("deadbeef=%d\n",c->type);
c->hidden.unknown.data1=malloc(256);//IS THIS CORRECT?
return(c);
}with which I'm trying to write a BMP into memory and then extract it back. The below code is from tutorial02.
Two problems I'm facing are :
1. Unless I callSDL_DisplayYUVOverlay
, theSDL_SaveBMP
function outputs a blank BMP file to the hard disk. How can I output a BMP file without having to callSDL_DisplayYUVOverlay
?
2. Although I'm able to save the BMP to memory withSDL_SaveBMP_RW
and free the memory with filestream->close, I'm unable to load the BMP back from memory withSDL_SaveBMP
. The application crashes while trying to load it. Is it because of thec->hidden.unknown.data1=malloc(256);
code above ? What would be the right way of allocating this memory ?AVFormatContext *pFormatCtx = NULL;
int i, videoStream;
AVCodecContext *pCodecCtx = NULL;
AVCodec *pCodec = NULL;
AVFrame *pFrame = NULL;
AVPacket packet;
SDL_Overlay *bmp = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *screen2 = NULL;
SDL_Rect rect;
....
....
if(frameFinished)
{
SDL_LockYUVOverlay(bmp);//-----------lock
AVPicture pict;
pict.data[0] = bmp->pixels[0];
pict.data[1] = bmp->pixels[2];
pict.data[2] = bmp->pixels[1];
pict.linesize[0] = bmp->pitches[0];
pict.linesize[1] = bmp->pitches[2];
pict.linesize[2] = bmp->pitches[1];
// Convert the image into YUV format that SDL uses
sws_scale( sws_ctx, (uint8_t const * const *)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pict.data, pict.linesize );
SDL_UnlockYUVOverlay(bmp);//-----------unlock
rect.x = 0;
rect.y = 0;
rect.w = pCodecCtx->width;
rect.h = pCodecCtx->height;
SDL_DisplayYUVOverlay(bmp, &rect);
++i;
SDL_RWops *filestream = MyCustomRWop();//SDL_AllocRW();
SDL_SaveBMP_RW (screen, filestream, i);
screen2 = SDL_LoadBMP_RW(filestream,1);//LOADING IS THE PROBLEM HERE. DON'T KNOW WHY
filestream->close;
SDL_SaveBMP(screen, filepointer);