Discussion:
[MPlayer-users] combining a still with an audio file
arthurpeabody
2018-07-25 01:46:11 UTC
Permalink
I have an audio file I want to publish on YouTube. YouTube
requires a video file. I want to combine a still with the audio file
to make a video file. How do I do that? (Linux)
stan
2018-07-25 14:33:01 UTC
Permalink
On Tue, 24 Jul 2018 18:46:11 -0700
Post by arthurpeabody
I have an audio file I want to publish on YouTube. YouTube
requires a video file. I want to combine a still with the audio file
to make a video file. How do I do that? (Linux)
mplayer won't do that, it's a player of content, not a creator of
content. I haven't done it in ffmpeg, but a quick look at the man page
suggests you should be able to do it using filters. There might be a
way to use mencoder to do it, as well.
Miriam English
2018-07-25 15:51:24 UTC
Permalink
Find the length of the audio file in seconds and use that instead of the
"443" below.
Replace "Sunset.jpg" and "Mirage.mp3" with your own files.

seconds=443; for x in `seq $seconds`; do cat Sunset.jpg; done | mencoder
-o out.avi -fps 1 -ovc lavc -demuxer lavf -lavfdopts format=mjpeg
-audiofile Mirage.mp3 -oac copy -

Note that the example above is a bash shell script, so requires Linux.
It won't work on MSWindows without alteration. The command "seq
$seconds" outputs a list from "1" to the number of seconds stored in the
variable "$seconds". The for... do... done loop cycles "$seconds"
number of times to output the image file (in this case "Sunset.jpg")
through a pipe (|) to the mencoder command. Notice the final "-" in the
mencoder command. that takes its input from the standard input, which is
in this case the pipe (|).

There are some other ways to do this that use just a single image once,
but you can't seek within the resulting file, can't resize the window
without losing the image, and can't see the seconds ticking by if you
use "o" in mplayer to display it. Using the loop to input the original
image over and over again fixes all those problems, and since it is
stored as mjpeg the size remains extremely small, since the difference
between two successive identical images is zero.

Hope this helps,

- Miriam
Post by arthurpeabody
I have an audio file I want to publish on YouTube. YouTube
requires a video file. I want to combine a still with the audio file
to make a video file. How do I do that? (Linux)
_______________________________________________
MPlayer-users mailing list
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
--
What is the most important thing in the world you could be working on right now, and if you are not working on that, why aren't you?
-- Aaron Swartz (internet genius, philanthropist)
arthurpeabody
2018-07-25 20:49:01 UTC
Permalink
Thanks, Ms English!
Post by Miriam English
seconds=443; for x in `seq $seconds`; do cat Sunset.jpg; done | mencoder
-o out.avi -fps 1 -ovc lavc -demuxer lavf -lavfdopts format=mjpeg
-audiofile Mirage.mp3 -oac copy -
The file produced has the audio but a blank screen (I used the correct files for input). Does anything in the output point to the problem? The still is much larger than my screen, but I tried with a scaled-down version also.

MEncoder 20180720-8.1.1 (C) 2000-2018 MPlayer Team
192 audio & 400 video codecs
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
libavformat version 57.83.100 (external)
Forced lavf raw MJPEG video demuxer
libavformat file format detected.
[lavf] stream 0: video (mjpeg), -vid 0
VIDEO: [MJPG] 2860x4947 0bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
Forced lavf raw MJPEG video demuxer
Audio only file format detected.
[V] filefmt:65536 fourcc:0x47504A4D size:2860x4947 fps:25.000 ftime:=0.0400
Input fps will be interpreted as 1.000 instead.
libavcodec version 57.107.100 (external)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
==========================================================================
audiocodec: framecopy (format=55 chans=1 rate=22050 bits=16 B/s=4000 sample-0)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x7f68a23c4120]bicubic scaler, from yuv444p to yuv420p using MMXEXT
videocodec: libavcodec (2860x4948 fourcc=34504d46 [FMP4])
Movie-Aspect is undefined - no prescaling applied.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos: 1.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]

Skipping frame!
Pos: 1.0s 2f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.100 [0:31]

Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.

Video stream: 4853.352 kbit/s (606669 B/s) size: 606669 bytes 1.000 secs 2 frames

Audio stream: 32.000 kbit/s (3999 B/s) size: 99892 bytes 24.973 secs
Miriam English
2018-07-26 00:22:21 UTC
Permalink
It does look a bit like it has a problem with the image...

One point of difference between your output and mine is that yours gives:

Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x7f68a23c4120]bicubic scaler, from yuv444p to yuv420p using
MMXEXT
videocodec: libavcodec (2860x4948 fourcc=34504d46 [FMP4])
Movie-Aspect is undefined - no prescaling applied.
Writing header...


where mine gives:

Opening video filter: [scale]
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0x8c9c920]BICUBIC scaler, from yuv444p to yuv420p using MMX2
videocodec: libavcodec (800x600 fourcc=34504d46 [FMP4])
Writing header...

I don't know why that would be. Perhaps someone else here might have
some insight.

I'm using an earlier version of libavcodec version 54.23.100 (internal)
Yours is more recent: libavcodec version 57.107.100 (external)

I doubt that would cause the problem though. If you want to email me
directly (not through the list) the image as an attachment I'll try it
with my sound file to try to rule that out.

Hmmm... when I tried rescaling my 800x600 image to the size of yours --
2860x4948 -- it encodes much more slowly. But the result refuses to play
in mplayer at all, giving the error message:

Movie-Aspect is 0.58:1 - prescaling to correct movie aspect.
VO: [xv] 2860x4948 => 2860x4948 Planar YV12
Source image dimensions are too high: 2860x4948 (maximum is 4096x4096)
FATAL: Cannot initialize video driver.

Although my copy of mencoder did still seem to encode it properly:

Opening video filter: [scale]
Movie-Aspect is 0.58:1 - prescaling to correct movie aspect.
[swscaler @ 0x8c9c920]BICUBIC scaler, from yuv444p to yuv420p using MMX2
videocodec: libavcodec (2860x4948 fourcc=34504d46 [FMP4])
Writing header...

If I try to use a different player (vlc) it gives this error:
"Your video output acceleration driver does not support the required
resolution: 2860x4948 pixels. The maximum supported resolution is 2860x4096.
Video output acceleration will be disabled. However, rendering videos
with overly large resolution may cause severe performance degration."
but then goes ahead and shows it anyway.

Try resizing the image smaller and putting it on a background with a
more normal aspect ratio. Try something radically smaller, like putting
it on an 800x600 background. See if that fixes your problem.

Cheers,

- Miriam
Post by arthurpeabody
Thanks, Ms English!
Post by Miriam English
seconds=443; for x in `seq $seconds`; do cat Sunset.jpg; done | mencoder
-o out.avi -fps 1 -ovc lavc -demuxer lavf -lavfdopts format=mjpeg
-audiofile Mirage.mp3 -oac copy -
The file produced has the audio but a blank screen (I used the correct files for input). Does anything in the output point to the problem? The still is much larger than my screen, but I tried with a scaled-down version also.
MEncoder 20180720-8.1.1 (C) 2000-2018 MPlayer Team
192 audio& 400 video codecs
Reading from stdin...
success: format: 0 data: 0x0 - 0x0
libavformat version 57.83.100 (external)
Forced lavf raw MJPEG video demuxer
libavformat file format detected.
[lavf] stream 0: video (mjpeg), -vid 0
VIDEO: [MJPG] 2860x4947 0bpp 25.000 fps 0.0 kbps ( 0.0 kbyte/s)
Forced lavf raw MJPEG video demuxer
Audio only file format detected.
[V] filefmt:65536 fourcc:0x47504A4D size:2860x4947 fps:25.000 ftime:=0.0400
Input fps will be interpreted as 1.000 instead.
libavcodec version 57.107.100 (external)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmjpeg] vfm: ffmpeg (FFmpeg MJPEG)
==========================================================================
audiocodec: framecopy (format=55 chans=1 rate=22050 bits=16 B/s=4000 sample-0)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
videocodec: libavcodec (2860x4948 fourcc=34504d46 [FMP4])
Movie-Aspect is undefined - no prescaling applied.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Pos: 1.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 1.0s 2f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.100 [0:31]
Flushing video frames.
Writing index...
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Video stream: 4853.352 kbit/s (606669 B/s) size: 606669 bytes 1.000 secs 2 frames
Audio stream: 32.000 kbit/s (3999 B/s) size: 99892 bytes 24.973 secs
_______________________________________________
MPlayer-users mailing list
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users
--
What is the most important thing in the world you could be working on right now, and if you are not working on that, why aren't you?
-- Aaron Swartz (internet genius, philanthropist)
Continue reading on narkive:
Loading...