
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (111)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, 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 (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
Sur d’autres sites (11554)
-
FFMPEG-Convert video from variable FPS to fixed FPS, without reencode
23 janvier 2021, par the_RRContext


Some videos are composed by joining several other videos with the same codec / resolution.
The ffmpeg 'concat' function is commonly used to accomplish this task.


When concatenating videos of the same codec, resolution, but with different FPS, there will be no error, being concatenated without reencoding and generating a video file with variable FPS.


With metadata similar to :


Frame rate : 29.838 FPS
Minimum frame rate : 2.602 FPS
Maximum frame rate : 29.970 FPS
Original frame rate : 12.500 FPS



note_01 : Metadata extracted from wmpc. See the full metadata information


The problem with this profile is that some streaming platforms, despite recognizing the x264 codec and format profile High, do not play streaming videos with variable FPS.

Example : Sending video using python lib pyrogram via API to Telegram.

Attempts to solve


All failures, because it was not possible to find a method without reencode that does not generate loss of sync with audio.


With reencode


Result : The transformation process is very long (6x), as there is a reencode. But the FPS becomes successfully fixed. As it takes time, it does not meet the purpose of the search.


ffmpeg -i "input.mp4" -filter:v fps=fps=12.5 "output.mp4"


Without reencode


Result : The complete process is fast (50x), but it generates a side effect of increasing the length of the video, losing the synchronization of the video with the audio. 01h 45min 24sec video, it was improperly transformed into 04h 11min 36sec.


note_02 : This side effect of loss of sync, only occurs when the the input_video has variable FPS. But performs perfectly when the video already has fixed FPS, serving as a means for changing FPS, with 'setpts' flag that accelerates/decelerate the video to counterbalance the effect of the FPS change without reencode in duration, as describe here.

Steps

ffmpeg -y -i "input.mp4" -c copy -f h264 "output_raw_bitstream.h264"
ffmpeg -i "input.mp4" -vn -acodec copy "input_audio.aac"
ffmpeg -r 12.5 -i "input_audio.aac" -i "output_raw_bitstream.h264" -acodec copy -vcodec copy "output.mp4"



- 

- 01-Generate raw_bitstream version
- 02-Extract audio
- 03-Merge raw_bitstream and audio, defining the new FPS








note_03 : Process suggested in the topic Using ffmpeg to change framerate


note_04 : I also tried to pass '-bsf : v h264_mp4toannexb' in the previous process, generating a .ts file, before turning the video into raw_bitstream.

Unfortunately it generated the same result.

The search continues...


-
How to optimize encoding and packaging videos using ffmpeg and shaka-packager
16 novembre 2020, par Saidamir BotirovI'm trying to encode and package uploaded videos for an LMS website where video size may differ. How can I write a sh script that converts and packages the given video based on its size (For ex. if the given video resolution is bigger than 720p and less than 1080p FFmpeg should convert videos in 2 sizes [360p, 720p] then shaka-packager should package them).


So far I have this script assuming that input video resolution is 1080p (or 1080p <= size < 4k)


#!/bin/sh
pwd
URL="$1"
ID="$2"
FOLDER="$3"

if [ -z "$URL" ];then
 echo "Must input a file"
 $SHELL
 exit
fi

DIR="$FOLDER/$ID"
OUTDIR="$DIR/cmaf"
mkdir -p -v $DIR
mkdir -p -v $OUTDIR

GOP_SIZE=50
FPS=25
CRF=28

INPUT="$DIR/input"
wget -c -O $INPUT $URL &&

if [ ! -f $FILE ]; then
 echo "$FILE does not exists"
 $SHELL
 exit
fi

ffmpeg -i $INPUT -y \
-threads 1 \
-c:v libx264 -crf $CRF -profile:v high -pix_fmt yuv420p \
-keyint_min $GOP_SIZE -g $GOP_SIZE -sc_threshold 0 \
-color_primaries 1 -color_trc 1 -colorspace 1 -movflags +faststart \
-c:a aac -b:a 128k -ar 44100 \
-r $FPS \
"$DIR/input.mp4" &&

ffmpeg -i "$DIR/input.mp4" -y \
-threads 1 \
-vn -acodec copy "$DIR/a.mp4" \
-vf scale=640:360 -an "$DIR/360p.mp4" \
-vf scale=1280:720 -an "$DIR/720p.mp4" \
-vf scale=1920:1080 -an "$DIR/1080p.mp4" &&

rm -R $OUTDIR

packager \
in="$DIR/a.mp4",stream=audio,output="$OUTDIR/a.mp4",drm_label=AUDIO \
in="$DIR/360p.mp4",stream=video,output="$OUTDIR/360p.mp4",drm_label=SD \
in="$DIR/720p.mp4",stream=video,output="$OUTDIR/720p.mp4",drm_label=HD \
in="$DIR/1080p.mp4",stream=video,output="$OUTDIR/1080p.mp4",drm_label=HD \
--enable_raw_key_encryption \
--keys label=AUDIO:key_id=f3c5e0761e6654b28f8049c778b23947:key=a4637a153a443df9eed0593043db7517,label=SD:key_id=abba277e8bcf552bbd2e86a434a9a5d7:key=69eaa807a6763af979e8d1940fb88397,label=HD:key_id=6d76f25cb17f5e76b8eaef6b7f582d87:key=cb541784c99737aef4fff74500c12ea7 \
--pssh 000000377073776800000000EDEF8BA979D64ACEA3C877DCD51D21ED00000071220F7465737420636F6E74656E74206967 \
--mpd_output "$OUTDIR/h264.mpd" \
--hls_master_playlist_output "$OUTDIR/h264_master.m3u8"



The above script first downloads a video by a given URL then converts it to appropriate video format before resizing and packaging. I assumed if I convert the video before scaling would be more performant than every time converting and resizing it. Also, I assumed if I resize to all resolutions in one command it would be much faster, but I think that is not how FFmpeg works. I'm stack in the world of FFmpeg not knowing how to write sh(or bash) script better, cleaner and dynamic for encoding and packaging videos for online streaming. I think there are others with the same problem or the same case. So any help, fix and recommendation is appreciated


-
How to set a dictionary based off of subprocess.check_output
5 juillet 2020, par Jessie WilsonThis is a confusing question, however I will try to make it as clear as possible.
Currently when I build my app, if I run it via the .py file it works perfectly. However, once I compile it some parts of my app aren't functioning, specifically this code here.


def ffprobe_run():
global output
global acodec_choices
run = subprocess.check_output("ffprobe " + videoinputquoted + " " + ffprobecommand, universal_newlines=True)
print(run)
if run[-2] == '3':
 acodec_choices = {"One": "1",
 "Two": "2",
 "Three": "3"}
elif run[-2] == '2':
 acodec_choices = {"One": "1",
 "Two": "2",}
elif run[-2] == '1':
 acodec_choices = {"One": "1",}
print(acodec_choices.values())



I am able to get the results I want with this command. Currently that's using FFPROBE to check for the amount of audio tracks there is in a file. It returns values like so


1
2
3



If there is 3 tracks. Or


1 
2



If it's two tracks. I use the command[-2]
which will give me the result of '2'


So I'm taking that result and defining a dictionary to automatically populate/change an OptionMenu


It defines this in my main app


# Audio Stream Selection
 acodec_stream = StringVar(audio_window)
 if ffprobeinfo[-2] == '1':
 acodec_stream_choices = {'Track 1': "-map 0:a:0"}
 elif ffprobeinfo[-2] == '2':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1"}
 elif ffprobeinfo[-2] == '3':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2"}
 elif ffprobeinfo[-2] == '4':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3"}
 elif ffprobeinfo[-2] == '5':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4"}
 elif ffprobeinfo[-2] == '6':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4",
 'Track 6': "-map 0:a:5"}
 elif ffprobeinfo[-2] == '7':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4",
 'Track 6': "-map 0:a:5",
 'Track 7': "-map 0:a:6"}
 elif ffprobeinfo[-2] == '8':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4",
 'Track 6': "-map 0:a:5",
 'Track 7': "-map 0:a:6",
 'Track 8': "-map 0:a:7"}
 elif ffprobeinfo[-2] == '9':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4",
 'Track 6': "-map 0:a:5",
 'Track 7': "-map 0:a:6",
 'Track 8': "-map 0:a:7",
 'Track 9': "-map 0:a:8"}
 elif ffprobeinfo[-2] == '10':
 acodec_stream_choices = {'Track 1': "-map 0:a:0",
 'Track 2': "-map 0:a:1",
 'Track 3': "-map 0:a:2",
 'Track 4': "-map 0:a:3",
 'Track 5': "-map 0:a:4",
 'Track 6': "-map 0:a:5",
 'Track 7': "-map 0:a:6",
 'Track 8': "-map 0:a:7",
 'Track 9': "-map 0:a:8",
 'Track 10': "-map 0:a:9"}
 acodec_stream.set('Track 1') # set the default option
 acodec_stream_label = Label(audio_window, text="Track :")
 acodec_stream_label.grid(row=0, column=0, columnspan=1, padx=5, pady=5)
 acodec_stream_menu = OptionMenu(audio_window, acodec_stream, *acodec_stream_choices.keys())
 acodec_stream_menu.grid(row=1, column=0, columnspan=1, padx=5, pady=5)



This is all working great, If I am running the app via the .py file. Once I compile it's missing the entire defined dictionary selection.


This is what it's supposed to look like
enter image description here


However, this is what it looks like with the code above. enter image description here


If I define the dictionary myself, it works fine. However, then I can't automatically input the correct amount of available audio tracks.


I hope this isn't too much code. I'm very new at this.


EDIT :


If I compile via pyinstaller and remove the -w flag, the program runs correctly, shows the tracks.


I'm assuming I'm not using subprocess/calling something correctly. The program I don't think is calling to FFPROBE when it doesn't have a console, vs calling it and getting the value when it has it's own console.