Recherche avancée
Médias (91)
-
Les Miserables
9 décembre 2019, par
Mis à jour : Décembre 2019
Langue : français
Type : Textuel
-
VideoHandle
8 novembre 2019, par
Mis à jour : Novembre 2019
Langue : français
Type : Video
-
Somos millones 1
21 juillet 2014, par
Mis à jour : Juin 2015
Langue : français
Type : Video
-
Un test - mauritanie
3 avril 2014, par
Mis à jour : Avril 2014
Langue : français
Type : Textuel
-
Pourquoi Obama lit il mes mails ?
4 février 2014, par
Mis à jour : Février 2014
Langue : français
-
IMG 0222
6 octobre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Image
Sur d’autres sites (333)
-
FFMPEG on AWS Lambda Only outputs half a second of video when converting video from mobile safari
18 août 2023, par user1825257I am running FFMPEG on AWS Lambda using nodejs and fluent-ffmpeg. I am able to convert videos recorded on most devices / browsers, but when I attempt to convert videos recorded on Mobile Safari, the length of the output video is 1/2 a second regardless of the input length.


My Typescript code is :


import * as ffmpeg from 'fluent-ffmpeg';
 public static StandardizeVideoFormat(
 inputSignedUrl: string,
 filename: string,
 ): Promise<string> {
 const localFilePath = `/tmp/${Date.now()}_${filename}.mp4`;
 
 return new Promise((resolve, reject) => {
 ffmpeg(inputSignedUrl)
 .outputOptions([
 '-crf',
 '18',
 '-vcodec',
 'libx264',
 '-codec:a',
 'aac',
 '-preset',
 'medium',
 ])
 .output(localFilePath)
 .on('start', function (commandLine) {
 console.log('Spawned Ffmpeg with command: ' + commandLine);
 })
 .on('error', function (err) {
 reject(err);
 })
 .on('progress', function (progress) {
 console.log('progress', progress);
 })
 .on('end', function () {
 resolve(localFilePath);
 })
 .run();
 });
 }
</string>


Using FFprobe, The metadata of the input file is :


{
 streams: [
 {
 index: 0,
 codec_name: 'h264',
 codec_long_name: 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
 profile: 'Baseline',
 codec_type: 'video',
 codec_tag_string: 'avc1',
 codec_tag: '0x31637661',
 width: 1920,
 height: 1080,
 coded_width: 1920,
 coded_height: 1080,
 closed_captions: 0,
 film_grain: 0,
 has_b_frames: 0,
 sample_aspect_ratio: 'N/A',
 display_aspect_ratio: 'N/A',
 pix_fmt: 'yuvj420p',
 level: 40,
 color_range: 'pc',
 color_space: 'unknown',
 color_transfer: 'unknown',
 color_primaries: 'unknown',
 chroma_location: 'left',
 field_order: 'progressive',
 refs: 1,
 is_avc: 'true',
 nal_length_size: 4,
 id: '0x1',
 r_frame_rate: '30000/1001',
 avg_frame_rate: '60000/1991',
 time_base: '1/600',
 start_pts: 26,
 start_time: 0.043333,
 duration_ts: 4008,
 duration: 6.68,
 bit_rate: 10175170,
 max_bit_rate: 'N/A',
 bits_per_raw_sample: 8,
 nb_frames: 'N/A',
 nb_read_frames: 'N/A',
 nb_read_packets: 'N/A',
 extradata_size: 31,
 side_data_type: 'Display Matrix',
 displaymatrix: '',
 rotation: '-90',
 tags: [Object],
 disposition: [Object]
 },
 {
 index: 1,
 codec_name: 'aac',
 codec_long_name: 'AAC (Advanced Audio Coding)',
 profile: 'LC',
 codec_type: 'audio',
 codec_tag_string: 'mp4a',
 codec_tag: '0x6134706d',
 sample_fmt: 'fltp',
 sample_rate: 48000,
 channels: 1,
 channel_layout: 'mono',
 bits_per_sample: 0,
 initial_padding: 0,
 id: '0x2',
 r_frame_rate: '0/0',
 avg_frame_rate: '0/0',
 time_base: '1/48000',
 start_pts: 0,
 start_time: 0,
 duration_ts: 319488,
 duration: 6.656,
 bit_rate: 181302,
 max_bit_rate: 'N/A',
 bits_per_raw_sample: 'N/A',
 nb_frames: 'N/A',
 nb_read_frames: 'N/A',
 nb_read_packets: 'N/A',
 extradata_size: 2,
 tags: [Object],
 disposition: [Object]
 }
 ],
 format: {
 filename: 'input.mp4',
 nb_streams: 2,
 nb_programs: 0,
 format_name: 'mov,mp4,m4a,3gp,3g2,mj2',
 format_long_name: 'QuickTime / MOV',
 start_time: 0,
 duration: 6.723333,
 size: 8651792,
 bit_rate: 10294646,
 probe_score: 100,
 tags: {
 major_brand: 'iso5',
 minor_version: '1',
 compatible_brands: 'isomiso5hlsf',
 creation_time: '2023-08-05T19:03:15.000000Z'
 }
 },
 chapters: []
}



Any ideas on why the output of my command on this file always results in a 0.5 second long output ?


-
How to resolve Electron ffmpeg error opening input file ?
26 août 2023, par 3V1LXDI have an Electron app with
ffmpeg.exe
inside the project'sbin
folder. When i try to use ffmpeg to make a new video I get an error reading the input file.

FFmpeg error: [in#0 @ 000002667f2ab9c0] Error opening input: No such file or directory

Error opening input file C:/Users/xxxx/Videos/Powder/2023.08.19%2017.30.37_Apex_Legends/Powder_2023.08.19%2021.00.48.mp4



const ffmpeg = spawn(ffmpegPath, [
 '-i', videoFile,
 '-filter_complex', filterComplex,
 '-map', '[out]',
 '-c:v', 'libx264',
 '-crf', '18',
 '-preset', 'veryfast',
 '-y',
 path.join(outputDir, outputName)
]);

ffmpeg.stdout.on('data', (data) => {
 console.log(`FFmpeg output: ${data}`);
});

ffmpeg.stderr.on('data', (data) => {
 console.error(`FFmpeg error: ${data}`);
});

ffmpeg.on('close', (code) => {
 console.log(`FFmpeg process exited with code ${code}`);
 event.reply('ffmpeg-export-done'); // Notify the renderer process
});



How can i resolve this path issue ?


-
FileNotFoundError when extracting audio from recently saved video using FFMPEG"
3 août 2023, par Peter LongScenario : I'm using this tool to record tiktok live. I write another script to call the
main.py
tool because I want to add some additional options, for example, to extract the audio of the live video that is recorded

FFMPEG is used to extract the audio. First the video is saved (with FFMPEG) and after I want to extract the audio of that video (again with FFMPEG). The path where the video is recorded and saved is
C:\Users\Administrator\Desktop\tiktok


The problem is that I see the file and it is saved, but this error is generated as output :
FileNotFoundError: [WinError 2] The system cannot find the file specified


I can't figure out why it doesn't detect the last saved video file in general


I try with this


import os
import subprocess
import time
from moviepy.editor import VideoFileClip

def main():
 # Command to run main.py and record the video
 cmd = 'python main.py -user ryzebenny -output "C:\\Users\\Administrator\\Desktop\\tiktok" -ffmpeg -duration 30 --auto-convert'
 subprocess.run(cmd, shell=True)

 # Wait for the video file to appear in the folder
 wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")

 # Extract audio from recorded video
 video_filename = find_latest_file("C:\\Users\\Administrator\\Desktop\\tiktok", ".mp4")
 if video_filename:
 video_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", video_filename)
 audio_filename = video_filename.replace(".mp4", ".mp3")
 audio_path = os.path.join("C:\\Users\\Administrator\\Desktop\\tiktok", audio_filename)

 video_clip = VideoFileClip(video_path)
 audio_clip = video_clip.audio
 audio_clip.write_audiofile(audio_path)
 audio_clip.close()
 video_clip.close()
 print(f"Audio extraction completed: {audio_filename}")
 else:
 print("No video files found.")

def wait_for_video(directory):
 max_wait_time = 60 # Maximum time to wait in seconds
 start_time = time.time()
 while time.time() - start_time < max_wait_time:
 if find_latest_file(directory, ".mp4"):
 break
 time.sleep(1)

def find_latest_file(directory, extension):
 list_of_files = [f for f in os.listdir(directory) if f.endswith(extension) and os.path.isfile(os.path.join(directory, f))]
 if list_of_files:
 return max(list_of_files, key=os.path.getctime)
 return None

if __name__ == "__main__":
 main()



but i get this error


[*] 2023-08-03 15:57:09 - INFO - START RECORDING FOR 30 SECONDS
[*] 2023-08-03 15:57:09 - INFO - [PRESS 'q' TO STOP RECORDING]
[*] 2023-08-03 15:57:31 - INFO - FINISH: C:\Users\Administrator\Desktop\tiktok\TK_ryzebenny_2023.08.03_15-57-09_flv.mp4

Traceback (most recent call last):
 File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 45, in <module>
 main()
 File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 12, in main
 wait_for_video("C:\\Users\\Administrator\\Desktop\\tiktok")
 File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 34, in wait_for_video
 if find_latest_file(directory, ".mp4"):
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Users\Administrator\Desktop\tiktok\TikTok-Live-Recorder\run_main.py", line 41, in find_latest_file
 return max(list_of_files, key=os.path.getctime)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "<frozen genericpath="genericpath">", line 65, in getctime
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'TK_ryzebenny_2023.08.03_15-57-09.mp4'
</frozen></module>


Instead, I expect that once I save the video (in .mp4) the audio of that video will be extracted afterwards