Can you change decoded format with ffmpeg? - ffmpeg

I'm trying to play some videos from my external hard drive onto my TV. However, it seems Planar 4:2:0 YUV 10 bit LE is too demanding for my TV. The video codec for my videos are h264. I have some other videos that are h264 and are able to run on my TV. When I open them on VLC, their decoded format is blank. The problem just occurs when the decoded format is YUV 10-bit.
I'm not too familiar with ffmpeg and I'm not sure what commands I need or if it's possible to change the decoded format.

Basic command to get 8-bit standard YUV 4:2:0 is
ffmpeg -i in.mp4 -map 0 -c copy -c:v libx264 -pix_fmt yuv420p +movflags +faststart out.mp4

Related

How can I stream then play YUV format with/without VLC/FFMPEG?

I'm able to play a local YUV file through VLC (as expected)
.\vlc.exe --demux rawvideo --rawvid-fps 25 --rawvid-width 480 --rawvid-height 360 --rawvid-chroma I420 out.yuv
Also FFPLAY is playing well
.\ffplay.exe -f rawvideo -pixel_format yuv420p -video_size 480x360 out.yuv
Conversion to YUV was done with FFMPEG
.\ffmpeg.exe -i "video.mp4" -c:v rawvideo -pixel_format yuv420p out.yuv
However, I'm not able o stream it and play'it over local network.
I know, it sounds crazy :) but I plan to use VLC as a monitor/debugger for some YUV data.
The original MP4 file is streamed/played fine with VLC (test on the same computer)
.\vlc.exe "video.mp4" --sout="#std{access=http, mux=ts, dst=:55555/}"
.\vlc.exe http://192.168.0.174:55555/
So the big question!
How can I stream the YUV format and VLC recognise an play it as well?
All that I tried with VLC is not playable.
Thanks for any hints!

FFMPEG Command to format videos to TikTok's specs?

I'm trying upload a video exported by windows video editor to tiktok. It's a .mp4 file, and while it does upload, it isn't "TikTok'd", meaning, it only takes up the middle of screen. I was wondering what the ffmpeg command would be to output a video to TikToks specs.
Here's how it currently looks.
And here's how I want it to look.
Use the crop filter to convert horizontal to vertical video:
ffmpeg -i input.mp4 -vf "crop=ih*(9/16):ih" -crf 21 -c:a copy output.mp4
This will make it 9:16 aspect ratio.
-crf controls quality. See FFmpeg Wiki: H.264. 18-23 should be a good enough for a TikTok video.
Audio is stream copied (-c:a copy). If you get an error because your audio isn't compatible with MP4 then remove -c:a copy and AAC will be automatically used instead.

ffmpeg convert TS video file to raw rgb32 video file

I have a transport steam file containing H.264 video and would like to extract the video stream to a file containing raw uncompressed RGB32 video frames. So the H.264 video would need to be decoded and converted to RGB32 frames that would be dumped into a file.
Is there a ffmpeg command that would do this, or any other method?
Using FFmpeg command line,
ffmpeg -i in.ts -pix_fmt rgba -c:v rawvideo -map 0:v -f rawvideo in-rgba.raw

Using FFMPEG to losslessly convert YUV to another format for editing in Adobe Premier

I have a raw YUV video file that I want to do some basic editing to in Adobe CS6 Premiere, but it won't recognize the file. I thought to use ffmpeg to convert it to something Premiere would take in, but I want this to be lossless because afterwards I will need it in YUV format again. I thought of avi, mov, and prores but I can't seem to figure out the proper command line to ffmpeg and how to ensure it is lossless.
Thanks for your help.
Yes, this is possible. It is normal that you can't open that raw video file since it is just raw data in one giant file, without any headers. So Adobe Premiere doesn't know what the size is, what framerate ect.
First make sure you downloaded the FFmpeg command line tool. Then after installing you can start converting by running a command with parameters. There are some parameters you have to fill in yourself before starting to convert:
What type of the YUV pixel format are you using? The most common format is YUV4:2:0 planar 8-bit (YUV420p). You can type ffmpeg -pix_fmts to get a list of all available formats.
What is the framerate? In my example I will use -r 25 fps.
What encoder do you want to use? The libx264 (H.264) encoder is a great one for lossless compression.
What is your framesize? In my example I will use -s 1920x1080
Then we get this command to do your compression.
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i inputfile.yuv -c:v libx264 -preset ultrafast -qp 0 output.mp4
A little explanation of all other parameters:
With -f rawvideo you set the input format to a raw video container
With -vcodec rawvideo you set the input file as not compressed
With -i inputfile.yuv you set your input file
With -c:v libx264 you set the encoder to encode the video to libx264.
The -preset ultrafast setting is only speeding up the compression so your file size will be bigger than setting it to veryslow.
With -qp 0 you set the maximum quality. 0 is best, 51 is worst quality in our example.
Then output.mp4 is your new container to store your data in.
After you are done in Adobe Premiere, you can convert it back to a YUV file by inverting allmost all parameters. FFmpeg recognizes what's inside the mp4 container, so you don't need to provide parameters for the input.
ffmpeg -i input.mp4 -f rawvideo -vcodec rawvideo -pix_fmt yuv420p -s 1920x1080 -r 25 rawvideo.yuv

Create MP4 video using FFMPEG and JPEG2000 frames

I'm trying to create an MP4 video with ffmpeg using JPEG2000 images as frames.
It works when the JPEG2000 is 8bpp, but I need it to work for at least 12 bits (ideally 12, but could be 16). The images are grayscale.
This is the command I'm using:
ffmpeg.exe -i imagen.jp2 video1.mp4
If I try to use -pix_fmt it says it's not supported by the encoder (it doesn't matter which format I use).
Some sample images can be found here:
http://ioingresodemanda.com/jp2.rar
I could also use any other tool, it doesn't need to be ffmpeg.
UPDATE: Adding ffmpeg output - http://pastebin.com/NyY3vgpz
Thanks in advance
If you are ok with mp4 file having a different video format the following will work
ffmpeg -strict -2 -i 12bit.jp2 -vcodec libx264 -an out.mp4
ffmpeg -strict -2 -i 12bit.jp2 -vcodec mpeg4 -an out.mp4
ffmpeg doesn't support 12-bit color. Most of the H264 profiles only support 8-bit color; a few support 10-bit, and only the super-obscure lossless Hi444PP profile supports 14-bit color. The x264 encoder does support some of the profiles with 10-bit color, but that's as far as it goes, and you have to explicitly enable it using the --bit-depth option:
http://git.videolan.org/?p=x264.git;a=commit;h=d058f37d9af8fc425fa0626695a190eb3aa032af
As noted in the commit, you may also want to keep in mind that "very few H.264 decoders support >8 bit depth currently".

Resources