using ffmpeg to convert flac to alac with cover art - ffmpeg

I have seen a few discussions on this but none of them give the answer I was hoping for. I am trying to convert flac to alac while preserving all of the tags and the embedded cover image. I know we can manually set a cover image by passing a separate image file to ffmpeg.... but how do I use the one embedded in the flac file? dbpoweramp does this automatically, but I would rather use ffmpeg so that I can automate my workflow with a bash script.

ffmpeg -i input.flac -c:v copy -c:a alac output.m4a

Fixed by adding a source that has a newer version...
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
...And using #logan command...
ffmpeg -i input.flac -c:v copy -c:a alac output.m4a
Thanks

I was unable to get the jonathon ppa to work on my rig so you can use "-vcodec copy "
"$FILE" -vcodec copy -acodec alac "$NEW_FILE" to copy the image over to the new file.
However, I do see that file names with "()" sometimes don't convert. I don't get an error in my script it just moves on. without the copy. Would be nice if anyone know how to fix that.

Related

.M2P file extention to image file extension, image processing

I have a .m2p file (which is an image file i believe that contains many images, kinda like a video of still images) that I would like to convert to any image file (preferably .png or .jpg).
Does anyone know if there is a possible way to do so?
Does anyone know how to convert these, using a script, to a different file extension essentially. Extract out all the images from a .m2p file?
Any help would be appreciated.
Figured out the answer to this.
Can simply just use ffmpeg (for Mac atleast).
Images:
To grab a still from a certain time:
ffmpeg -i video.m2p -ss 00:00:07.000 -vframes 1 thumb.png
Videos:
To convert m2p to mp4
ffmpeg -i example.m2p -f mp4 -vcodec libx264 -preset slow -profile:v main -acodec aac example.mp4 -hide_banner
Random: I used the slow preset just so it outputs a better quality video

ffmpeg -vcopy to folder without filename

I'm trying to find a command line to copy part of videos and export them to a different folder.
The problem i need to solve is each file may have different extensions, .mxf, .dv, .avi etc some came from a internal url server that gives download links like /server/download?id=1000 and that will download an mp4, or a mxf so i have no idea the extension.. the name is not important..
i want to know if it's possible or there's an existing command line where the -y file.extension is not needed.
For example
ffmpeg.exe -i "/server/download?id=1000" -vcodec copy -acodec copy -y "folder/"
An i get a filename.avi or filename.mxf inside that "folder/"
.mxf is a container format, so just pulling it in like ffmpeg -i http://xx -vcodec copy -acodec copy OUTPUT.mp4 might work regardless of the input (if it starts as an .mxf then ffmpeg will basically re-container it into an mp4 container). (it will "re-container" the same elemental video/audio streams, which will remain unmodified, I assume that was your initial intent). If you really want to keep the containers also the same, you might be able to run ffmpeg -i http:///xx first, which might tell you the container type, then turn around and run it like ffmpeg -i http://xx -vcodec copy -acodec copy output.ext

FFMPEG says "No such file or directory" when trying to convert image sequence

From the shell, when I specify a sequence of images via %d in the input filename, FFMPEG insists "No such file or directory", despite evidence to the contrary. Looking online, I haven't managed to find any references to generating video from a sequence of images using FFMPEG where %d is not used, yet it seems to fail here.
My images should be identified by FFMPEG from img%06d.gif. Issuing ls img[0-9][0-9][0-9][0-9][0-9][0-9].gif succeeds in the very same directory I issue the FFMPEG command.
The command I use is:
ffmpeg -i img%06d.gif -c:v libx264 -r 30 -pix_fmt yuv720p test.mp4
What could possibly be going wrong???
The following definitely works:
ffmpeg -i images%06d.png -c:v libx264 -r 30 test.mp4 -y
However it doesn't work with GIF pictures.
You can losslessly convert your pictures to PNG and run the above command line.

ffmpeg -r option

I am trying to use ffmpeg (under linux) to add a small title to a video. So, I use:
ffmpeg -i hk.avi -r 30000/1001 -metadata title="SOF" hk_titled.avi
The addition of title seems to work, but, the problem is the output file is about a 1/3rd of the file size of the input file and I was wondering why this is? Is this at the expense of quality of the video? I am unsure.. How do I preserve the same quality/size as the input file?
The main point I am unable to figure out is the use of -r option. Going through the ffmpeg docs, it seems to suggest that -r is frames per second (The input video is 23.9fps). At the moment, (30000/1001) works out to 29 fps, but I was unsure if I should be using this value.
Thanks for your time.
The default settings for ffmpeg do not always provide a good quality output when you encode, but this depends on your output format and the available encoders. With your output ffmpeg will use the default of -b 200k or -b:v 200k.
However, you can tell ffmpeg to simply copy the input streams without re-encoding and this is recommended if you just want to add or edit metadata. These examples do the same thing but use different syntax depending on your ffmpeg version:
ffmpeg -i hk.avi -vcodec copy -acodec copy -metadata title="SOF" hk_titled.avi
ffmpeg -i hk.avi -c copy -metadata title="SOF" hk_titled.avi

Merge/Join images & video files together using mencoder or ffmpeg

Hi i have command to merge video files
but i want to join an image to a video file.
What i am doing:
1) convert image to mp4 using ffmpeg
2) joining this converted video to my selected video using mencoder
but it prommpts an error:
cannot mix video only files with audio-video files try -nosound.
i also added -nosound but with this the resultant file does not contains any audio.
what to do?
ffmpeg command:
-y -i Garden.jpg -s 640x480 converted.mp4
this converted .mp4 file is created properly but with no audio
mencoder command:
-oac mp3lame -ovc lavc -noodml -o output.mp4 converted.mp4 selected.mp4
Please help..
If you target is Windows, converting the result to msmpeg4v2 (avi) or mpeg1video (mpg) or asf (wmv) would probably work best.
Note, ASF files often have .wmv or .wma extensions in Windows. It should also be mentioned that Microsoft claims a patent on the ASF format, and may sue or threaten users who create ASF files with non-Microsoft software. It is strongly advised to avoid ASF where possible.
Read this for full list.
Here is a free command line tool which can join MPEG 1 files:
http://mpgtx.sourceforge.net/#Download
(Windows exe available). Did not try it on my own, however.
EDIT: another alternative may be to utilize VirtualDub. You have to write your merge command to a script and pass the script name per command line:
http://www.virtualdub.org/blog/pivot/entry.php?id=20
However, you have to get yourself through the syntax of the scripting language
http://www.virtualdub.org/docs/vdscript.txt
(I did not try this by myself programmatically, have only used virtual dub via GUI interface to concat video files, which worked really well.)
FFmpeg can accomplish this easily with the following command:
ffmpeg -i vid-1.mp4 -i vid-2.mp4 -ar 44100 -ab 64k -ac 1 -c:a libmp3lame -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' output.mp4

Resources