Playing MP4 file in Powerpoint - ffmpeg

I have a huge MP4 file (4GB) an hour long video. I want to extract port of the file. So I used the following command to extract 70 seconds(00:01:10) of video starting from 11 minutes
ffmpeg -i INPUT.mp4 -ss 00:11:00 -t 00:01:10 -c:v copy -c:a copy OUTPUT.mp4
Now I got a small file extracted from Input.MP4
The output.mp4 file size is still big(90 MB). So I used the following command
ffmpeg -i OUTPUT.mp4 -c:v libx264 -crf 30 SmallSizeVideo.avi
I got SmallSizeVideo.avi file which is approximately 6MB.
I am using Powerpoint 2010. I want to insert the video in Powerpoint and play.
Unfortunately when I embed SmallSizeVideo.avi Powerpoint is unable to play
1) Is my approach correct?
2) What is the best way to situation like me to play small portion of clips in powerpoint
Thank you

Last I heard, h.264 in avi was nonstandard. Try instead to output as mp4 and see if that plays in PowerPoint:
ffmpeg -i OUTPUT.mp4 -c:v libx264 -crf 30 SmallSizeVideo.mp4
If it works, I believe it may work in Windows 7 or later and also OS X.

I had the same issue and had to stay for PowerPoint 2010 at Windows 10. Thus, PowerPoint is unable to play MP4, cf. https://support.office.com/en-gb/article/Video-and-audio-file-formats-supported-in-PowerPoint-d8b12450-26db-4c7b-a5c1-593d3418fb59. Finally, I come up with this command:
ffmpeg.exe -i input.mp4 -c:v wmv2 -b:v 12024k -c:a wmav2 -b:a 128k output.wmv
This command based on https://stackoverflow.com/a/34851916/2258393 by Reinhard Behrens.
By means of this command, I am able to archive the same file size and approx. the same quality as with MP4.

Related

using FFMPEG to crop video but only audio is produced

I use this command to crop a few seconds of mkv/mp4 videos. Sometimes it works perfectly fine.
But other times the output file which is in mp4 format only contains the audio. How can I fix it?
ffmpeg -i input.mp4 -ss 01:10:15 -to 01:10:20 -c:v copy -c:a copy output.mp4
Don't use -c:v copy -c:a copy Re-encode it.
Direct stream copy copies the GOP (Group of pictures) chunks of the structure of file (from the first I-frame to the last P or B-frame).
Presumably your time is too short, less than one chunk of GOP.

FFmpeg resize without upscaling

I am working on a script that searches for all media files in the current directory and subdirectories and then batch encodes them to H.265. I was hoping to put in some max frame sizes to make things that are 1080p to be 720p. That is the straightforward part but I have some that are 480p and I don't want those to end up as 720p. How can I modify my ffmpeg filters to take that into account?
The command:
ffmpeg -i input -c:v hevc_nvenc -preset medium -crf 28 -c:a copy output.mp4
Use:
-vf "scale=-2:min'(720,ih)'"
or
-vf "scale=min'(1280,iw)':-2"
See :
FFmpeg Arithmetic Expression for a list of accepted functions
FFmpeg Filters: Scale for more info on the scale filter

How add scale in my ffmpeg command

i want convert video from any format to mp4. so i am using command:
ffmpeg -i ttt.mp4 -vcodec copy -acodec copy test.mp4
this is working perftectly but now i also add scale in this -s 320:240.
There also many other command for convert LIKE :
ffmpeg -i inputfile.avi -s 320x240 outputfile.avi
but after convert by this command video not play in html5 player
BUT this is not working so tell me in my command how i add scale;
So please provide me solution for this .
Thanks in advance.
You have several problems:
In your command, you have -vcodec copy you cannot scale video without reencoding.
In the command you randomly found on the Internet, they are using AVI, which is not HTML5-compatible.
What you should do is:
ffmpeg -i INPUT -s 320x240 -acodec copy OUT.mp4
Adding to Timothy_G:
Video copy will ignore the video filter chain of ffmpeg, so no scaling is available (man ffmpeg is a great source of information that you will not find on Google). Notice that once you start decoding-filtering-encoding (i.e., no copy) the process will be much slower (x100 time slower or even more). The libx264 is recommended if you want compatibility with all browsers.
$ ffmpeg -i INPUT -s 320x240 -threads 4 -c:a copy -c:v libx264 OUT.mp4
vp9 will provide nearly 50% extra bandwidth saving, but only for supported browsers (Firefox/Chrome), and the encoding will much slower compared to libx264 (that itself is much slower that v:c copy):
$ ffmpeg -i INPUT -s 320x240 -c:a copy -c:v vp9 OUT.webm
Notice that there is a set of formats (containers) accepted by browsers (most admit mp4, some also webm, ...) and for each format there is a set of audio/video codecs accepted. For example you can use mp3 or aac with an mp4 file (container), but not with webm files.
http://en.wikipedia.org/wiki/HTML5_video#Supported_video_formats

Converted mp4 h264 baseline format loads long time

I have converted my video to mp4 x264 baseline format and it works fine with all pc/mobile phones , the problem is it takes long time to load the video while googling came to know that ffmpeg converts and sets the index file at the eof the video so it loads to the end to read and then plays the video, So any advices would be appreciatable to cut short the loading time.
Note:tryied out QT index swapper2 but dint give much difference , please advice .
this is the cmd i used to convert -
ffmpeg -i … -c:v libx264 -profile:v baseline -level 1 …
Thanks for your time .
You have several options to relocate the moov atom so the video can begin playback before it is completely downloaded by the client.
-movflags faststart
The easiest is the option -movflags faststart when re-encoding:
ffmpeg -i input -c:v libx264 -profile:v baseline -movflags faststart output.mp4
If you already encoded your .mp4 file, but simply want to move the atom:
ffmpeg -i input.mp4 -codec copy -movflags faststart output.mp4
You may need to get a more recent ffmpeg version to use this option. See the FFmpeg download page for links to ffmpeg builds for Linux, OS X, and Windows, or you can follow a step-by-step guide to compile ffmpeg.
qt-faststart
Alternatively you can use the qt-faststart tool that comes with the ffmpeg source:
cd ~/ffmpeg/tools
make qt-faststart
./qt-faststart input.mp4 output.mp4
MP4Box
Or you could use MP4Box (usually provided by the gpac package depending on your distro):
MP4Box -add input.mp4 output.mp4
Also See
FFmpeg and x264 Encoding Guide
FFmpeg and AAC Audio Encoding Guide

JPG join MP3 to FLV

How to convert image and music to video? I would like YouTube video. I like FFMPEG command or other Ubuntu free software. I would like: *.mp3 + *.jpg = *.flv
Here is an example using a recent ffmpeg syntax:
ffmpeg -loop 1 -i image.jpg -i music.mp3 -shortest -c:v libx264 -crf 20 -tune stillimage -c:a copy output.mkv
This example will copy the audio instead of re-encoding to preserve quality. Adjust quality if desired with the CRF option. See the FFmpeg and x264 Encoding Guide for more information.
Super User (another StackExchange site) is a better place for ffmpeg usage questions since Stack Overflow is programming specific.
Today I was in need of merging an image and an audio file into a video file. Since none of the answers that I found on SO worked for me, I'm leaving here what worked for me after trial and error:
ffmpeg -loop 1 -t 205 -i audio.mp3 -i image.jpg -crf 20 test.flv
Where 205 is the duration of the input mp3 file in seconds -> 3:25 minutes.
(Tested with FFmpeg SVN-r13582)

Resources