doc:appunti:linux:video:ffmpeg
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:linux:video:ffmpeg [2020/06/17 12:35] – niccolo | doc:appunti:linux:video:ffmpeg [2023/04/18 12:51] – [ffmpeg: leggere la sequenza di VOB da un DVD] niccolo | ||
---|---|---|---|
Line 271: | Line 271: | ||
^ Video filter | ^ Video filter | ||
^ Basic x264 | Preset: **slow** (or less), Tuning: **film**, Profile: **High**, IDC Level: **Auto** | | ^ Basic x264 | Preset: **slow** (or less), Tuning: **film**, Profile: **High**, IDC Level: **Auto** | | ||
- | ^ Video encoding | + | ^ Video encoding |
^ Audio codec | < | ^ Audio codec | < | ||
^ Audio bitrate | ^ Audio bitrate | ||
- | We can use **Avidemux** to make the final rendering (re-encoding). For a **comman | + | We can use **Avidemux** to make the final rendering (re-encoding). For a **command |
- | ==== AVC (x264) is better than ASP (xvid4) ==== | + | <code bash> |
+ | #!/bin/sh | ||
+ | TITLE=" | ||
+ | ffmpeg \ | ||
+ | -i " | ||
+ | -i ' | ||
+ | -map ' | ||
+ | -metadata title=" | ||
+ | -metadata: | ||
+ | -metadata: | ||
+ | -filter:v " | ||
+ | -vcodec ' | ||
+ | -acodec copy \ | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | |||
+ | ====== Re-encoding with tonal correction ====== | ||
+ | |||
+ | We had some video clips recorded with an **SJCAM Sj8 Pro** camera with a **bad color balance and saturation** due some bad tables [[..: | ||
+ | |||
+ | The video clips were **extracted from the original MP4 container** as **[[wp> | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # Re-encode video clips in MPEG transport stream (MPEG-TS) format applying | ||
+ | # some saturation and gamma correction. | ||
+ | # | ||
+ | # saturation: | ||
+ | # gamma_{r|g|b} | ||
+ | |||
+ | INPUT=" | ||
+ | OUTPUT=" | ||
+ | EQ_FILTER=" | ||
+ | |||
+ | # Produces MPEG segments like the ones produced by the SJCAM SJ8Pro: | ||
+ | ffmpeg -i " | ||
+ | -vf " | ||
+ | -codec:v libx264 \ | ||
+ | -preset veryslow -profile:v main -level:v 4.2 -pix_fmt yuvj420p \ | ||
+ | -x264-params ' | ||
+ | -keyint_min 8 -brand avc1 -f 3gp \ | ||
+ | -bsf:v h264_mp4toannexb -f mpegts \ | ||
+ | " | ||
+ | </ | ||
+ | |||
+ | The gamma correction for the three RGB channels was determined with the GIMP, using the //Colors// => //Levels// => //Pick the gray point for all channels// tool. The use of MPEG-TS clips allowed the montage of the final video by just concatenating them. | ||
+ | |||
+ | ===== AVC (x264) is better than ASP (xvid4) | ||
See this page: **[[https:// | See this page: **[[https:// | ||
Line 471: | Line 520: | ||
</ | </ | ||
+ | ====== Problem in MKV Remux ====== | ||
+ | |||
+ | It seems there is a bug in ffmpeg **[[https:// | ||
+ | |||
+ | This was the first try command line: | ||
+ | |||
+ | < | ||
+ | # The resulting video is broken. | ||
+ | ffmpeg -i input_file1.mkv -i input_file2.mkv \ | ||
+ | -map ' | ||
+ | -map ' | ||
+ | -codec:v copy -codec:a copy -codec:s copy \ | ||
+ | output_file.mkv | ||
+ | </ | ||
+ | |||
+ | The workaround was to extract each individual stream, and mux then together: | ||
+ | |||
+ | < | ||
+ | ffmpeg -i input_file1.mkv -map 0:v:0 -codec:v copy input-v_env.mkv | ||
+ | ffmpeg -i input_file1.mkv -map 0:a:0 -codec:a copy input-a_ita.mkv | ||
+ | ffmpeg -i input_file2.mkv -map 0:a:0 -codec:a copy input-a_eng.mkv | ||
+ | ffmpeg -i input_file2.mkv -map 0:s:0 -codec:s copy input-s_eng.mkv | ||
+ | ffmpeg \ | ||
+ | -i input-v_env.mkv \ | ||
+ | -i input-a_ita.mkv \ | ||
+ | -i input-a_eng.mkv \ | ||
+ | -i input-s_eng.mkv \ | ||
+ | -codec:v copy -codec:a copy -codec:s copy \ | ||
+ | -map ' | ||
+ | output_file.mkv | ||
+ | </ | ||
+ | |||
+ | ====== ffmpeg: leggere la sequenza di VOB da un DVD ====== | ||
+ | |||
+ | Nella directory **VIDEO_TS** di un DVD la traccia principale è normalmente suddivisa in file numerati sequenzialmente, | ||
+ | |||
+ | In teoria è sufficiente concatenare i file in un solo file destinazione e quindi trattarlo come un normale file audio/ | ||
+ | |||
+ | <code bash> | ||
+ | SOURCE=" | ||
+ | ffmpeg -i " | ||
+ | </ | ||
+ | |||
+ | ====== ffmpeg: impostare un ritardo sui sottotitoli durante il muxing ====== | ||
+ | |||
+ | Se un flusso di sottotitoli (ad esempio nel formato Picture based DVD) non indica correttamente l' | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i video-stream.mkv -i audio-stream.mkv -itsoffset 44.5 -i subtitles-stream.mkv ... | ||
+ | </ | ||
+ | |||
+ | In generale dovrebbe essere possibile scoprire l' | ||
+ | |||
+ | < | ||
+ | [mpeg @ 0x55f98bb2c6c0] New subtitle stream 0:7 at pos: | ||
+ | </ | ||
====== Doppiaggio audio con Ardour ====== | ====== Doppiaggio audio con Ardour ====== | ||
Vedere la pagina dedicata: **[[ardour_dubbing]]**. | Vedere la pagina dedicata: **[[ardour_dubbing]]**. |
doc/appunti/linux/video/ffmpeg.txt · Last modified: 2024/07/25 08:12 by niccolo