I have a video that is only one image and an audio track. It is very large and I would like to make it smaller. Since there is only one image/frame, I would think it would be more efficient if only this one frame would be saved and just shown, instead of having a copy of the image in every frame. How can I make such a video with ffmpeg on linux?
So far I have used the command
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
which greatly reduced the size. I am not quite sure how it does it, but since the result is nearly as small as the audio track (that I extracted for comparison), it seems that the condec is a good choice.
However it takes SO much time for the transformation and I have a couple of other videos I would like to transform. Is there a way to speed up the process or choose a different command?
For example I am thinking, whether I could tell ffmpeg that it is just one image and it should just use the n-th frame and not bother with encoding the rest.
EDIT: Using the ideas from Баяр Гончикжапов is used these commands:
file="input.mp4"
ffmpeg -i "$file" -f image2 -frames:v 1 /tmp/tmp.jpg
ffmpeg -i "$file" -i /tmp/tmp.jpg -map 0:a -map 1:v -c:a copy -c:v copy output.mp4
$ mediainfo "$file"
General
Complete name : 1 Hour Epic Music _ Best Of Two Steps From Hell Voll. III.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 134 MiB
Duration : 1h 0mn
Overall bit rate mode : Variable
Overall bit rate : 308 Kbps
Encoded date : UTC 2013-11-28 04:41:00
Tagged date : UTC 2013-11-28 04:41:00
gsst : 0
gstd : 3648063
gssd : B5CC58185HH1408390296880239
gshh : r2---sn-9nj-q0ne.googlevideo.com
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Format settings, GOP : M=1, N=60
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1h 0mn
Bit rate : 210 Kbps
Maximum bit rate : 2 389 Kbps
Width : 640 pixels
Height : 360 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 24.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.038
Stream size : 91.3 MiB (68%)
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 2013-11-28 04:41:19
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 1h 0mn
Bit rate mode : Variable
Bit rate : 96.0 Kbps
Maximum bit rate : 102 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 41.7 MiB (31%)
Title : IsoMedia File Produced by Google, 5-11-2011
Encoded date : UTC 2013-11-28 04:41:10
Tagged date : UTC 2013-11-28 04:41:19
$ mediainfo /tmp/output.mp4
General
Complete name : /tmp/output2.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 42.4 MiB
Duration : 1h 0mn
Overall bit rate mode : Constant
Overall bit rate : 97.4 Kbps
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
Writing application : Lavf57.83.100
Video
ID : 2
Format : JPEG
Codec ID : 6C
Duration : 40ms
Bit rate mode : Constant
Bit rate : 4 215 Kbps
Width : 640 pixels
Height : 360 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.732
Stream size : 20.6 KiB (0%)
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 1h 0mn
Bit rate mode : Constant
Bit rate : 96.0 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz
Compression mode : Lossy
Stream size : 41.7 MiB (99%)
Encoded date : UTC 1904-01-01 00:00:00
Tagged date : UTC 1904-01-01 00:00:00
- However, as one can notice, the audio was not really copied. How can I make sure, audio is really copied?
- Also VLC Player has an issue: When starting the video, the slides (that indicates the time) does not move. If I move it to something greater than 00:00, it does move again...
- How do I say that I want to extract a different frame than the first?