Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
How to redirect -progress option output of ffmpeg to stderr ?
27 janvier 2019, par gerrBenI'm writing my own wraping for ffmpeg on Python 3.7.2 now and want to use it's "-progress" option to read current progress since it's highly machine-readable. The problem is "-progress" option of ffmpeg accepts as its parameter file names and urls only. But I don't want to create additional files not to setup the whole web-server for this purpose.
I've google a lot about it, but all the "progress bars for ffmpeg" projects rely on generic stderr output of ffmpeg only. Other answers here on Stackoverflow and on Superuser are being satisfied with just "-v quiet -stats", since "progress" is not very convenient name for parameter to google exactly it's cases.
The best solution would be to force ffmpeg write it's "-progress" output to separate pipe, since there is some useful data in stderr as well regarding file being encoded and I don't want to throw it away with "-v quiet". Though if there is a way to redirect "-progress" output to stderr, it would be cool as well! Any pipe would be ok actually, I just can't figure out how to make ffmpeg write it's "-progress" not to file in Windows. I tried "ffmpeg -progress stderr ...", but it just create the file with this name.
-
Transforming ffmpeg code to batch proccess files in linux
27 janvier 2019, par KururinI need help converting ffmpeg command to so I can batch process the files
ffmpeg -i in.mkv -vf subtitles=in.mkv:si=0 -c:v libx264 -c:a copy -map 0:v -map 0:a:0 out.mp4
Convert everything in the folder to same name as the .mkv file but to .mp4. The file name can have [ ] _ and spaces. So I will really appreciate if any one can help me and explain the process!
-
Need A Besh / Shall Script For Run FFmpeg and Check Error Of Live Streaming
27 janvier 2019, par RakibulkstAnyone have a Bash/Shall script for run FFmpeg Live Stream Command and checking live streaming error and fix by itself. I try to make it but I become fail because I don't have enough knowledge about shall script. Can you help me to make this? I also want to reduce my streaming buffering.
#!/bin/bash while :; do ffmpeg -re -i input.ts or m3u8 or just input -r 30 -g 60 -c:v copy -c:a copy -c:s copy -x264-params keyint=60 -bufsize 500k -c:a aac -strict -2 -ar 44100 -b:a 128k -f flv rtmp://xxx-xx-xxx/application/Stream Key null > /dev/null 2>&1 done &
-
FFMPEG Can Find libx264 in Konsole, but Not in Program ?
27 janvier 2019, par Sarah SzaboI'm writing a small program to deal with a large video library that was mis-labelled and in the wrong format from a while ago.
I'm using
ProcessBuilder
for the CLI arguments, but found something strange. Konsole can execute the exact same CLI arguments for my conversation task, but the Java process can't.ffmpeg comes up just fine in the process, but says
Unknown encoder 'libx264'
.This doesn't happen when I run the command (In the same directory) with Konsole. I even had it return the command that it is executing using
builder.command().stream().forEachOrdered(string -> System.out.print(string + " "));
and ran it in Konsole. It works just fine in Konsole, but not in my Java process.It gives me
ffmpeg -i VTS_01_1.VOB -c:v libx264 -c:a aac -strict experimental Cod-4 1.mp4
which runs just fine in Konsole.Here is the subroutine:
//ffmpeg -i VTS_01_1.VOB -c:v libx264 -c:a aac -strict experimental Test.mp4 ProcessBuilder builder = new ProcessBuilder("ffmpeg", "-i", filePath.getFileName().toString(), "-c:v", "libx264", "-c:a", "aac", "-strict", "experimental", fileName + ".mp4") .directory(filePath.getParent().toFile()).inheritIO(); Process proc = builder.start(); proc.waitFor(); System.out.println("\n\n"); builder.command().stream().forEachOrdered(string -> System.out.print(string + " "));
And the full output of ffmpeg from the Netbeans window:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7 (Ubuntu 7.3.0-16ubuntu3) configuration: libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 Guessed Channel Layout for Input Stream #0.2 : stereo Input #0, mpeg, from 'VTS_01_1.VOB': Duration: 00:14:44.44, start: 0.233567, bitrate: 9712 kb/s Stream #0:0[0x1bf]: Data: dvd_nav_packet Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, top first), 720x480 [SAR 8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:2[0xa0]: Audio: pcm_dvd, 48000 Hz, stereo, s16, 1536 kb/s Unknown encoder 'libx264' ffmpeg -i VTS_01_1.VOB -c:v libx264 -c:a aac -strict experimental Cod-4 1.mp4
I'm on Kubuntu 18.04.01 LTS.
EDIT 0: Upon further reflection, this may be due to an unusual startup routine that I do for Netbeans. I was an early adopter for Netbeans 9 on KDE and have to run it using sudo, or else it simply doesn't run at all.
This may have something to do with it. I just tested it (Same command) + sudo and got the error message that the program was getting about linx264 not being found.
I can't imagine why though.
-
MoviePy Create Video that keeps audio on Twitter
26 janvier 2019, par SDSI'm exporting lots of videos and was planning to use them on Twitter.
When I read the documentation the first time I (foolishly) thought I only had to worry about the dimensions and the rest would take care of itself.
I have many files that look and play great on my PC but as soon as I load them into Twitter there is no audio. Twitter's Media Best Practices are located here:
Recommended Video Codec: H264 High Profile Recommended Frame Rates: 30 FPS, 60 FPS Recommended Video Resolution: 1280x720 (landscape), 720x1280 (portrait), 720x720 (square) Recommended Minimum Video Bitrate: 5,000 kbps Recommended Minimum Audio Bitrate: 128 kbps Recommended Audio Codec: AAC LC Recommended Aspect Ratio: 16:9 (landscape or portrait), 1:1 (square) Advanced: Frame rate must be 60 FPS or less Dimensions must be between 32x32 and 1280x1024 File size must not exceed 512 mb Duration must be between 0.5 seconds and 140 seconds Aspect ratio must be between 1:3 and 3:1 Must have 1:1 pixel aspect ratio Only YUV 4:2:0 pixel format is supported Audio must be AAC with Low Complexity profile. High-Efficiency AAC is not supported Audio must be mono or stereo, not 5.1 or greater Must not have open GOP Must use progressive scan
Here's the specs on a specific video:
Video ---- Length: 00:00:12 Frame width 1280 Frame height 720 Data rate 238kbps Total bitrate 368kbps Frame rate 24.00 frames/second Audio -- Bit rate 129 kbps Channels 2 (stereo) Audio sample rate 44.100 kHz File -- Size 551 KB Item type MP4 File
The code is fairly straightforward. I grab an image and make a short intro frame with it, then add two short clips and put it all together as you can see here:
image_clip = ImageClip(my_image) image_clip.set_duration(seconds).write_videofile('F:/sm_Temp_Files/trash_%s.mp4' % fname,fps=24) image_video_clip = mpy.VideoFileClip('F:/sm_Temp_Files/trash_%s.mp4' % fname) video_path = (my_video_path) video_clip = mpy.VideoFileClip(video_path, target_resolution = (h,w),audio=True) outro_clip = mpy.VideoFileClip('Logo_Intro_w_Stinger_Large.mp4',target_resolution = (h,w),audio=True) clips = [image_video_clip,video_clip,image_video_clip,video_clip,image_video_clip,outro_clip] slided_clips = [CompositeVideoClip([clip.fx( transfx.crossfadein, transition_seconds)]) for clip in clips] c = concatenate_videoclips(slided_clips) c.write_videofile('F:/sm_Short_Video/sm_%s.mp4' % fname,fps=24)
I'll admit, I'm out of my league to know what to do next. When Googling it looks like others have had similar issues but show fixes in FFMpeg, like this example.
Yes, I know MoviePy is written on top of FFMpeg but for a novice like me it would be really nice if there was tweaks I could do inside of MoviePy to get the audio to work on Twitter.
Thank you in advance!